Jump to content
Murklor

Editor based AI spawn script by trigger

Recommended Posts

Editor based AI script by trigger v8 :

v8 (ArmAIIholic)

NO GROUPS

MISSION ON CLIPBOARD --- UNITS AND WAYPOINT ARE SAVED AS THEY WERE IN SQM!!!

=== Added ===

- Waypoints are also remembered -- no dummy groups at all!!!

- You get the output on Clipboard you can paste and execute. Added loader for Clipboard missions -- test demo_2.utes.

Caution :

a) be careful with waypoint statements >> they need to be between
" "
, so you have to use
' '
. Look at the examples in demo_1.utes.

b) waypoints don't have placement radius when saved to clipboard, they will be saved with position they've got from the editor

=== Changed ===

- Triggers are now plain variables (catch_trigger) and they use publicVariable

a) simpler to manipulate, no initialization in init.sqf

b) they are remembered and copied to Clipboard

- Scripts are waiting with waitUntil rather than while (different "busy waiting" approach)

=== Demo missions ===

Demo_1
is classic Murklor's example, the one that you have also in v7, but with corrections for waypoint statements

Demo_2
is loaded from Clipboard >>> loader.sqf >>> murk_spawn_loaded.sqf ---- you won't see any units on the map!

That mission has 23KB :)

=== Capturing mission ===

Mission is captured from every murk_spawn.sqf, so give it some time to spawn everything and copy it to Clipboard. The more units you have on the map, the more time it will take for those scripts to save everything to clipboard.

IMHO, using loaded missions will solve problems with other scripts (like Norrin's revive etc.) -- though didn't test that yet myself.

=== Download ===

http://www.mediafire.com/?n7wa6d1smli874w

http://www.megaupload.com/?d=6QI2QYQJ

http://rapidshare.com/files/449489338/spawn_exampleV8.zip

Armaholic mirror has been updated too.

Edited by ArmAIIholic

Share this post


Link to post
Share on other sites

Hi, Nice scripts !

can you delete living units after going outside of the triguer or a designated area?

Thanks

Share this post


Link to post
Share on other sites

@Minimalaco you can try this zapat's script :

//---delete all unnamed vehicles---

{

{deleteVehicle _x}forEach (crew _x);

if (isNil vehicleVarName _x) then {deleteVehicle _x;}

}forEach vehicles;

//---delete all men further than 400 meters---

{

{

if (_x distance player > 400) then

{

_x removeAllEventHandlers "killed";

deleteVehicle _x;

};

} forEach units _x;

sleep 0.5;

deleteGroup _x;

} forEach allGroups;

this should be sufficient enough, right? Just be sure to run this script on Server.

Does v8 give any preformance advantages ? i.e demo 2 you say copy to clipboard and no men in editor will the speed things up at all ?

Yes it does, you don't have spawning process and then deleting groups, in contrary, everything is loaded at the beginning.

Plus, since there is a limit of 144 groups per each side in the editor, with this script you can pre-load many missions from Clipboard and, in that way, cover whole map with battles.

And use snippet posted above to clear the area when player leaves it.

Share this post


Link to post
Share on other sites

@psvialli, I don't know if I made it clear in previous post, but it is ok to explain how it works, to you and others using this fabulous script.

1) You place as many groups as you can (max for each side 144), e.g. make your mission on one part of the map...

2) In loader you have this line

{ _null = [_x] execVM "murk_spawn_loaded.sqf"; } forEach *** ;

in the place *** you just put Ctrl+V what you have captured from the editor.

3) Delete those units in editor and on some other part of the map make some other mission

4) Capture it, make new line in loader

{ _null = [_x] execVM "murk_spawn_loaded.sqf"; } forEach *** ;

and paste what you have captured.

5) Delete all units --- I forgot to say : don't delete triggers, markers, etc.

6) When you Preview the mission all groups will be available and spawning by their triggers.

That wasn't possible in previous version and waypoints were connected to dummy groups.

Share this post


Link to post
Share on other sites

quick question I am trying to get a group to spawn when the unit enters the trigger area and then be loaded back into the clipboard when trigger is deactivated, so it can be activated again if the player returns. Any suggestions on how to do this;

Share this post


Link to post
Share on other sites

Weaponx, you don't need to load it back, you need to use reset mode :

Example: null = [this,"triggername","reset",5] execVM "murk_spawn.sqf";

Will spawn the editor unit once based on the trigger, then reset the trigger after a preset time (15 seconds default). The unit will be created when trigger is true again, maximum number of lives (in this case 5).

Trigger must be on repeatedly!

If you want to change preset time (15 seconds default) open murk_spawn.sqf and find RESET MODE at the end of the file and change sleep time.

Please open murk_spawn.sqf and see examples of how to use those 4 modes.

Cheers

Share this post


Link to post
Share on other sites

I understand the reset function; but what I am trying to do is have a player trigger the the spawn; be able to engage the enemy spawn and then be able to move out of the trigger area, and the enemy is reloaded minus the dead units. This will enable another player to retrigger the enemy spawn minus the dead. Sort of using as a cache to take pressure off server. Also it would be great if the scripts could be used on objects too, I am working on a minefield with wire; Would be great to have minefield appear to make mission more dynamic with out cluttering the map with Objects.

Share this post


Link to post
Share on other sites
1) and the enemy is reloaded minus the dead units. This will enable another player to retrigger the enemy spawn minus the dead.

2)Would be great to have minefield appear to make mission more dynamic with out cluttering the map with Objects.

1) I didn't plan to do such things... It could be done by executing script that will take all remaining groups on the map (when trigger is deactivated) and execute Murklor's script on them again.

Murklor's script was about Groups and Waypoints, and I wanted to make that aspect better.

2) You can do that by using 3D editor or RTE, therefore you will have SQF script you can execute.

Share this post


Link to post
Share on other sites
1) I didn't plan to do such things... It could be done by executing script that will take all remaining groups on the map (when trigger is deactivated) and execute Murklor's script on them again.

Murklor's script was about Groups and Waypoints, and I wanted to make that aspect better.

2) You can do that by using 3D editor or RTE, therefore you will have SQF script you can execute.

1) I've tried to do by placing " nul = [this,"triggerfour","once",0,0, ] execVM "murk_spawn.sqf";" in the "on deactivation" in the trigger; But it doesn't seem to work; I replaced the "this" with the name of the group leader but that didn't seem to work. I also tried to define the group leaders in the

by placing the following on the orginal group leader:

nul = [this,"triggerfour","once",0,0, "first1 = this "] execVM "murk_spawn.sqf";

still have not been able to get it to work, I must messing up the code some how.

Share this post


Link to post
Share on other sites

@weaponx

try this:

nul = [this,"triggerfour","once",0,0, 'first1 = this'] execVM "murk_spawn.sqf";

Nomad

Share this post


Link to post
Share on other sites

Hello again, first to thank you for the excellent script, now in my community, 35 people can play without performance problems :)

question, in the condition of the trigger, you put the following:

(vehicle player) in thislist

but, we use planes and helicopters, so the plane to pass over the trigger, it activates .... but when I used UPSMON, the condition of the trigger, he wrote this:

this & & (count (thislist unitsBelowHeight 2)> 0)
where 2 is the height

The problem is that by adding the height, I get an error, example:

(vehicle player) in thislist; this & & (count (thislist unitsBelowHeight 2)> 0)

the error I get is the following: type bool, nothing Expected

but if I put the command:

this & & (count (thislist unitsBelowHeight 2)> 0)
, the script seems to run smoothly.

The final question is: is 100% necessary that the condition of the trigger this set:

(vehicle player) in thislist
?

thanks for the great scripts.

Share this post


Link to post
Share on other sites

I was thinking about that since I don't want my player that HALOed to activate the trigger, so the solution I've come around (but didn't tested yet, and you can do it and tell me) is this:

((vehicle player) in thislist) and (((getPosATL (vehicle player)) select 2) < 3)

which means that player in the vehicle will be able to activate the trigger only if his altitude is below 3m, in other words he will be able to do it in jeep or in helicopter that is on the ground, but not in the air.

Try it, let me know, thanx. I am not familiar with other codes you wrote.

Share this post


Link to post
Share on other sites

code:

this & & (count (thislist unitsBelowHeight 2)> 0)
if it works and works perfect. I've tested and works without problem

the question was, whether the code:

(vehicle player) in thislist
, is required for any work especially within the trigger or script ?

thanks.

Share this post


Link to post
Share on other sites

no, it is just checking whether player or his vehicle is inside a trigger, it is just another condition to check

trigger you wrote will activate on any unit -- BLUFOR, OPFOR, civilian, player, doesn't matter that is below altitude 2.... and I don't know what you want to trigger. Murklor's script, by nature is designed to start when player activates it, not any unit, so it is not clear from your example what are you trying to do....

and you got error because you put ; in the condition and that doesn't work...

(vehicle player) in thislist[b][color="Red"];[/color][/b] this & & (count (thislist unitsBelowHeight 2)> 0)

  correct would be

((vehicle player) in thislist) [color="Blue"][b]and[/b][/color] (this & & (count (thislist unitsBelowHeight 2)> 0))

because these are conditions and you combine them with AND, OR and ()

the question was
this line was not necessary, I was trying to help and your questions wasn't clear from previous post -- you can have both conditions, 10 conditions if you like --- it depends on what do you want to be the effect of that trigger, in other words -- what is the condition and what is the consequence of activation.

no, that code is not necessary, you can put whatever condition you want for triggering Murklor's script.

cheers

Edited by ArmAIIholic

Share this post


Link to post
Share on other sites

Hi ArmAIIholic,

Jiust going to try and use the new version, just one question !

You say "in the place *** you just put Ctrl+V what you have captured from the editor."

how do i capture it from the editor ?

Cheers

Share this post


Link to post
Share on other sites

In the init.sqf of demo_1 you have this code :

//{}{}{}{}{}{}{}{}{} MISSION CAPTURE - PART 2 {}{}{}{}{}{}{}{}{}{}{}{}
//Put some sleep time if you want to capture your mission (more is better) -- remove comment marks
sleep 10;
copyToClipboard str(Mission_capture);
"PROCESSING DONE..." hintC "MISSION CAPTURING IS DONE!!!";

It will sleep 10 seconds and then copy to clipboard everything you made. You don't have to do anything else.

Cheers

Share this post


Link to post
Share on other sites

Cool many thanks working :)

Another question is it better to break them down into separate loader.sqf or will that not affect performance?

i.e triggeroneloader.sqf, triggertwoloader.sqf etc...

ALso you state:-

Caution :

a) be careful with waypoint statements >> they need to be between " ", so you have to use ' '. Look at the examples in demo_1.utes.

b) waypoints don't have placement radius when saved to clipboard, they will be saved with position they've got from the editor

Is there a work around as i am using seek&Destroy with a placement radius - how can i set that back up if use the loader ?

Cheers

Edited by psvialli

Share this post


Link to post
Share on other sites

No, you don't need separate SQFs, just new line { _null = [_x] execVM "murk_spawn_loaded.sqf"; } forEach *** ; for every new mission / Clipboard content.

What I meant is this (from WICT's website):

A string may consist of any number of ASCII characters and is enclosed by single-quotes (only in ArmA) or double-quotes.

Examples (ArmA2):

_string = "here is my string";

_string2 = 'It may contain a lot of characters #@$';

If you want to include double quotes (") in strings enclosed by double quotes, the inside double quotes have to be written twice.

_string1 = "my string ""with"" quotes";

_string2 = 'my other string "with" quotes';

_string3 = "another 'string' example";

For init string called for the leader of the group and waypoint statements you have to use this format : "another 'string' example"

Example: "[[WEST,'HQ'],nil,rSIDECHAT,'Enemy chopper!'] call RE;"

Here is the catch you can try for placement radius, but I don't know if it will be ok :

In init line of the leader place (in other words in init string in call for Murk's script, see below)

group1 = group this; [group1, 2] setWaypointPosition [(waypointPosition [group1, 2]), 50];

Do you get it? It takes the position of old waypoint and set's new position (in radius 50 -- which is the same thing editor does every time you start the game). I will try it tomorrow.

If you try it first let me know if it is working.

Full example:

null = [this,"t1","wave",5,60,"group1 = group this; [group1, 2] setWaypointPosition [(waypointPosition [group1, 2]), 50];"] execVM "murk_spawn.sqf";

Zero waypoint is waypoint where group is created, so first waypoint in the editor is not zero (as you will see, for example 0: MOVE), but one!!!!!!!! Be careful !

Edited by ArmAIIholic

Share this post


Link to post
Share on other sites

OK thanks !!

1 little issue when I copy/past what I have I am getting the following for all my trigger names ?

<no shape>,"wave",8,120,"",120

Any idea why it is not getting the triggername and getting <no shape> what does that mean ?

Cheers

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

×