Game Development Community

T3D 1.2 (and way back) - Incorrect use of Item::static in scripts

by Guy Allard · in Torque 3D Professional · 06/16/2012 (5:26 am) · 2 replies

Build: all
Platform: all
Target: game

Issues:
This is something that has annoyed me for years.

In Script, Item::static is used to indicate if an item should respawn.

However, Item::static is used by the engine to decide if the item should perform collisions, move etc - see how Item::static is defined in initPeristFields:
addField("static",      TypeBool, Offset(mStatic, Item), "If true, the object is not moving in the world (and will not be updated through the network).n");

This muddled use of the variable can result in some undesired behavior, as if you don't want an item to respawn, you have to set static = false, which then activates unintended stuff engine side, such as periodically networking its position.

Suggested Fix:
Use a different variable in the scripts (maybe Item::respawn ?) to indicate if the item should respawn.

#1
06/16/2012 (9:10 am)
You're right, i think that i include it immediately in the fixs of the CE as:
addField("isStatic",
#2
06/16/2012 (10:06 am)
Perhaps isPersistent would be more descriptive.