Jump to content
Sign in to follow this  
Agua

Any idea how to activate a command based on

Recommended Posts

unpredictable? Here's the situation.

I've got units that I want to join me when I get within, say, 50 meters of each individual unit. However, due to the fact the units that I want to join the player's group paradrop, those units' positions are different with each replay of the mission. Therefore, I can't use a regular trigger with a join command. I need something that is the equivalent of a proximity based trigger which moves wherever those units that I want to have join the player's group are located rather than a trigger which is in a set location.

Anyone know how I to pull this off?

Share this post


Link to post
Share on other sites

For SP try:

Name your guy "Person1" for example

Trigger 1

Anybody

Present

OnActivation: [this] exec "join.sqs"

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

#start

Dude1 = _this select 0

Dude2 = Person1

?(Dude1 = Dude2):exit

~.01

#join

[dude1] join Dude2

~.01

#exit

Dude1 == objNull

exit

If that doesn't work I think it should be something along those lines. Tell me what errors you get if your use this script. It's right off the top of my head so it's gonna need tweaking.

Share this post


Link to post
Share on other sites

There are quite a few errors in that script Harnu, try using this one:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_unit = _this select 0

#loop

~1

?(_unit distance player) > 50: goto "loop"

[_unit] join player

Activate the script with the following:

[unitname] exec "scriptname.sqs"

RED

Share this post


Link to post
Share on other sites
Quote[/b] ]There are quite a few errors in that script Harnu, try using this one:

Just a few? tounge_o.gif

Fine give him the answer. No one else likes fiddling till it works wink_o.gif

Share this post


Link to post
Share on other sites

I wonder which one works. Anyhow that'd be great for those cases when theres a moving hostage. It'd be neat if the hostage just kept moving all over the map. in the back of trucks n stuff.

Share this post


Link to post
Share on other sites

Thanks for the responses guys.

RED, that one works close enough to what I want that I can fiddle around and make something work from there. biggrin_o.gif

Actually, it does exactly what I want, I just need to delay the execution until the player is on the ground. I think I can fiddle around with something to take care of that portion.

BronzeEagle - it would work as is for what you suggest. Pretty neat script, huh?

Thanks again RED.

Share this post


Link to post
Share on other sites

There's another way, just one script, works also for constantly moving units

execute this script just 1 time, put-> this exec "script.sqs" in the init of one unit

example script.sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_distance=50 \\set join distance

_Unitarray=[unitjoin1,unitjoin2,unitjoin3] \\names of units that will join the player

#start

? (count group player == 12):goto "fullGrp" \\if you already have 11 soldiers in group

_cu=0

? (count _Unitarray == 0):exit \\end script when all units joined player

#loop

_unit=_Unitarray select _cu

? !(alive _unit):_Unitarray=_Unitarray-[_unit];goto "notjoin" \\dead unit will not join

? ((_unit distance player)>_distance):goto "notjoin"

[_unit] join player

_Unitarray=_Unitarray-[_unit]

#notjoin

_cu=_cu+1

? (_cu<count _Unitarray):goto "loop"

goto "start"

#fullGrp

player sidechat "You already have 11 soldiers in group"

@ (count group player < 12)

goto "start"

this should work smile_o.gif

Share this post


Link to post
Share on other sites

Damned Drinker! That's nice too man. Gives some good feedback. Thanks.

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  

×