Home   Help Search Login Register  

Author Topic: Pick up weapon = activate trigger?!?!  (Read 2303 times)

0 Members and 1 Guest are viewing this topic.

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Pick up weapon = activate trigger?!?!
« on: 16 Jun 2003, 18:15:35 »
I would like to know how to activate a trigger when any unit picks up a weapon created by the "createweaponvehicle" command. I have read about the "hasweapon" command but it asks for the weapon name (ie "M16") but I would like to trigger it if a specific weapon named (and displayed) by "createweaponvehicle" is picked up for a booby trap effect. I have searched but perhaps I am not phrasing my question correctly any I get few or no results from my prompts. Thanks in advance for any replies!                  Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

deaddog

  • Guest
Re:Pick up weapon = activate trigger?!?!
« Reply #1 on: 16 Jun 2003, 18:28:56 »
I think you mean "createvehicle", not "createweaponvehicle".

You could probably use a trigger or a script to monitor the position of the weapon in question.  When the position changes, then camcreate a grenade at that point.  That would represent a booby trapped weapon.

Ace

  • Guest
Re:Pick up weapon = activate trigger?!?!
« Reply #2 on: 16 Jun 2003, 18:34:41 »
Use this script and in it you can name the 2 weapons you created.

so in your script you can now write player hasweapon "_Pistol1"

Offline DrStrangelove

  • Members
  • *
  • Mr.Creative
Re:Pick up weapon = activate trigger?!?!
« Reply #3 on: 16 Jun 2003, 18:38:30 »
Ace, your sig make my eyes hurt ...  :P

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Pick up weapon = activate trigger?!?!
« Reply #4 on: 16 Jun 2003, 18:51:34 »
Thanks for the quick replies! Please let me make a couple of points clear:

1) I usually post from work (Hope my boss isn't looking) so most information is from memory (deaddog-you are correct about "createvehicle").

2) I cannot script! I understand enough and even modify them a little but I cannot create a script from scratch.

3) I was looking for something that I could put in the condition field of the trigger (something like "foreach this list hasweapon rpd1") in order to activate my boobytrap script.

I hope this clarifies what I am looking for. Thanks again!

                                               Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

FleX

  • Guest
Re:Pick up weapon = activate trigger?!?!
« Reply #5 on: 16 Jun 2003, 19:29:39 »
Type this in you're condision field

unit hasweapon "m16" (for example)
Then the trigger starts.
But this does not work with endings

I hope this is what you mean

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Pick up weapon = activate trigger?!?!
« Reply #6 on: 17 Jun 2003, 01:40:18 »
I am using the script that Ace linked to and have a weapon named "rpd1". If I understand correctly, I can use "rpd1" as a weapon name for the "hasweapon" command. I thought that "hasweapon" command was asking for "sebak47" for a Nam Pak weapon (or as in the script example "tokarev") .

Assuming I can use "rpd1" to specify that exact weapon, what would I type in the condition field of a trigger that would activate if any unit picks up the weapon named "rpd1". I am guessing something like
(_this inlist) hasweapon "rpd1"
 
Am I even close to getting my desired results?

@FleX- I think you mean that you cannot use this to end a mission. If true then no worries, this is just for a little fun in the middle of a mission.

                                              Wadmann
« Last Edit: 17 Jun 2003, 01:44:41 by Wadmann »
Check out my Camouflage Collection! New items added 31 July 2005.

Ace

  • Guest
Re:Pick up weapon = activate trigger?!?!
« Reply #7 on: 17 Jun 2003, 11:02:30 »
Yes that should work. I would test but I am on a computer without OFP

And Flex, u can end missions with that condition.

Ace

  • Guest
Re:Pick up weapon = activate trigger?!?!
« Reply #8 on: 17 Jun 2003, 11:07:22 »
Ace, your sig make my eyes hurt ...  :P

Huh? Why?

Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Pick up weapon = activate trigger?!?!
« Reply #9 on: 17 Jun 2003, 18:39:22 »
Thanks Ace! I did not get a chance to try that line of code last night but I will try to make some time tonight and confirm if it works so that we can close this thread. Do I need to create a trigger that covers the entire map that would create a list of all players or will (_this inlist) create it's own list?

                                       Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

Offline Tomb

  • Contributing Member
  • **
  • in2 Metal? Go 2 my sig
Re:Pick up weapon = activate trigger?!?!
« Reply #10 on: 17 Jun 2003, 18:46:45 »
Huh? Why?


the avatar, not the sig ::)

Ace

  • Guest
Re:Pick up weapon = activate trigger?!?!
« Reply #11 on: 17 Jun 2003, 23:01:38 »
Quote
Ace, your sig (avatar) make my eyes hurt ...  


hehehe, mission accomplished. Next avatar - one of those swirly red and black circles used for hypnosis


Offline Wadmann

  • OFPEC Patron
  • ****
  • I'm the next evolutionary step after a llama!
Re:Pick up weapon = activate trigger?!?!
« Reply #12 on: 18 Jun 2003, 04:05:36 »
After typing in (_this inlist) hasweapon "rpd1" in the condition field of a trigger, I received this error message:

Error:Local variable in global space

I then replaced the () with {} and received this error message:

Error:hasweapon type string expected object

I have tried several variations including "_rpd1" , _rpd1 (that gave "local variable in global space") with different bracket combinations and still no success.
If none of the gifted scripters out there can help me with this angle, then I may have to ask deaddog to elaborate on the method of determine a change in movement to activate my trigger.
Thanks in advance for any and all replies!

                                                         Wadmann
Check out my Camouflage Collection! New items added 31 July 2005.

Ace

  • Guest
Re:Pick up weapon = activate trigger?!?!
« Reply #13 on: 18 Jun 2003, 09:40:40 »
DOes it have to be anyone within a trigger?

Or can it just be the player picking up the weapon

Player hasweapon "rpd1"

deaddog

  • Guest
Re:Pick up weapon = activate trigger?!?!
« Reply #14 on: 18 Jun 2003, 15:22:15 »
Here is what I found after some experimenting.

Store the position of the weapon after it is created:

rpd1="weaponholder" createvehicle blahblahposition
rpd1 addmagazinecargo ["m16",4] (or whatever)
rpd1 addweaponcargo ["m16",1]
rpd1_pos=getpos rpd1

All of that can be created in a trigger or script.

Now, in another trigger, put this in the condition field:
(getpos rpd1 select 0) != (rpd1_pos select 0) && (getpos rpd1 select 1) != (rpd1_pos select 1)

Basically, if the weapon moves (gets picked up) then the trigger will activate.   It doesn't matter who picks it up.  The size of the trigger doesn't matter nor does the position of the trigger.  This worked for me.

 :)