nullsystems 0 Posted July 25, 2007 Can someone explain why this script is executed a by each player who touches the trigger? Trigger: ONCE Cond: blufor present onAction: [] exec "script.sqs" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if (!isServer) exitWith {} _veh1 = _this select 0 #restart ?(stoparty2 == 1) : exit; ~1.2 _i = 0 _randamount1 = random 10 + 4 _num1 = _randamount1 _randtimer1 = random 3 + 0.5 ~1 #mines bombs1 = "Sh_122_HE" Createvehicle [(getPos _veh1 select 0) Â + ((random 200) - (random 200)),(getPos _veh1 select 1) Â + ((random 70) - (random 70)),(getPos _veh1 select 2)-1] _i = _i + 1 ~_randtimer1 ? _i < _num1 : goto "mines" ~50 goto "restart" It kinda goes haywire and does it 3 or 4 times, so you have ALOT of bombs. Share this post Link to post Share on other sites
ManDay 0 Posted July 25, 2007 First of all, I dont know what you mean by "executed by each player". It's either "executed on each client" or "triggered by each player" - nothing else. second, you may take the isServer-stuff out of your script and write isServer && this into your condition line instead - which isnt nessesarily more ressource saving (its actually a bit more elaborate) but a lot more obvious. and now please redefine your question :> And by the way: what is "_this select 0" supposed to be if "this" is presumedly []? Share this post Link to post Share on other sites
nullsystems 0 Posted July 25, 2007 Sorry, I didnt really know the correct way of stating the problem, its hard to describe. For example: I have 4 people in a boat, they enter a trigger area which is activated by 'blufor present' - once. Sometimes, they activated it 1-4 times, I presume this is to do with the internal looping speed of the triggers not cancelling out the other blufor after the first one activates the trigger. this && isServer should fix it? Share this post Link to post Share on other sites
ManDay 0 Posted July 25, 2007 From all the beginning: 1.) _veh1 = _this select 0 while _this ==[ ]? 2.) _randamount1 = ...; _num1 = _randamount1;... Redundant? 3.) You get a random amount of bombs spawning - so how can you tell whether the script is really running the runs you want without a hint? 4.) Why do you call it "mines" while you spawn bombs? Share this post Link to post Share on other sites
UNN 0 Posted July 25, 2007 Mixing old and new commands with the old syntax might be causing you problems? Try it this way: Script.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Veh1=_This Select 0; If IsServer Then     {     WaitUntil         {         Sleep 2.2;         _randtimer1 = random 3 + 0.5;         For "_i" from 0 to (random 10 + 4) Do             {             bombs1 = "Sh_122_HE" Createvehicle [(getPos _veh1 select 0)  + ((random 200) - (random 200)),(getPos _veh1 select 1)  + ((random 70) - (random 70)),(getPos _veh1 select 2)-1]                         Sleep _randtimer1;             };         (stoparty2 == 1)         };     }; Launched with: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[MYVEHICLE] ExecVM "Script.sqs" Share this post Link to post Share on other sites
misinformed 0 Posted July 25, 2007 Its because the trigger is global, executed on all clients (ie one incarnation of the trigger on each client machine/host. If the local player is present in the trigger area its set off (the servers trigger is also being set off when the first blufor is present, not for subsequent blufors untill theyre not present), so that one trigger your seeing in the editor is actually getting set off on multiple clients) and the command to create the bomb (createvehicle) itself is global (has global effect/is transmitted across a network, whatever). Hence you want to get that script running once, the server would be a good bet. So this at the start of the script would do the trick: ?!local server: exit Manday: "mines" is just the loop. Share this post Link to post Share on other sites
ManDay 0 Posted July 25, 2007 You live up to your name perfectly. Share this post Link to post Share on other sites
misinformed 0 Posted July 25, 2007 Manday you can say whatever you want but this is the way it works. And it is presently working on my maps. And check the wiki for the locality of the createvehicle cmd if you dont believe me. Share this post Link to post Share on other sites
ManDay 0 Posted July 25, 2007 My friend, I don't think that you have to explain anything to me Share this post Link to post Share on other sites
misinformed 0 Posted July 25, 2007 Oh cut the sarcasm and check it. Share this post Link to post Share on other sites
ManDay 0 Posted July 25, 2007 You should contemplate changing your name to "misinformed and bullheaded" . Now read his script again and pay attention to the first line Share this post Link to post Share on other sites
nullsystems 0 Posted July 25, 2007 lmao Manday, I name everything magically from a hat with kittens. Its just an extract from my previous script, im not anal about what everythings called. Also, the timer for the pause between arty fire would give you a clue...especially if the arty NEVEr stops firing, you know its executed more than once. Share this post Link to post Share on other sites
misinformed 0 Posted July 25, 2007 Heh, bit immature arent we? Throwing insults around. And/or Exitwith was prob causing the problem. Share this post Link to post Share on other sites
ManDay 0 Posted July 25, 2007 Well, I'm kinda bored now so why not trying it out... But why - meanwhile - you don't just try to put your #mines-loop-if-condition into parenthesis? cya €: misinformed, I was intending to insult you. Just show a bit of humour mate! Share this post Link to post Share on other sites
ManDay 0 Posted July 25, 2007 So, Null, assuming you got the right calling seq. and "_this select 0" makes sense. Make num1 a constant value = 1. Then tell me it it works. At least I dont have any problems with the script. BTW, Null. Your script is so extremly strange it makes me fall off my chair : What the heck is (random 200) - (random 200) supposed to do and why _num1 = _randamount1 ?? Probably UNN is right too and the if( ){} doesnt work with exec. Now, as your script is overall flawed and completly faulty, here is the correct version: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">?( !isServer ): exit; _target = _this select 0 #jp_start ?(stoparty2 == 1) : exit; _bombAmount = 4 + random 10; _randDelay = 0.5 + random 3; ~2.2 _i = 0 #jp_dropBomb bomb = "Sh_122_HE" createVehicle[ ( getPos _target select 0 )+ random 200,( getPos _target select 1 )+ random 70,0 ]; _i = _i + 1 ~_randDelay ?( _i < _bombAmount ): goto "jp_dropBomb"; ~50 goto "jp_start" Share this post Link to post Share on other sites
misinformed 0 Posted July 25, 2007 Thats one random number between 0 - 200 and the same again minus the other. I assume its to more allow more random location in the veh placement so it can either be + or -. Share this post Link to post Share on other sites
ManDay 0 Posted July 25, 2007 No. That's nonsense :P €: Hey admins, will you dare to change the style of hyperlinks so you can distinguish them from underlined text? Share this post Link to post Share on other sites
hoz 0 Posted July 25, 2007 Quote[/b] ]You should contemplate changing your name to "misinformed and bullheaded" .Now read his script again and pay attention to the first line Manday learn to be a little more respectful. PR = 48hrs & WL +1 Share this post Link to post Share on other sites