ffak 0 Posted December 18, 2002 hello how can I script an inventory scanning? What I want: the script scan the unit inventory and if a weapon is not detected than the script disable "addaction"? (if M16s are not present in helo as cargo, the reammo mission objective will be failed for example) thanks Share this post Link to post Share on other sites
-CCCP-Stalker 0 Posted December 18, 2002 Try hasweapon command. Share this post Link to post Share on other sites
toadlife 3 Posted December 19, 2002 I dont think you can query a vehicles weapon cargo but you can query a units weapons and magazines magazines vehicle - returns an array of a units magazines (ammo) weapons vehicle - returns and array of units weapons (guns, bombs,binoculars, ect.) THis line should return the hint if a unit has an m16. ?"m16" in weapons _unit:hint "He has an m16. Yay for him!" Share this post Link to post Share on other sites
toadlife 3 Posted December 19, 2002 I was looking at the new commands for resistance and the weaponpool commands may just work. Lets say your chopper is named "helo1". If you do, "pickWeaponPool helo1", it should transfer all of the weapons in the cargo of the chopper into a weapons pool. From there you can query the content of the weaponpool like this: queryWeaponPool "m16" This line would return the number of m16's in the weapon pool. There are other weaponpool commands which you should check out. Share this post Link to post Share on other sites
ffak 0 Posted December 19, 2002 command "hasweapon" works fine with unit but i can't set it up for a group..any idea? Share this post Link to post Share on other sites
RED 0 Posted December 19, 2002 Use the foreach command, look it up in the command ref. RED Share this post Link to post Share on other sites
toadlife 3 Posted December 19, 2002 This will return a hint if any units in "_group" get an m16 #check ~0.1 {if (_x hasweapon {m16}) then {hasm16=true;hint format[{%1 has an m16!},name _x];exit}} foreach units _group goto "check" Share this post Link to post Share on other sites
FAR-Warrior 0 Posted December 19, 2002 Tiens FFAK, essaye ça, c'est ce que j'utilise pour la campagne dynamique FAR pour comptabiliser les armes, ca te sera utile... </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE"> ; Compte le nombre de magazines et d'armes pour un groupe "nom_du_groupe" donné. ; Lancer le script via message radio : [nom_du_groupe] exec "mag.sqs" _liste = _this select 0 _mags=[] _magazines=[] _lj = units _liste _nbJoueurs=count _lj _magCount = [] _j=0 #boucle1 _u=_lj select _j ?(alive _u):_magazines=_magazines + (magazines _u) _j=_j+1 ?(_j < _nbJoueurs):goto "boucle1" #loopmagazines _mag = _magazines select 0 _mags = _mags + [_mag] _comp = format ["_x == ""%1""", _mag] _count = _comp count _magazines _magCount = _magCount + [_count] _magazines = _magazines - [_mag] ?count _magazines > 0: goto "loopmagazines" _text2= "Munitions Restantes :\n\n"; _i = (count _mags) - 1 #loop3 _text2= _text2 + format ["%1 X %2\n", _magCount select _i, _mags select _i] _i = _i - 1 ?_i >= 0: goto "loop3" _weaps=[] _weapons=[] _lj = units _liste _nbJoueurs=count _lj _weapCount = [] _j=0 #boucle2 _u=_lj select _j ?(alive _u):_weapons=_weapons + (weapons _u) _j=_j+1 ?(_j < _nbJoueurs):goto "boucle2" #loopweapons _weap = _weapons select 0 _weaps = _weaps + [_weap] _comp = format ["_x == ""%1""", _weap] _count = _comp count _weapons _weapCount = _weapCount + [_count] _weapons = _weapons - [_weap] ?count _weapons > 0: goto "loopweapons" _text= "Armes Restantes :\n\n"; _i = (count _weaps) - 1 #loop2 _text= _text + format ["%1 X %2\n", _weapCount select _i, _weaps select _i] _i = _i - 1 ?_i >= 0: goto "loop2" mag=true hint format ["%1\n%2", _text2, _text] exit <span id='postcolor'> Share this post Link to post Share on other sites
ffak 0 Posted December 19, 2002 Thanx toadlife et merci Warrior Share this post Link to post Share on other sites
ffak 0 Posted December 20, 2002 I tried last night and I met some problems say mygrp (1 officer+1 soldier+1LAW) showmap false foreach in mygrp whay I want: the officer see the map (because he's carrying binocular) -> showmap true the other players stay showmap false the officer is KIA->the other players stay showmap false until one of them take binocular on officer' body. Then only this player is showmap true (the other stay false) thanks for help Share this post Link to post Share on other sites
Balschoiw 0 Posted December 21, 2002 </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">unit1 has binocular<span id='postcolor'> in condition </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Code Sample </td></tr><tr><td id="CODE">unit1 showmap true<span id='postcolor'> in On activation Got the idea ? EDIT: </span><table border="0" align="center" width="95%" cellpadding="3" cellspacing="1"><tr><td>Quote </td></tr><tr><td id="QUOTE">bump Merry xmas <span id='postcolor'> A topic that is still up does not need to be bumped Share this post Link to post Share on other sites
ffak 0 Posted January 2, 2003 It's not working I tried many things... How can I force only one player to showmap true? (not the all group in MP) helllp Share this post Link to post Share on other sites