Arma 3
3th3r34l Dec 13, 2020 @ 3:23pm
How can I make a working firing drill WITHOUT SCRIPTING
I don't wanna go into the notepad and stuff. I just wanna make the targets pop up when I'm at a checkpoint, make them stay down when shot, and make them all pop back up once finished (automatically or manually).
I've scoured the internet but cant seem to dins out how to do what they're doing. It'd be helpful to know if a trigger can change an object's Init as well.
< >
Showing 1-15 of 37 comments
3th3r34l Dec 13, 2020 @ 5:00pm 
Also, forgot to say, the initialization for each trigger and object is okay, but I don't wanna go into the .sqf file in order to change stuff.
Alaskan Glitch Dec 14, 2020 @ 8:06am 
The first thing you need to do is add the following line to your init.sqf file:

nopop = true;

This will force all popup targets to stay down after being hit.

If you wish to apply this popup behavior to only specific targets, you can place the following line in each of target's Init field that you want to have this behavior.

this setVariable ["nopop", true];

Second, every popup target you place give a name.

Third, in the trigger On Activation field enter the following:

TargetName setDamage 0; TargetName animate ["terc", 0];

It will reset the specified target's health (assuming it was shot), and the second line will make the specified target pop up again.
Last edited by Alaskan Glitch; Dec 14, 2020 @ 8:17am
3th3r34l Dec 14, 2020 @ 5:05pm 
Thanks! Just to specify, the nopop=true in the object's init will make it stay down, then the (this is what I'm calling em, for instance for checkpoint one, target two I'll call it T12) "T12 animate ["terc", 0]" will make it pop up when you get to the checkpoint?
Alaskan Glitch Dec 14, 2020 @ 5:18pm 
Originally posted by 3th3r34l:
Thanks! Just to specify, the nopop=true in the object's init will make it stay down, ...
No. If you use the line:

nopop = true;

It must go into your init.sqf file, and it will apply to every target. Every mission should include init.sqf and description.ext files. It is where the rules of the mission are established. Such as forcing all popup targets to stay down when shot. Or establishing respawn/revive rules, or music playlists, etc.

If you only want to effect just one target, and not modify the init.sqf file, then use the line:

this setVariable ["nopop", true];

Put the above line of code into the Init field of each target you wish to effect.

Originally posted by 3th3r34l:
... then the (this is what I'm calling em, for instance for checkpoint one, target two I'll call it T12) "T12 animate ["terc", 0]" will make it pop up when you get to the checkpoint?

Yes. If you name your popup target "T12" then in the On Activation field of the trigger should include:

T12 setDamage 0; T12 animate ["terc", 0];

That will reset the target, undoing any damage and popping the target back up. You can place the trigger anywhere. It does not have to be near the popup target.
Last edited by Alaskan Glitch; Dec 14, 2020 @ 6:04pm
3th3r34l Dec 14, 2020 @ 7:19pm 
I'm confused because I don't have to put "this setVariable" before the nopop=true for it to work, it just did, unless that makes it so it can be trigger activated. And how to you get into the SQF? Cuz the SQM is what I've been able to get onto thru the game's files. If I knew, it'd make mission editing a lot easier for me lol.
Also also, does this apply to proximity triggers as well? Or is that what I should assume when you say "trigger"? cuz I'm gonna have 1m*1m squares set up using cones on the corners and I want a trigger inside it to make them pop up per checkpoint.
And last thing, how could I go about making a timer start when you pass the opening gate and stop once you step into the final checkpoint?
Alaskan Glitch Dec 14, 2020 @ 8:13pm 
Using
nopop = true;
in your popup target's init field will work, but only for single-player. In other words, it only effects the client. In order to set the global variable "nopop" so that it can be used by both single-player and multiplayer missions, you have to use the setVariable. When "nopop" is set in the init.sqf then it applies globally to all the targets in the mission and you do not need to use setVariable.

The init.sqf file can be used for a lot of mission critical things, including creating your own functions. I use it to establish the relationships between sides. For example:

// Establish relationships east setFriend [west, 0]; east setFriend [resistance, 0]; west setFriend [east, 0]; west setFriend [resistance, 0]; resistance setFriend [west, 0]; resistance setFriend [east, 0];

Placing this code segment into your init.sqf file will make everyone hate everyone and consider them the enemy. To make someone a friend, just change the appropriate value from 0 to 1.

I also commonly use the init.sqf to establish my music lists, the briefings, and the initial task(s) for the mission. It is also a good location to create markers, triggers, or any other dynamic component you wish to introduce, because it all happens before the mission starts.

The Description.ext file contain information about the mission, how it will be played, and even its appearance to some extent. For example, a Description.ext might contain:

onLoadMissionTime = 1; // Display time and date. respawnOnStart = -1; // No respawning when first starting mission. Default = 0 respawn = 2; // INSTANT, at the location where the player died. ShowSquadRadar = 1; // Disabled = 0 (default), Enabled = 1 class CfgTaskEnhancements { enable = 1; // 0: disable new task features (default), 1: enable new task features & add new task markers and task widgets into the map 3d = 1; // 0: do not use new 3D markers (default), 1: replace task waypoints with new 3D markers 3dDrawDist = 0; // 3D marker draw distance (default: 2000) share = 1; // 0: do not count assigned players (default), 1: count how many players have the task assigned propagate = 1; // 0: do not propagate (default), 1: propagate shared tasks to subordinates };

All .EXT and .SQF files are plain text and can be edited with note pad. You can also get an Arma specific editor from: https://www.armaholic.com/page.php?id=1455

SQM files are mission files and can be either plain text or a pseudo-compiled binary. Once it has been compiled into a binary the SQM file is not editable via notepad. So don't compile the mission file until you have completed and tested the mission.

The mission.sqm, init.sqf, and Description.ext all need to reside in the same root mission folder. However, you may use sub-folders for all other files if you reference them correctly.
Last edited by Alaskan Glitch; Dec 14, 2020 @ 8:30pm
3th3r34l Dec 15, 2020 @ 8:08pm 
What I'm saying is when I look for the init.sqf file in my files (specifically the missions' folder), I can see only the mission.sqm. How do I get to the init.sqf file or do I have to MAKE it? (I think I heared u gotta make it in notepad or SoMeThInG). And thanks for ur help. Wasn't expecting so much interaction lol. It'd be helpful this weekend if you and I could maybe hop onto a call on here and work out some things because it seems like you know what you're talking about. What I asked for in this question is BAREBONE minimum what I wanna do.
Alaskan Glitch Dec 15, 2020 @ 9:53pm 
Yes. You have to create both the init.sqf and Decription.ext files in the same folder as the mission sqm file. You can use notepad, or any other text editor, as long as it is a plain text file.

Sometimes the "barebone minimum" is not the best choice. You could set the nopop variable for each and every target by putting it into each target's Init field - the "barebone minimum" approach. Or you could add just one small line in your init.sqf file that effects all targets, which is a smarter approach.

In both cases you are adding a script. The question becomes how many times do you want to repeat the same script?
3th3r34l Dec 16, 2020 @ 2:52pm 
I mean, it'd be cool to have a laptop sitting on a table next to a selection of guns to reset the firing drill however many times you want if that's what you're asking.. Now that I know I have to make the .sqf file it'll be a lot easier for me (I'm new to not only scripting, which I'm trying to learn, but ArmA in general).
And what'd make it as good as I possibly can is making a timer for when you start and finish, as well as a point system to assess accuracy maybe (though, that's probably pretty out there).
Alaskan Glitch Dec 17, 2020 @ 6:03am 
You can add an action to a laptop that would execute a script, when selected, that will reset all your popup targets with something like:

PopupTarget = [TargetName1, TargetName2, TargetName3]; this addAction ["Reset Targets", { { _x setDamage 0; _x animate ["terc", 0]; } forEach PopupTarget; }];

In the laptop's Init field create an array (PopupTarget) that contains the names you gave each of the targets.

When the player selects the action from the laptop the script will cycle through the names of the targets you provided, reset their damage, and popup them back up into position again.

The above script also relies on the "nopop" global variable being set to true either in the init.sqf or with each individual target, as you see fit.

Sometimes using a separate file for your scripts is useful, because it allows you to use those same scripts multiple times, or with other missions, without having to copy/paste them each time you want to use them. Like resetting popup targets, or refueling vehicles, or HALO jumps, for example. Those are features you will most likely use in multiple missions. I found it convenient to consolidate the scripts that I use regularly into separate files. That way I can easily add the features I want to any mission I create.

If you really want to get fancy, you can add the following EventHandler to the Init field of each popup target. It will place a small (10 cm) yellow sphere over the exact position where your round impacted the target. This EventHandler will also work with vehicles and other objects. It is not exclusive to popup targets.

this addEventHandler ["HitPos", { _spr = "Sign_Sphere10cm_F" createVehicle [0,0,0]; _spr setPosASL (_this select 0 select 3); }];

Use
deleteVehicle "Sign_Sphere10cm_F";
when you want to reset the popup target's hit location.

For example, if you want to display where the target was hit for just 15 seconds, you could say:
this addEventHandler ["HitPos", { _spr = "Sign_Sphere10cm_F" createVehicle [0,0,0]; _spr setPosASL (_this select 0 select 3); sleep 15; deleteVehicle "Sign_Sphere10cm_F"; }];
in the target's Init field.

The small sphere will stay where the round impacted the target, even after the target drops.
Last edited by Alaskan Glitch; Dec 17, 2020 @ 7:42am
3th3r34l Dec 17, 2020 @ 3:00pm 
That last thing looks pretty dope but really complicated lol
Alaskan Glitch Dec 17, 2020 @ 9:49pm 
It isn't that complicated. Event handlers are used when you are expecting an event to happen, but don't know when it will happen. So by placing an event handler in an object (like a popup target, vehicle, etc.) then nothing happens until a specific event occurs. In this case, the event is waiting for the object to be hit.

The createVehicle and deleteVehicle functions are used to create and destroy any object in the mission.

The setPosASL (Set Position Above Sea Level) function places the "Sign_Sphere10cm_F" object where the object was struck.

The sleep function just pauses the script for the specified number of seconds.
3th3r34l Dec 18, 2020 @ 8:53am 
Oh okay. That makes sense.
Alaskan Glitch Dec 18, 2020 @ 10:10am 
You should also understand that there are a thousand different ways to do the exact same thing via a script. There is no "wrong way" or "right way" to write a script if it does what it is suppose to do.

The sample code I provided is merely my interpretation of how I might go about the task you described, it doesn't mean there are not other ways, or even better ways, of doing the same thing.
3th3r34l Dec 18, 2020 @ 10:39am 
Oh. Would you say it's "optimal" per se? or more efficient than other scripts?

I hope this is a topic you're interested in because of all the questions I'm asking lol, I've wanted to learn ArmA scripting for a while now but the youtube videos just weren't doing it for me.
< >
Showing 1-15 of 37 comments
Per page: 1530 50

Date Posted: Dec 13, 2020 @ 3:23pm
Posts: 37