Jump to content
CoolSpy

Need help to complete a task when dropping an item on the ground in a trigger area

Recommended Posts

All in the title :)

 

I need a task completed when the players retrieve a backpack named "B_Messenger_Coyote_F" and drop it near a predefined trigger area.

I found some clues in other subjects but it was for a satchel charge and could not adapt it to my needs.

 

Please note that I am a beginner, do not hesitate to give more details than needed (condition, trigger links to tasks etc...)

 

Thanks in advance folks :)

Share this post


Link to post
Share on other sites

Depends on how idiot proof you want to do this.

Are there other backpacks of the same type in the mission?

If yes, then you should keep track which player picked it up and keep track if the backpack has been passed to other players, could be tricky/impossible if the backpack ends up inside a vehicles cargo storage, together with other backpacks of the same type.

 

A simple approach would be this:

//initPlayerLocal.sqf
player addEventHandler ["Put", {

 params ["_unit", "_container", "_item"];
 if (_item isEqualTo "B_Messenger_Coyote_F" AND _unit distance dropPoint < 2) then {missionNamespace setVariable ["GOM_fnc_backpackDelivered",true,true]};

}];

And in the trigger that sets the task when the backpack has been dropped:

time > 3 AND missionNamespace setVariable ["GOM_fnc_backpackDelivered",true]

Also place an object where the backpack should be dropped, dropPoint in this example, task will only return true when the BP has been dropped within 2m of the droppoint.

Only foolproof if this backpack is the only one of its type in the mission.

 

Demo mission.

 

Cheers

  • Thanks 1

Share this post


Link to post
Share on other sites

This works flawlessly!! Thanks so much, your demo mission really helped alot!(I use only one backpack of the same kind so it's easier to script)

 

By chance, do you happen to centralize all the helpful scripts you create for other people ? :) I dream of a website with dozens of cool scripts based around common needs, that would be awesome!

 

Thanks again GOM ;)

Share this post


Link to post
Share on other sites
22 hours ago, coolspy said:

I dream of a website with dozens of cool scripts based around common needs

Hey brotha, you did see THIS, right?

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×