Game Development Community

Attach a script to a level?

by Jace · in Torque Game Builder · 06/27/2009 (12:43 am) · 2 replies

Hello I want to execute a script when a level loads:

Level Name: TestLevel
Level 2 Name: TestLevel2

When TestLevel loads I would like to execute TestScript
When TestLevel2 loads I would like to execute TestScript2

Everytime I directly edit the level file ".t2d" with torsion it workshowever when I load the level into the editor it overwrites my hand changes.

Thanks and sorry for all the questions trying to get back into the swing here.

#1
06/27/2009 (12:12 pm)
Look in the "common/gameScripts/levelManagement.cs" script for the onLevelLoaded callback.

When a level is loaded, that function is called automatically, and scripts can be triggered from there.
#2
06/27/2009 (8:25 pm)
Thank you!