Jump to content
wildcatbridge

Trigger activate when target is hit

Recommended Posts

Hi there, I've been working on a multiplayer campaign for the past few days for my friends, and I've gotten to a snag. I'm making an mission where the players can test their skills, assault course, kill house and a firing range. First two have gone well and are working swimmingly but the last isn't. I've set up three rows of targets, the objective is to have the player slot the first row, then the second row pops up further away, then after that the next row pop up. I've looked everywhere but so far all i can do is  get the targets to stay down then all pop up at the same time. I'm wondering if i can get a trigger to fire once all the targets have been knocked back down to stand up the next row. i'm open to using scripts but would rather use triggers if possible. Any help is much appreciated thank you.

Share this post


Link to post
Share on other sites

You'll probably need to name (or better collect all the targets in an array) and then check for the animationPhase of the targets

when the animationPhase of all first line targets is in the downed state then pop up the second row.

  • Like 1

Share this post


Link to post
Share on other sites

right....i so desperately wanted to say 'yes that's the solution' but if i'm honest most of that went completely over my head....i'm gonna do some googling first see if i cant try to learn and figure out what you said. Thank you for starting me off in the right direction.

Share this post


Link to post
Share on other sites

Sorry. :D

Lets say you have 3 * 3 targets in the editor and name them like this

target_7	target_8	target_9

target_4	target_5	target_6

target_1	target_2	target_3

now

//prepare target arrays
row_1 = [target_1,target_2,target_3];
row_2 = [target_4,target_5,target_6];
row_3 = [target_7,target_8,target_9];

{_x setDamage 1; _x animate["terc", 1];} forEach (row_1 + row_2 + row_3);
sleep 3;

//prepare first row
{_x setDamage 0; _x animate ["terc", 0]} forEach row_1;
waitUntil {sleep 1; {_x animationPhase "terc" isEqualTo 1} count row_1 == count row_1};

//prepare second row
{_x setDamage 0; _x animate ["terc", 0]} forEach row_2;
waitUntil {sleep 1; {_x animationPhase "terc" isEqualTo 1} count row_2 == count row_2};

//prepare third row
{_x setDamage 0; _x animate ["terc", 0]} forEach row_3;
waitUntil {sleep 1; {_x animationPhase "terc" isEqualTo 1} count row_3 == count row_3};

//done
hint "Course complete!";

It'd be better to use count instead of forEach and consolidate the three rows into another count cycle but I don't want to confuse you any more.

  • Like 3

Share this post


Link to post
Share on other sites

wow, thank you man for taking the time to write that up for me, stupid question but i'm presuming this all goes in an SQF file?

 

 

okay i decided to put it in as a script got that all working, problem is that when i activate the trigger that calls the script it just stands them all up, tells me the course is complete and an error box pops up in the top saying something about a generic errror

Edited by wildcatbridge

Share this post


Link to post
Share on other sites

Aha! yes it works! i was using the wrong way of calling the script, you man are a genius! thank you so much you've just solved about three days of pain for me 

  • 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

×