Jump to content
Sign in to follow this  
Cyper

Synchronize script?

Recommended Posts

Just some background information in case someone else has a solution for this.

This is what I want to do:

The player is supposed to kill unit X. Unit X is walking from area A och area B. If the player choose to kill X at Area B, the player will be attacked. But if player choose to kill x at area A, the player will not be attacked.

My solution: I create a trigger (trigger1) with this inside its init; player setcaptive false; player setside blufor; Then I set activation to: Not present. Then I create another trigger and put it inside area B. Once X reach area B, trigger2 will fire off, and then via a script group trigger1 to X. This would mean that IF X is killed after X have reached area B, the player will be attacked.

So far so good. Now to the problem; I need a script that group a trigger to a unit.

I have searched the board and tried all options but none seems to work. For example, I have tried

trigg1 synchronizeobjectsadd [test]

. If you have another other methods to solve this puzzle please tell.

Edited by Cyper

Share this post


Link to post
Share on other sites

I'm not 100% sure if I got the point, but you could check if the player is within a distance to trigger A or B.

distance2D

If (((player distance2D triggerA) >50) && (!alive target)) then {....player is not in area A....) //pseudo code

Share this post


Link to post
Share on other sites

What side are the units? player and unit X ? its not quite clear from your post.

setSide is meant for locations, if you want to change a player side join him to a group of the opposite side.

Lets say unit x is OPFOR and we have named him x in the editor unit dialog and the player is BLUFOR.

So the player needs to start off friendly so he is not killed, so we can put in his init

player setCaptive true

Then we place a trigger at area B grouped to unit x.

Present, Repeatable

OnAct

thisTrigger setTriggerStatements ["!alive x", "player setCaptive false",""]

So as soon as X gets to the trigger the trigger is changed to monitor if he dies, if he does the player is setCaptive false turning him hostile to EAST units.

HERE is a little example mission, if you kill the opfor unit before he runs through the marked area you will still be captive and ok, otherwise if he is killed once passing the area the opfor firing squad will kill you.

Hopefully this helps you towards your goal.

Share this post


Link to post
Share on other sites

Thanks for the answers, it solved my problem!

I did not know about the thistrigger settriggerstatement!

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
Sign in to follow this  

×