OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Wildcat22 on 28 Apr 2004, 21:43:02

Title: "1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 28 Apr 2004, 21:43:02
Hello,

I'd like to make an objective done when a player (named "T1") has the pipe bomb. I know how it works and I looked it up in the official com.ref .

But the function "hasWeapon" doesn"t work. Can someone help me ? Thanks a lot in advance  :)
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: j-man on 28 Apr 2004, 21:47:03
Could you explain a little bit more? Mabey, if your using a script or trigger, etc...
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 28 Apr 2004, 21:57:28
Well I use triggers, 2 of them. One activates the obj status to "done" when "armes" (condition from the first trigger) = true.

The init for "armes" is "T1 hasWeapon "Pipebomb" " but that last doesn't work (it tells me I need bool or something you know the thing).

So I'd like to have the first objective completed when the player has a pipebomb that he has to get from an ammo crate.  :)
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 28 Apr 2004, 22:28:08
Up  ;D

If I'm not clear enough tell me  ;)
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 28 Apr 2004, 22:40:52
Nevermind I think I solved it  :-[ ;D


Doh...
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 28 Apr 2004, 23:07:21
I managed to do it with any weapon, but there is a problem with the "pipebomb"...
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: General Barron on 29 Apr 2004, 08:01:17
I think the problem is that "pipebomb" isn't a weapon; it is technically a "magazine" for the weapon "put" (an invisible weapon that everybody has). So instead of using 'hasweapon', you may be able to use the "ammo" command:

unit ammo "magazine"

This returns a number; the number of shots in the persons current magazie. So in your case, try putting this in the trigger's condition field:

T1 ammo "pipebomb" > 0

Maybe even try putting "put" instead of "pipebomb". Hope it works :(
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 29 Apr 2004, 10:42:31
Thank you I'll check it out  ;)
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 29 Apr 2004, 10:51:53
Thank you, it worked with "put"  :)
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 29 Apr 2004, 11:18:15
The same thing worked for any weapon but now (and I don't know why) it doesn't work anymore. Could you help me ?

Is it right ?

Cond.            Ap HasWeapon "Ak47"
On Act.          test = true

("test" worked for the pipebomb thing you told me).
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Sui on 29 Apr 2004, 11:31:52
Indeed... a pipebomb is considered to be a magazine.

If you ever want to get a list (well... an array actually) of the magazines in a unit's inventory, try:

magazines unit

To test to see if there is a pipebomb in there, try:

"Pipebomb" in (magazines unit)

That should do the trick ;)
Title: Re:"1" Objstatus "done" ; T1 hasWeapon "Pipebomb"
Post by: Wildcat22 on 29 Apr 2004, 12:29:59
Thank you  :)