Jump to content
Sign in to follow this  
nullsystems

Local bomb issue...

Recommended Posts

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

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

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

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

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

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 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

My friend, I don't think that you have to explain anything to me wink_o.gif

Share this post


Link to post
Share on other sites

You should contemplate changing your name to "misinformed and bullheaded" ugly.gif.

Now read his script again and pay attention to the first line wink_o.gif

Share this post


Link to post
Share on other sites

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

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

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

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 biggrin_o.gif:

What the heck is

(random 200) - (random 200)

supposed to do rofl.gifrofl.gif 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

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

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
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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×