Jump to content
Sign in to follow this  
Muzza

Making loops of Explosions in A3Alpha

Recommended Posts

Hi,

I can make explosions just like in any other arma game;

b_1=  "M_Mo_82mm_AT" createvehicle getpos t_1;

I have a series of game logics named t_0, t_1 ... t_13.

I would like to blow them all up in a loop, and so far I have the following script.:

for "i" from 0 to 13 do {b_i=  "M_Mo_82mm_AT" createvehicle getpos t_i};

Nothing is happening when the script is triggered.

Any advice would be appreciated.

Share this post


Link to post
Share on other sites

The problem is that the script will not automatically turn the number value of "i" into the "i" of portion of "t_i". Each iteration of the loop it justs sees a variable names "t_i" instead of "t_0", t_1", etc. which obviously do not match the names of any of your logics. There is a way to dynamically create variables that point to your logics, but the simpler method (eventhough it is a little more brute force) is to do the following:

_logics = [[color=#3E3E3E]t_0, [/color][color=#3E3E3E]t_1, [/color][color=#3E3E3E]t_2, [/color][color=#3E3E3E]t_3, [/color][color=#3E3E3E]t_4, [/color][color=#3E3E3E]t_5, [/color][color=#3E3E3E]t_6, [/color][color=#3E3E3E]t_7, [/color][color=#3E3E3E]t_8, [/color][color=#3E3E3E]t_09, [/color][color=#3E3E3E]t_10, [/color][color=#3E3E3E]t_11, [/color][color=#3E3E3E]t_12, [/color][color=#3E3E3E]t_13]; // Create an array with the names of all of the logics.
[/color]{_bomb =  "M_Mo_82mm_AT" createvehicle getpos _x; sleep 1;} forEach _logics; // Create an explosion at the position of each logic with a one second delay (change the number after sleep to change the delay).

I hope this helps. Good luck!

Edited by Loyalguard

Share this post


Link to post
Share on other sites

Thanks for the quick response!

I am getting syntax errors when putting this into the 'on activation' window of my trigger. Is there another way i should be executing this script?

Thanks again!

Share this post


Link to post
Share on other sites

Ah, I did not know this was trigger activated. The best thing to do would be to save the code I gave in you in a seperate script file called bombLoop.sqf (or something similar) saved in your mission folder and then in your "On Act" field enter the following:

null = [] execVM "bombLoop.sqf";

Share this post


Link to post
Share on other sites

Thanks again Loyalguard!

I have used text effects to make sure the trigger is working properly and there is not complaint about being unable to fine the file that I have put in the mission folder, however nothing happens! How exactly do you debug this game? is there an output log where you can see exactly what is going on?

Share this post


Link to post
Share on other sites

First, I just found a typo in the code I gave you. Change "for each" to "forEach". I corrected it in the example I gave earlier but I wanted to point that out first.

If the script is in your main mission folder it should be executing. Here are some things you can do to debug:

1. You said you were seeing syntax errors so I assume you have -showscripterrors active, but I just wanted to make sure.2. Try a hint as the first line of the script to make sure it is actually executing such as hint "Script Executed";

3. Try putting () around getPos _x. e.g. (getPos _x).

4. Take out all of the comments to include the / or //.

5. You can also use the command diag_log to dump info to the .RPT file.

Give those a shot and see if that works.

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  

×