Home   Help Search Login Register  

Author Topic: Activate script when item picked up  (Read 1382 times)

0 Members and 1 Guest are viewing this topic.

Offline smileynick

  • Members
  • *
  • i am smiley nick
Activate script when item picked up
« on: 20 May 2008, 21:05:59 »
Dear scripters


I'm having a little problem with something, and I was hoping someone might be able to help.

To keep it short and simple, I'm after an effective method to allow a number of scripts to activate based on when a player picks up a weapon.

In this case, it's a backpack system, allowing units to carry extra ammo and parachute when carrying the backpack.

Does anyone have any ideas how this can be done, and it has to work in MP too.
ng

Offline laggy

  • Members
  • *
  • "Behold a pale horse"
Re: Activate script when item picked up
« Reply #1 on: 20 May 2008, 22:43:11 »
Hi.

Find out the name of the backpack weapon.

Trigger Condition:
player hasWeapon "weaponname"

Trigger OnActivation:
whatever = true; publicVariable "whatever"

New trigger condition:
whatever

New trigger OnActivation:
[] exec "whatever.sqs"

Or:

Trigger condition:
player hasweapon "weaponname"

Trigger OnActivation:
[player] exec "whatever.sqs"

"whatever.sqs" can then i.e addAction to the player that will make him spawn ammo on the ground.



Laggy
« Last Edit: 20 May 2008, 22:47:46 by laggy »
And I looked and beheld a pale horse and his name that sat on him was Death and Hell followed with him.

Offline smileynick

  • Members
  • *
  • i am smiley nick
Re: Activate script when item picked up
« Reply #2 on: 20 May 2008, 22:57:45 »
Thanks for the reply Laggy

Do you know if there is a way to call it all from the addon itself, rather than the mission?

Reason I ask is that there might be a lot of playable slots, and it would be easier not to set it all up in the editor

ng

Offline Pirin

  • Members
  • *
Re: Activate script when item picked up
« Reply #3 on: 21 May 2008, 07:46:41 »
Could you maybe use XEH to assign some kind of pickedup eventhandler to the item?

Offline h-

  • OFPEC Site
  • Administrator
  • *****
  • Formerly HateR_Kint
    • OFPEC
Re: Activate script when item picked up
« Reply #4 on: 21 May 2008, 08:40:51 »
Isn't XEH basicly a "handler handler" (mildly put, it's quite innovative piece or work)?
It doesn't add new ones to the game, it 'just' expands thea features of the few existing ones.

However, running a looping script doing the weapon check from the units init eventhandler (using XEH or not) should do the trick.. :scratch:
Project MCAR   ---   Northern Fronts   ---   Emitter 3Ditor
INFORMATIVE THREAD TITLES PLEASE. "PLEASE HELP" IS NOT ONE..
Chuck Norris can divide by zero.

Offline smileynick

  • Members
  • *
  • i am smiley nick
Re: Activate script when item picked up
« Reply #5 on: 21 May 2008, 09:24:51 »
I was thinking the same, however i have no idea what so ever on how to add them or where to start.

Is there a XEH guide for dummys?

EDIT

Quote
      class EventHandlers {
         init="_this exec ""\RAABOpen\berg\initRAABUnit.sqs""";
      };
   };

This is part of a cfg, allow the units to call the scripts as soon as they are in game. Im after that effect but for any units who have the weapon. Im kinda pulling my hair out because of this, can anyone show me any examples of what to do?
« Last Edit: 21 May 2008, 14:28:24 by smileynick »
ng