OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: prodetar2 on 10 Jul 2008, 20:58:10

Title: Objective complete when weapon in hand
Post by: prodetar2 on 10 Jul 2008, 20:58:10
Hi, this is the idea:

you pick up a weapon and then you should have "objective complete" how do i make arma see that i have the weapon so i can complete the objective?
Title: Re: Objective complete when weapon in hand
Post by: ModestNovice on 10 Jul 2008, 21:21:25
Well nvr mind all that fancy stuff.

Put a trigger.
Condition:
Code: [Select]
count weapons player != 0On Activation:
Code: [Select]
"1" objStates "DONE"; hint "Objective 1 Complete."

Title: Re: Objective complete when weapon in hand
Post by: Wolfrug on 11 Jul 2008, 09:06:46
It depends on if you're talking about a primaryWeapon (i.e. a rifle, machine gun etc) or a pistol, and if it's to be that particular (type) of weapon or any weapon at all. The easiest method for finding out if the unit has a gun in hand (not a pistol) is to use:

condition: primaryWeapon Player !=""

Basically the primaryWeapon command always returns an empty string ("") while the unit is unarmed, so once it returns something else = unit is armed.

If you have a specific weapon in mind (pistol, rifle, launcher..) then the easiest might be to do something like:

condition: "M16A4" in (weapons Player)

You'll find the weapon classnames over in our comref : <link> (http://www.ofpec.com/COMREF/armaweapons.php). This one basically works using the "in array" command, which checks the string "M16A4" (or whatever your weapon name is) against the array created by the command "weapons unit" (in this case the weapons of the player).

DaChev's method also works, but then the player can't be carrying any other "weapons", i.e. binoculars or night vision goggles. :)

 :good: Good luck.

Wolfrug out.
Title: Re: Objective complete when weapon in hand
Post by: Mr.Peanut on 11 Jul 2008, 14:50:49
http://www.ofpec.com/ed_depot/index.php?action=details&id=435&page=0&cat=xyz (http://www.ofpec.com/ed_depot/index.php?action=details&id=435&page=0&cat=xyz)
Title: Re: Objective complete when weapon in hand
Post by: prodetar2 on 11 Jul 2008, 18:07:22
hey all, thnx for your replies :)

ill check it out soon. 3 different ways, one must work right?

and yes it's a primary weapon
called "Shotgun" if im not mistaken...

EDIT: Tested it, works great :) thnx

new question:
Does the Camera script tutorial from ofp work the same for arma? i dont see any special one for arma, correct me if im wrong :)
Title: Re: Objective complete when weapon in hand
Post by: ModestNovice on 11 Jul 2008, 20:17:22
http://www.armaholic.com/page.php?id=3172      ;)
Title: Re: Objective complete when weapon in hand
Post by: prodetar2 on 11 Jul 2008, 20:22:34
thnx! :)

i kinda was trying out the OFP scripts and they were actually working so ill continue with that untill i get stuck, thnx again :D