OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: smileynick on 20 May 2008, 21:05:59

Title: Activate script when item picked up
Post by: smileynick 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.
Title: Re: Activate script when item picked up
Post by: laggy 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
Title: Re: Activate script when item picked up
Post by: smileynick 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

Title: Re: Activate script when item picked up
Post by: Pirin on 21 May 2008, 07:46:41
Could you maybe use XEH to assign some kind of pickedup eventhandler to the item?
Title: Re: Activate script when item picked up
Post by: h- 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:
Title: Re: Activate script when item picked up
Post by: smileynick 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?