cpar75 Posted April 2, 2009 Share Posted April 2, 2009 What I am trying to do is to get a trigger to spawn a random event, but when I step on the trigger it keeps spawning everything from the script every couple of seconds or so like its looping. I am new at scripting but here is what I have. scn RangerStreetCombatSCRIPT short Random begin onTriggerEnter player set Random to GetRandomPercent if Random > 10 ; Raiders vs. Ranger patrol ; Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 ; Raider Patrol RRMark6.placeLeveledActorAtMe LvlRaiderGun 1 RRMark7.placeLeveledActorAtMe LvlRaiderGun 1 RRMark8.placeLeveledActorAtMe LvlRaiderGun 1 RRMark9.placeLeveledActorAtMe LvlRaiderGun 1 RRMark10.placeLeveledActorAtMe LvlRaiderGun 1 elseif Random > 20 ;Talon vs. Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark6.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark7.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark8.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark9.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark10.placeLeveledActorAtMe LvlTalonCompanyGun 1 elseif Random > 50 ;Mutants vs. Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark6.placeLeveledActorAtMe EncSuperMutantGun 1 RRMark7.placeLeveledActorAtMe EncSuperMutantGun 1 RRMark8.placeLeveledActorAtMe EncSuperMutantGun 1 RRMark9.placeLeveledActorAtMe EncSuperMutantGun 1 RRMark10.placeLeveledActorAtMe EncSuperMutantGun 1 endif end Link to comment Share on other sites More sharing options...
PuceMooose Posted April 2, 2009 Share Posted April 2, 2009 What I am trying to do is to get a trigger to spawn a random event, but when I step on the trigger it keeps spawning everything from the script every couple of seconds or so like its looping. I am new at scripting but here is what I have. Hi, See if this addition does what you want. DoOnce in this script should function to allow an event to only trigger one time. scn RangerStreetCombatSCRIPT short Random short DoOnce begin onTriggerEnter player set Random to GetRandomPercent if DoOnce == 0 if Random > 10 ; Raiders vs. Ranger patrol ; Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 ; Raider Patrol RRMark6.placeLeveledActorAtMe LvlRaiderGun 1 RRMark7.placeLeveledActorAtMe LvlRaiderGun 1 RRMark8.placeLeveledActorAtMe LvlRaiderGun 1 RRMark9.placeLeveledActorAtMe LvlRaiderGun 1 RRMark10.placeLeveledActorAtMe LvlRaiderGun 1 set DoOnce to 1 elseif Random > 20 ;Talon vs. Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark6.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark7.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark8.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark9.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark10.placeLeveledActorAtMe LvlTalonCompanyGun 1 set DoOnce to 1 elseif Random > 50 ;Mutants vs. Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark6.placeLeveledActorAtMe EncSuperMutantGun 1 RRMark7.placeLeveledActorAtMe EncSuperMutantGun 1 RRMark8.placeLeveledActorAtMe EncSuperMutantGun 1 RRMark9.placeLeveledActorAtMe EncSuperMutantGun 1 RRMark10.placeLeveledActorAtMe EncSuperMutantGun 1 set DoOnce to 1 endif endif end Link to comment Share on other sites More sharing options...
cpar75 Posted April 2, 2009 Author Share Posted April 2, 2009 Hey that helped. Thanks a bunch guy!! Link to comment Share on other sites More sharing options...
Crowbennett08 Posted April 5, 2009 Share Posted April 5, 2009 Say, how exactly are you using this "random" script variable? example; if getrandompercent > 10 ? or whatever the activator for this scripted event is... how are you activating via the random script variable? not familiar with this one. Link to comment Share on other sites More sharing options...
cpar75 Posted April 5, 2009 Author Share Posted April 5, 2009 The script I had wasn't working the way i wanted it to so I changed it and added the script to an activator. Here is the script. scn RangerStreetCombatSCRIPT short Random short DoOnce begin onTriggerEnter player set Random to GetRandomPercent * 4/100 + 1 if DoOnce == 0 if Random == 1 ; Raiders vs. Ranger patrol ; Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 ; Raider Patrol RRMark6.placeLeveledActorAtMe LvlRaiderGun 1 RRMark7.placeLeveledActorAtMe LvlRaiderGun 1 RRMark8.placeLeveledActorAtMe LvlRaiderGun 1 RRMark9.placeLeveledActorAtMe LvlRaiderGun 1 RRMark10.placeLeveledActorAtMe LvlRaiderGun 1 set DoOnce to 1 elseif Random == 2 ;Talon vs. Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark6.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark7.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark8.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark9.placeLeveledActorAtMe LvlTalonCompanyGun 1 RRMark10.placeLeveledActorAtMe LvlTalonCompanyGun 1 set DoOnce to 1 elseif Random == 3 ;Mutants vs. Ranger patrol RRMark1.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark2.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark3.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark4.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark5.placeLeveledActorAtMe LvlReilyRangersGun 1 RRMark6.placeLeveledActorAtMe LvlSupermutantGun 1 RRMark7.placeLeveledActorAtMe LvlSupermutantGun 1 RRMark8.placeLeveledActorAtMe LvlSupermutantGun 1 RRMark9.placeLeveledActorAtMe LvlSupermutantGun 1 RRMark10.placeLeveledActorAtMe LvlSupermutantGun 1 set DoOnce to 1 endif endif end Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.