Jump to content
Sign in to follow this  
wuestenkamm

Creating simple Variables

Recommended Posts

Hey guys,

i just started doing missions with the 2D editor in arma 3 and i am wondering if it's possible to create simple variables (like integer, boolean,...) with triggers and use them like C++ or C#? My goal is a mission with a Checkpoint where the NPC's open fire if you just drive through. Because of lacking skills in real scripting i thought it might work like this:

1. Bluefor needs to stay in trigger area for a certain time: int1 set to 1, /*Opfor units don't attack*/

2. Bluefor moves on, passes a second trigger; if int1 != 1 then /*Opfor units open fire*/ else /*Opfor stays careless */

my problem atm is, i don't know how to declare "int1" for example

thanks and greetings,

wuestenkamm

Share this post


Link to post
Share on other sites

int1 = 1; or init1 = false; In a script or onAct of a trigger to define a variable.

You can check the variable's bool status in the condition of a trigger by simply: init1 or !init1

Share this post


Link to post
Share on other sites

You can simply put those definition in the init-line of one of the objects you've placed.

Or you create a file named init.sqf in your missionfolder and define your variables there.

Don't be afraid of writing scripts, they're basically the same thing as what your write in trigger-conditions and at some point that actually becomes easier than making complex trigger-mechanics.

Share this post


Link to post
Share on other sites
Don't be afraid of writing scripts, they're basically the same thing as what your write in trigger-conditions and at some point that actually becomes easier than making complex trigger-mechanics.

↑↑↑This!

For ages I was confused by the seemingly endless wall of texts that scripting seemed to be. There's nothing like getting stuck in to learn, so go crazy! You can't melt your PC - the worst I've ever managed to do was freeze the game/ctd a few times.

Very rewarding when it all starts to come together though.

Check this page: it's been a trusty resource all the time for me.

http://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3

Share this post


Link to post
Share on other sites
Check this page: it's been a trusty resource all the time for me.

http://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3

↑↑↑This! ;)

I must've spent countless hours just looking at the available commands, messing around and trying out what I could do with them.

It can be hugely satisfying to figure out new things that you can do by creatively combining those commands.

Aside from that, it's an extremly good way to learn.

Share this post


Link to post
Share on other sites

wow guys, thanks for the fast and helpfull answers (y)

i've got my checkpoint working now, but all the triggers are looking awfull and im going to try scripting now

Share this post


Link to post
Share on other sites

What triggers look like doesn't matter since players will never see them. :) Also for triggers like these or ones that don't rely on a specific area you can change the X and Y to 0 so they are just a blue flag. Or you can make them say 5x5 squares or something so line them up nicely. You can even add Text to them so you can hover over to see which is which.

O0rQyEv.jpg

Also for something as simple as a flag you might want to just use:

triggerActivated triggerName

as a condition. Instead of having the second trigger check for int1 just have it check if the first trigger activated.

Also for the int1, you might want check if it exists first then create it instead of always setting it to a specific value. That way it won't get over written by a JIP player or something later.

if (!isNil "int1") then {int1 = false};

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  

×