-- Basic Entity -- Loaded - Called when the script is loaded function Loaded() print("Script loaded - object:",objid); end -- Unloaded - Called when the script is unloaded function Unloaded() print("Script unloaded"); end -- OnCreate - Called when this entity is created -- -- In: Nothing -- -- Return 0 to destroy entity function OnCreate() print(preset_name,"created!"); return 1; -- Keep it alive! end -- OnDestroy - Called when this entity is destroyed -- -- In: Nothing -- -- Return Nothing function OnDestroy() print(preset_name,"destroyed"); end -- OnAttached - Called when this entity is attached to something else -- -- In: ID GameObject ID of entity it was attached to -- -- Return Nothing function OnAttached(ID) print(preset_name,"attached to object ID",ID); end -- OnDetached - Called when this entity is detatched from something else -- -- In: ID GameObject ID of entity it was removed from -- -- Return Nothing function OnDetached(ID) print(preset_name,"detatched from object ID",ID); end -- OnKilled - Called when this entity is killed -- -- In: ID GameObject ID of entity that killed it -- -- Return Nothing function OnKilled(ID) print(preset_name,"killed by object ID",ID); end -- OnDamaged - Called when this entity is damaged -- -- In: ID GameObject ID of entity that damaged it -- damage Amount of damage dealt -- -- Return Nothing function OnDamaged(ID, damage) print(preset_name,"damaged by object ID",ID,"Amount = ",damage); end -- OnMessage - Called when this entity receives a custom message -- -- In: message Message Number -- param Message Param -- ID GameObject ID of sender -- -- Return Nothing function OnMessage(message, param, ID) print(preset_name,"getting message",message,param,"from object ID",ID); end -- OnAISoundHeard - Called when the entity hears a sound -- -- In: ID GameObject ID of sound heard -- Sound Sound number -- X Vector location X of sound -- Y Vector location Y of sound -- Z Vector location Z of sound -- -- Return Nothing function OnAISoundHeard(ID, sound, X, Y, Z) print(preset_name,"heard sound",Sound,"at",X,Y,Z); end -- OnAIEnemySeen - Called when the entity sees an enemy -- -- In: ID GameObject ID of enemy seen -- -- Return Nothing function OnAIEnemySeen(ID) print(preset_name,"saw enemy object ID",ID); end -- OnAIActionComplete - Called when the entity completes an action -- -- In: Action Action number -- Reason Reason for completion -- -- Return Nothing function OnAIActionComplete(Action, Reason) print(preset_name,"completed action",Action,"Reason: ",Reason); end -- OnTimer - Called when a timer ends -- -- In: Timer Timer number -- -- Return Nothing function OnTimer(Timer) print(preset_name,"completed timer",Timer); end -- OnAnimComplete - Called when an animation is completed -- -- In: Anim Name of the animation -- -- Return Nothing function OnAnimComplete(Anim) print(preset_name,"completed animation",Anim); end -- OnPoked - Called when the entity is poked -- -- In: ID GameObject ID of poker -- -- Return Nothing function OnPoked(ID) print(preset_name,"poked by object ID",ID); end -- OnEntered - Called when the entity is entered -- -- In: ID GameObject ID of enteree -- -- Return Nothing function OnEntered(ID) print(preset_name,"entered by object ID",ID); end -- OnExited - Called when the entity is exited -- -- In: ID GameObject ID of exitee -- -- Return Nothing function OnExited(ID) print(preset_name,"exited by object ID",ID); end function OnArmed() print(preset_name,"is armed"); end function OnDetonate() print(preset_name,"has detonated"); end function OnDisarmed(Disarmer) local DisarmerPreset = Get_Preset_Name(Disarmer); print(preset_name,"has been disarmed by",DisarmerPreset); end