Game Development Community

Path::onAdd does not work

by Katrina Rose · in Torque Game Engine · 08/31/2004 (11:28 am) · 1 replies

Hi,

In our game I used the onAdd state for an item (octahedron) to make drop points for my Enemy bots. You put these around and they have 2 fields: Path, and level. A bot automatically spawns there using the closest path and of the level specified. I am using a global counter in the ItemData::onAdd to increment the counter when each spawn point is added so there are no duplicates. This works like a charm and the only thing you have to change manualy is the bot level. I would like to do the same thing with the paths. I would like to have each added path increment and go into a global variable that I can call later to find it's location and such. The problem is that the Path::onAdd does not get called when a new path is created. Does anyone know a workaround for this? Or mabie a C++ code change that would enable it?

Thanks for your help,

Marrion Cox

#1
09/04/2004 (1:19 pm)
I'd suggest opening engine/sim/simPath.cc, going to the SimPath::onAdd() method and adding a script callback. You can look at, say, ScriptObject for an example of the code you'll need. It's all the same idiom.