Home   Help Search Login Register  

Author Topic: Player hasweapon...enemy fires  (Read 406 times)

0 Members and 1 Guest are viewing this topic.

Milwot

  • Guest
Player hasweapon...enemy fires
« on: 25 Apr 2004, 17:18:58 »
I'm making a mission where there's a civilian (set as a west unit using deletevehicle) and I want the resistance soldiers to open fire on him when he has a weapon (any weapon), using perhaps "setcaptive true/false"

Any ideas?

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:Player hasweapon...enemy fires
« Reply #1 on: 25 Apr 2004, 17:34:10 »
Can't you just set Resistance friendly to east, or nobody?


Planck
I know a little about a lot, and a lot about a little.

PsyWarrior

  • Guest
Re:Player hasweapon...enemy fires
« Reply #2 on: 25 Apr 2004, 18:47:48 »
Greetings,

Planck, if you did that, the resistance would always fire at him, whether he had a weapon or not!

Milwot, you may want to try the canFire command in conjunction with setCaptive. I haven't actuaaly tried it myself, but in theory you could use it to check if your civilian is able to fire (i.e. has weapon and ammo), and then set setCaptive to false.
Sorry, that's completely wrong. According to the COMREF, it only checks for damage, not ammo (and so should always return true for a living soldier).

Instead, you could use the hasWeapon command to see if he has a specific weapon. Unfortunately, AFAIK, you cannot use the command to check if the unit has any weapon, just for a specific one. However, if there is only one weapon that the civilian can pick up, (say AK74), you could check for that weapon:
? civ1 hasWeapon "AK74": civ1 setCaptive false.

Here's the COMREF entry:
Quote
unit hasWeapon weaponName
Operand types:
    unit: Object
    weaponName: String
Type of returned value:
    Boolean
Description:
    Check if unit has given weapon.

Example:
    player hasWeapon "M16"

-Supreme Commander PsyWarrior
-Psychic Productions Studios