OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bardosy on 19 Sep 2005, 07:23:02

Title: unit hasWeapon "radio"
Post by: bardosy on 19 Sep 2005, 07:23:02
I want a trigger witch start when player take an R109 radio (RHS addon) (class name: LSR_R109).

I try this:
contition: player hasWeapon "LSR_R109"

But daes happen nothing. If I changed the radio to a real weapon (eg: RHS_AK47) it's working.

How can I detect, the player take a radio?
Title: Re:unit hasWeapon "radio"
Post by: Tyger on 19 Sep 2005, 12:51:18
try adding parenthases:

Code: [Select]
(player hasWeapon "LSR_R109")

Title: Re:unit hasWeapon "radio"
Post by: Triggerhappy on 20 Sep 2005, 04:27:05
or perhaps you have the classname wrong?
Title: Re:unit hasWeapon "radio"
Post by: bardosy on 20 Sep 2005, 10:04:57
Tyger: parenthases???? Why? What's the differente? But I'll try...

Triggerhappy: if the class name was not coorect, there may be en error message. But I'm sure, the classname is LSR_R109...

Title: Re:unit hasWeapon "radio"
Post by: Tyger on 20 Sep 2005, 13:39:20
Sometimes it just needs parenthases to work.

Try using addWeapon "LSR_R109" to see if that is the correct class name.
If it is and parens don't work either, then your version of OFP is *(#$ed up  ;D
Title: Re:unit hasWeapon "radio"
Post by: Triggerhappy on 20 Sep 2005, 22:32:11
if you want to be sure of the classname, make a radio trigger:
on activation: hint format ["%1",(weapons player)]

then drop everything but the radio and radio away
Title: Re:unit hasWeapon "radio"
Post by: Wadmann on 20 Sep 2005, 23:28:49
Well I am 0 for 1 today but at some point I have got to get something right.

Could it be that a radio is a secondary weapon so you will need to do something like:

Code: [Select]
(player secondaryWeapon)  == "LSR_R109"
Syntax may be wrong but the concept is sound.

Wadmann
Title: Re:unit hasWeapon "radio"
Post by: Kyle Sarnik on 20 Sep 2005, 23:52:15
Well I am 0 for 1 today but at some point I have got to get something right.

Could it be that a radio is a secondary weapon so you will need to do something like:

Code: [Select]
(player secondaryWeapon)  == "LSR_R109"
Syntax may be wrong but the concept is sound.

Wadmann

That will work, but the point is hasweapon SHOULD work for ANY weapon (I know it works for secondary weapons, I have tried it). And those aren't the only ways either, you can use the weapon command, and there are probably even a few other methods. I mean detecting if a unit has a specific weapon is one of the easiest things to do, I can't believe its not working, unless you have the wrong classname.
Title: Re:unit hasWeapon "radio"
Post by: Tyger on 21 Sep 2005, 00:03:48
So in the end, are you 110% sure it's the right classname?

(Not meaning to offend you with that ;) )
Title: Re:unit hasWeapon "radio"
Post by: bardosy on 21 Sep 2005, 07:44:18
Master Tyger! You are the hero of the day!!!!
With parenthases it's working! Thanks a lot!

What a madness... with real weapon (like AK) working without parenthases, but
radio works only with parenthases. But finally working.

Thanks a lot again!
Title: Re:unit hasWeapon "radio"
Post by: macguba on 21 Sep 2005, 10:34:11
That's OFP for you.  :gunman: