Home   Help Search Login Register  

Author Topic: Locality Problems  (Read 1150 times)

0 Members and 1 Guest are viewing this topic.

StonedSoldier

  • Guest
Locality Problems
« 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,

Code: [Select]
_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,

StonedSoldier

  • Guest
Re:Locality Problems
« Reply #1 on: 06 Mar 2005, 16:46:13 »
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
« Last Edit: 07 Mar 2005, 00:41:51 by StonedSoldier »

Offline Roni

  • Members
  • *
  • Play the Game !
Re:Locality Problems
« Reply #2 on: 09 Mar 2005, 05:40:26 »
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