nonplusultra Posted February 2, 2011 Share Posted February 2, 2011 Yo, I've tried to make my own artillery script. the script shall place every 3 seconds an artillery strike at the current actor in the trigger.the good thing is that it works - but only for one actor, if there is a second or more actors in the trigger the script does nothing. scn SkyScraperArtillerySCRIPT float timer float timer2 float timer3 float timer4 float timer5 short count short fire int random ref ractor ref rtarget ref self ref self2 ref self3 ref lself ref lself2 ref lself3 begin OnTriggerEnter set rActor to GetActionRef if rActor.GetPlayerTeammate == 1 return endif if rActor.GetInFaction PlayerFaction ; ;set fire to 0 ; ;set rTarget to 0 ; ;set Count to Count - 1 return elseif self == 0 set self to getactionref elseif self2 == 0 set self2 to getactionref elseif self3 == 0 set self3 to getactionref endif set fire to 1 set count to count +1 end begin OnTriggerLeave set rActor to GetActionRef if rActor.GetPlayerTeammate == 1 return endif if rActor.GetInFaction PlayerFaction return elseif (self == rActor) set self to 0 ;set lself to GetActionRef elseif (self2 == rActor) set self2 to 0 elseif (self3 == rActor) set self3 to 0 ;elseif lself2 == 0 ; set lself2 to GetActionRef ;elseif lself3 == 0 ; set lself3 to GetActionRef endif set Count to Count - 1 end begin GameMode if fire == 1 if ( timer < 3 ) set timer to ( timer + GetSecondsPassed ) else rtarget.placeatme FXNellisArtilleryStrike01 1 1 set timer to 0 set fire to 2 endif endif if fire == 2 if ( timer2 < 3 ) set timer2 to ( timer2 + GetSecondsPassed ) else rtarget.placeatme FXNellisArtilleryStrike01 1 1 set timer2 to 0 set fire to 3 endif endif if fire == 3 if ( timer3 < 3 ) set timer3 to ( timer3 + GetSecondsPassed ) else rtarget.placeatme FXNellisArtilleryStrike01 1 1 set timer3 to 0 set fire to 4 endif endif if fire == 4 if ( timer4 < 3 ) set timer4 to ( timer4 + GetSecondsPassed ) else rtarget.placeatme FXNellisArtilleryStrike01 1 1 set timer4 to 0 set fire to 5 endif endif if fire == 5 if ( timer5 < 3 ) set timer5 to ( timer5 + GetSecondsPassed ) else rtarget.placeatme FXNellisArtilleryStrike01 1 1 set timer5 to 0 set fire to 1 endif endif set Random to GetRandomPercent if Random >= 0 && self != 0 && self.GetDead == 0 set rTarget to self endif if Random >= 33 && self2 != 0 && self2.GetDead == 0 set rTarget to self2 endif if Random >= 67 && self3 != 0 && self3.GetDead == 0 set rTarget to self3 endif if rTarget == 0 || rTarget.GetDead set Count to Count - 1 set rTarget to 0 return endif if Count <= 0 set fire to 0 set Count to 0 set rTarget to 0 endif end hope anyone is able to help me ;> Link to comment Share on other sites More sharing options...
Aragron Posted February 4, 2011 Share Posted February 4, 2011 If this script only works for one actor,probably your problem is that all "Self" are being used by the same actor,you need a better check to filter equals Selfs .try putting this in the GameMode : if self == Self2 || Self == Self3set self to 0endifif Self2 == self3set self2 to 0endif Link to comment Share on other sites More sharing options...
davidlallen Posted February 4, 2011 Share Posted February 4, 2011 Using == to compare references is not recommended. I have not found a link which says exactly why, but many links say to use getisreference instead. References: bethsoft tutorial, cipscis tutorial. See the getisreference page for syntax. Link to comment Share on other sites More sharing options...
Recommended Posts