OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: StonedSoldier on 06 Mar 2005, 12:42:45
-
on a MP map ive got a custom action trigerred by somedude in the script that is run,
_somedude = _this select 0
otherguy setpos getpos _somedude
removeallweapons otherguy
otherguy addweapon "M16"
_somedude sidechat "Heres an M16"
anyway with AI it moves them and gives them an M16, but in MP it moves the other human player but doesnt give him the gun,
-
ok maybe not im still having problems, ok the script i have looks something like this
_num = _this select 0
guns = ["M16","M21","M60"]
_weapon = guns select _num
_otherguy setpos getpos _somedude
removeallweapons _otherguy
_otherguy addweapon _weapon
he moves perfectly fine but he isnt given the gun i want, how can i make it so he gives him the gun
-
Hi SS
I'm not sure if I have this right but it looks like you're getting _num from the script parameter (_this select 0), then using _num to determine which gun to get. That's fine so long as your script parameter is 0, 1 or 2, eg -
[0] exec "giveGun.sqs"
This should pass the number "0" to _num, which will result in the script selecting item 0 from the list of guns (ie - "M16").
It may be that this is not what you intended. You may instead wish to define which gun is selected from within the script (by simple assigment, eg _num = 0) or by reference to some public variable. In that case try wording your script like this -
guns = ["M16","M21","M60"]
_num = 0
_weapon = guns select _num
_otherguy setpos getpos _somedude
removeallweapons _otherguy
_otherguy addweapon _weapon
Of course if you wanted to have some external script determine which gun to take you would set the second line to read -
_num = gunSelection
where gunSelection is defined by some other script or Init entry (eg gunSelection = 0).
Hope that this helps.
roni