Home   Help Search Login Register  

Author Topic: Units nearby joins player in a single click[Modified,and need HELP!]  (Read 1400 times)

0 Members and 1 Guest are viewing this topic.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
PLEASE reply if you see any errors in the syntax!
Also if pssible, convert it to .sqf [which i cannot]

Here is my method :
In this method, when you click "Join Me" on Action Menu, any Blufor units in the specified area around you will join you...

First Create Scripts :
Code: [Select]
checkingscript.sqs
changevariable.sqs
Create a trigger in the editor, name it "checker" [without ""]

Code: [Select]
Name : checker
Axis A and B : YOUR DESIRED AREA
Activation : BLUFOR , PRESENT
Condition : this
On Act : [nameofyourplayer] exec "checkingscript.sqs"
Note : You have to change "Blufor" in relation to your side.Use player in the [] if its an SP Mission...
=================================
checkingscript.sqs
_yourunits= count units group player
Code: [Select]
? _leaderman != player : exit
;exits if _leaderman is not the current player on the machine...

_leaderman=_this select 0;

#loop
? not (alive player) : exit

@startchecking
? {count untis group _x==0} : goto "morecheck"
? {count units group _x <= 2} : {[_x] join _leaderman} foreach checker
;any Blufor in the area will join player...
;you may need to add "foreach checker" behind "_x <= 2}"

~0.5
#morecheck
? count units group player == _yourunits : hint "No one joined your group.";goto "loop"

hint format ["No of units in your team : %1",count units group player]
~0.5
startchecking = false
goto "loop"
===============================

In your unit's[player's]  init :

Code: [Select]
yourplayername addaction ["Join Me","changevariable.sqs"]=====================================
changevariable.sqs

Code: [Select]
checker setpos getpos player
;moves trigger to player's position
~0.5
startchecking=true
;makes the script start the checking
exit

Feel free to report bugs...the script is not tested on my PC yet,just written for guy in BI Forums
http://forums.bistudio.com/showthread.php?p=1424848#post1424848
« Last Edit: 01 Sep 2009, 16:21:41 by haroon1992 »
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(