the_unknown_one 0 Posted May 11, 2003 ok... i am making a mission, and i decided to make a script that would make it so that if i had no weapon i would ot be shot at. I have not tested it yet, but i am not sure wether to use it in the init.sqs or a seperate one, and even then how to use it. this is the script: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">[man1,man2,man3] setcaptive false #loop1 ?(man1 hasWeapon Objnull):man1 setcaptive true ?(man2 hasWeapon Objnull):man2 setcaptive true ?(man3 hasWeapon Objnull):man3 setcaptive true [man1,man2,man3] setcaptive false goto loop1 end<span id='postcolor'> If you could help that would be great, and it's my first script. Do i use Objnull, or do i have to list every weaon in the mission possible? How would i use variables? tia, the_unknown_one Share this post Link to post Share on other sites
the_unknown_one 0 Posted May 11, 2003 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ;this script is designed to make a man (aka _man1) and two of his men (_man2 and _man3), so ;they are not shot at when they have no weapon. _man1= _this select 0 _man2= _this select 1 _man3= _this select 2 [_man1,_man2,_man3] setcaptive false #loop1 ?(_man1 hasWeapon Objnull):_man1 setcaptive true ?(_man2 hasWeapon Objnull):_man2 setcaptive true ?(_man3 hasWeapon Objnull):_man3 setcaptive true [man1,man2,man3] setcaptive false goto loop1 end <span id='postcolor'> ok.. i think ive sorted out the variables, but can anyone help me and tell me how i would initate it? thx, the_unknown_one Share this post Link to post Share on other sites
Artak 0 Posted May 11, 2003 You mean how to execute the script? By the looks of it I'd say you put [name1, name2, name3] exec "scriptname.sqs" in a triggers / waypoint's 'on activation field'. Where name1, name2 and name3 are the names of the captive units and scriptname is the name of your script. May I also suggest you put a short delay in the part of the script which you're looping, otherwise it will create lag, if not even end up in crashing the game. Add a delay by adding this line ~X where X is the amount of time to wait in seconds. Share this post Link to post Share on other sites
the_unknown_one 0 Posted May 11, 2003 so... where do i put the gap? between the bits starting with the question marks, or before the loop or what? tia, the_unknown_one Share this post Link to post Share on other sites
the_unknown_one 0 Posted May 11, 2003 urm, help... its working except the Objnull part... its wanting a string (i.e. a weapon name) instead of an object (objnull). how do I make it so that with any weapon it works? I dont want to have to list every single weapon in the mision. tia again, the_unknown_one Share this post Link to post Share on other sites
uiox 0 Posted May 11, 2003 Instead of objnull Test like this #Loop ~0.01 ? (count (weapon _man1) == 0) : _man1 setcaptive true If (alive player ) then {goto "loop"} exit (not end, not usefull at the end of script cause the script goes out when it reaches the last line, exit is used for forcing the end in a condition for example) and [_man1,_man2] setcaptive false can't work setcaptive works with objects, when you put [] it's an array. Welcome new scripter Share this post Link to post Share on other sites