Jump to content
Sign in to follow this  
kyfohatl

This CreateTrigger script should work... but it doesn't. Any idea why?

Recommended Posts

z6 = createTrigger ["EmptyDetector", position player]

z6 setTriggerArea [200,200, 0, true]

z6 setTriggerActivation ["LOGIC", "PRESENT", true]

z6 setTriggerStatements ["!(alive man)", "fun = [""z6"",[1,0,0],[3,3,30,15],[],[],[],[1,1,1,1,0]] spawn DAC_Zone"]

exit

It's in sqs format (obviously), and all I want it to do is the generate the DAC zone defined in the activation statement (i.e. fun = ["z6",[1,0,0],[3,3,30,15],[],[],[],[1,1,1,1,0]] spawn DAC_Zone"] is what I want to be in the onActivation section). Oh, and it doesn't have to be at the player's position, I just did this to test it easily.

Also, I want to delete the zone when Russian units assualt the area later on in the mission and capture it (i.e. it's free of Americans), and then create a new zone, but this time for the Russian side. How can I do this?

Thanks in advance for any help.

Share this post


Link to post
Share on other sites

I can't see anything wrong with that code. Try testing the trigger for something more simple like a hint message. I suspect the problem may be with your DAC implementation.

Share this post


Link to post
Share on other sites

Maybe, but I have tried something simpler, such as the script bellow:

z6 = createTrigger ["EmptyDetector", position player]

z6 setTriggerArea [0,0, 0, false]

z6 setTriggerActivation ["NONE", "PRESENT", false]

z6 setTriggerStatements ["!(alive man)", "hint format ["The BLOODY trigger works!"]"]

exit

But even this one doesn't work (even though there is no DAC involved). This means that its most likely some problem with the create trigger script in general, but it should work since I pretty much copied it from the wiki. By the way, I have also checked my first script using squint. Any ideas why this is not working???

EDIT: Maybe it's got something to do with the fact that I have set no onDeactivation statement in the setTriggerStatements line?

Share this post


Link to post
Share on other sites

Im not familiar with these commands, but one thing I see, is the double quotes going wrong here:

z6 setTriggerStatements ["!(alive man)", "hint format ["The BLOODY trigger works!"]"]

You can try using single quotes like

z6 setTriggerStatements ["!(alive man)", "hint format ['The BLOODY trigger works!']"]

Share this post


Link to post
Share on other sites
....

EDIT: Maybe it's got something to do with the fact that I have set no onDeactivation statement in the setTriggerStatements line?

I think that could be the reason.

On the wiki page there are 3 Parameters and no one is optional.

So try:

z6 setTriggerStatements ["!(alive man)", "hint format ["The BLOODY trigger works!"]",""]
PS:

Did you start your Arma with the "-showScriptErrors" parameter ?

If not, add it to see any scripterror. If you omit the parameter you will never see, if your scripts (or trigger "onActivation"...) throw an error.

See: Arma2 Startup Parameters

Share this post


Link to post
Share on other sites
z6 setTriggerStatements ["!(alive man)", "hint format ["The BLOODY trigger works!"]",""]

Ok, tried that, but it's still no good (shouldn't there be three double quotes at the end anyway?)

I ran the "-showScriptErrors" as well... pretty useful tool. I got this:

'...6 setTriggerStatements ["!(alive man)", # "hint format ["The BLOODY

Error Generic error in expression

trigger works!...'

Ok so this obviously means that there is something wrong with what I've enetered in the onActivation field. So I tried some other stuff (like Soldier1 doMove ect.) and it worked. So I went back to may original DAC script and modified it to:

z6 = createTrigger ["EmptyDetector", (getMarkerPos "a")]

z6 setTriggerArea [0,0, 0, false]

z6 setTriggerActivation ["NONE", "PRESENT", false]

z6 setTriggerStatements ["!(alive man)", "fun = [""z6"",[1,0,0],[3,3,30,10],[],[],[],[1,1,1,1,0]] spawn DAC_Zone", ""]

exit

Now this works, it creates the zone and the troops, but it keeps on telling me that "the zone "z6" is not suitable for waypoints of this unit type (infantry)." I tried to change the location of the zone, but I got the same error. I don't know what's going on there...

Thanks for the help.

Share this post


Link to post
Share on other sites
z6 setTriggerStatements ["!(alive man)", "hint format ["The BLOODY trigger works!"]",""]
I see a possible error:

You try to use single quotes in an quoted string.

This will be parsed as:

"hint format ["The BLOODY trigger works!"]"

2 strings (green) + some commands (red) wich can't be found or parsed.

try:

z6 setTriggerStatements ["!(alive man)", "hint format [""The BLOODY trigger works!""]",""]
Notice the double quotes around the text message ""The BLOODY trigger works!"" !

I changed it in a previous post to single quotes, wich makes it more readable:

z6 setTriggerStatements ["!(alive man)", "hint format ['The BLOODY trigger works!']"]

Share this post


Link to post
Share on other sites

Yes, they both work :yay:. You are the man Heli J . :rthumb:

I had actually tried the one with signle quotes earlier, as suggested by rundll, but for some reason it didn't work (probably some syntax error). Now I can create triggers mid mission, which I reckon will be a very useful feuture.

Oh, and on the DAC: As I was looking through the Readme for the third time, I came across a chapter that I seem to have missed, which explained how to create DAC zones mid mission (its a completely different script, and can't be done by the method I was using).

So now I hope to use both the mid-mission DAC creation script, as well as your faction identifyer script, to create a DAC generated battle. As troops of one faction advance and secure important locations, they will be rewarded with a DAC zone generated (with their faction's units) at that point (hence why I needed to find the faction of the present units). This should create the feel of a dynamic war, as well as the feeling that both sides are advancing on each other, and capturing points. This is my first propper mission (I have created several others, but they are mostly half complete and very buggy), and I hope to release it. But I have to make sure it's of sufficient quality.

Anyway, thanks again for your kind and detailed help.

Edited by kyfohatl

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  

×