PDA

View Full Version : If then statement (scripting)


harIII
10-05-2009, 09:51 AM
I need a script that does the following:

if (creature is not in the module)
spawn the creature;

then or else (creature is already in the module)
removes the creature;

Star Admiral
10-05-2009, 11:37 AM
Try this:

void main() {
if( GetObjectByTag( "creaturetag" ) == OBJECT_INVALID )
CreateObject( OBJECT_TYPE_CREATURE, "creaturetag", Location( Vector( 0.0, 0.0, 0.0 ), 0.0 ) );
else
DestroyObject( GetObjectByTag( "creaturetag" ) );
}


- Star Admiral