Code:
#!/usr/bin/perl #Level master COG #Generated by Me symbols message startup message trigger message pulse template tpl_objet=bot local template force_destruction=+force_dest_p4 local thing leBot local thing dest local thing botVise local model weapmesh0=red-0.3do model weapmesh1=red-1.3do model weapmesh2=red-2.3do model weapmesh3=red-3.3do model weapmesh4=red-4.3do model weapmesh5=red-5.3do model weapmesh6=red-6.3do model weapmesh7=red-7.3do model weapmesh8=red-8.3do model weapmesh9=red-9.3do model weapmesh10=red-10.3do int actorFlags local int thingFlags local int aiModeFlags local int specialMove local vector tempVector1 local vector tempVector2 local end code startup: Return; trigger: if (GetSourceRef() == 900) // startup cog, respawn { Print("<<Trigger 900 recu>>"); // création du bot leBot=CreateThingNr(tpl_objet,getparam(0)); capturething(leBot); SetThingModel(leBot,weapmesh0[10]); // on vire tout ClearActorFlags(leBot,0x4); //Players fieldlight //ClearActorFlags(leBot,0x8); //Invulnerability ClearActorFlags(leBot,0x10); //Players head is centered ClearActorFlags(leBot,0x20); //Explodes when killed ClearActorFlags(leBot,0x40); //Actor will not drown ClearActorFlags(leBot,0x80); //Invisibility ClearActorFlags(leBot,0x100); //Droid ClearActorFlags(leBot,0x200); //Boss ClearActorFlags(leBot,0x400); //Deaf ClearActorFlags(leBot,0x800); //Blind ClearActorFlags(leBot,0x2000); //Blocking attacks ClearActorFlags(leBot,0x10000); //Actor is screaming ClearActorFlags(leBot,0x40000); //Partialy imobilized ClearActorFlags(leBot,0x80000); //Cannot shoot undewater ClearActorFlags(leBot,0x100000); //Actor cannot be auto targeted ClearActorFlags(leBot,0x200000); //Totaly Imobolized ClearActorFlags(leBot,0x400000); //Actor is falling to his death ClearActorFlags(leBot,0x800000); //No display Hud ClearActorFlags(leBot,0x1000000); //Damages other actors at full rate ClearActorFlags(leBot,0x2000000); //Can see in the dark ClearActorFlags(leBot,0x80000000); //Causes the green corner brackets to appear in view actorFlags=0; actorFlags=actorFlags|0x400; // deaf actorFlags=actorFlags|0x2000000; // can see in dark actorFlags=actorFlags|0x8;// invulnerable actorFlags=SetActorFlags(leBot,actorFlags); // on vire tout //ClearThingFlags(leBot,0x1); //Emits Light //ClearThingFlags(leBot,0x2); //Dead //ClearThingFlags(leBot,0x4); //Magneticly sealed //ClearThingFlags(leBot,0x8); //Part of world geometery //ClearThingFlags(leBot,0x10); //Invisible //ClearThingFlags(leBot,0x40); //Can stand on //ClearThingFlags(leBot,0x400); //Cog Linked //ClearThingFlags(leBot,0x800); //No Crush //ClearThingFlags(leBot,0x1000); //Not in Easy //ClearThingFlags(leBot,0x2000); //Not in Medium //ClearThingFlags(leBot,0x4000); //Not in Hard //ClearThingFlags(leBot,0x8000); //Not in Multi Player //ClearThingFlags(leBot,0x10000); //Not in Single Player //ClearThingFlags(leBot,0x20000); //Object is sending a pulse message to it's cog //ClearThingFlags(leBot,0x40000); //Object is timed to send a timer event to it's cog //ClearThingFlags(leBot,0x400000); //Object is metal //ClearThingFlags(leBot,0x800000); //Object is earth //ClearThingFlags(leBot,0x1000000); //Object makes no sounds //ClearThingFlags(leBot,0x2000000); //Object is underwater //ClearThingFlags(leBot,0x8000000); //Object is destroyed if it enters water //ClearThingFlags(leBot,0x10000000); //Object is destroyed if it enters air //ClearThingFlags(leBot,0x20000000); //Object generatoes a splash: Cog Message when entering/leaving water thingFlags=0; // Rien thingFlags=SetThingFlags(leBot,thingFlags); // on vire tout AiClearMode(leBot,0x1); // Ai is moving towards it`s destination AiClearMode(leBot,0x2); //Ai has a valid target and is trying to attack it AiClearMode(leBot,0x4); //Ai is searching for targets or danger AiClearMode(leBot,0x8); //Ai is turning to face it`s LookTarget AiClearMode(leBot,0x10); //Ai`s current move target is valid AiClearMode(leBot,0x29); //Ai`s current fire target is valid AiClearMode(leBot,0x200); //Ai is ready (awake and active) AiClearMode(leBot,0x400); //Ai has Los (line of sight) to it`s target AiClearMode(leBot,0x800); //Ai is fleeing aiModeFlags=0; aiModeFlags=aiModeFlags|0x1; // move //aiModeFlags=aiModeFlags|0x200; // awake & active aiModeFlags=AiSetMode(leBot,aiModeFlags); SetPulse(0.5); } Return; pulse: Print("Je pense donc je suis"); //Force Speed AiSetMoveSpeed(leBot,2.0); tempVector1=GetThingVel(leBot); tempVector2=VectorSet(VectorX(tempVector1),VectorY(tempVector1),0); if (VectorLen(tempVector2) < 3.0) { AddThingVel(leBot, VectorScale(tempVector2, 2.4)); } call move; Return; move: // envoie d'un message au navigation cog, et va récupérer des trucs dans un trigger AiSetLookPos(leBot, GetThingPos(0)); AiSetMoveThing(leBot,0); Return; end