Jump to content

Recommended Posts

Ok so this is what I have discovered. Na_Palm you can use the activation section on the trigger, but you have to place a Game Logic down and name it for the script to work. I also had to place a new trigger for what ever reason old trigger was not working as intended. The script will not work with just a marker either it has to be a game logic position. Thanks for the help! I figured it was simple.

Share this post


Link to post
Share on other sites

Sorry, about the forgotten gamelogic.

In my setup, i generally precompile all needed scripts at mission start, so they don't need to compile at runtime... therefor i don't use/need the gamelogic, but good to see it's working for you now.

greetings Na_Palm

Share this post


Link to post
Share on other sites
I'm trying to use some of the functions from Na_Palm's version of the scripts, specifically from LV_fnc_menGroup.sqf. My init.sqf contains

	if(isNil("LV_ambientCombat"))then{LV_militarize = compile preprocessFile "LV\ambientCombat.sqf";};

which in turn contains

if(isNil("LV_menGroup"))then{LV_menGroup = compile preprocessFile "LV\LV_functions\LV_fnc_menGroup.sqf";};

so theoretically I should be able to use

_grp = [getPos ambushmarkerSpawn, 0, [10,3]] call LV_menGroup;
hint format ["Leader: %1",_grp];

as LV_menGroup returns _leader which should be the leader of the group.

My issues is that in my code, the hint comes up as Leader: any which would mean that _grp is undefined, which in turn means that _leader was not returned correctly from LV_menGroup.

From what I can see I am calling LV_menGroup exactly the same as it is called in Na_Palm's ambientCombat.sqf.

Also, when setting an ID number, is it possible to later on use something like leader LVGroup1 to refer to the leader of a certain group. I have attempted to but hint format "Leader: %1, leader LVGroup1"; returns a strange hex value, and LVgroup1 itself returns "any"

Just wondering if this question ever was answered? I'm having the same issue when trying to get a count of the spawned group on a dedicated server. Using cntLVgroup1 = count units LVgroup1; in my trigger on a dedicated server give me a result of "scalar", yet when I run the mission locally it works. How can I get the unit count of a spawned group (spawned with fillhouse.sqf for example) on a dedicated server?

Share this post


Link to post
Share on other sites

Hi Zlin,

must have missed the post from thestuntman beforehand...

if(isNil("LV_ambientCombat"))then{LV_militarize = compile preprocessFile "LV\ambientCombat.sqf";};

should be:

if(isNil("LV_ambientCombat"))then{LV_ambientCombat = compile preprocessFile "LV\ambientCombat.sqf";};

you can also change the "compile" command to "compileFinal" for security reasons in MP.

to get a working reference to "LVgroup..." i use:

call compile format["_grpname = LVgroup%1",_id];

after that you can use:

cntLVgroup1 = count units _grpname;

or use "_grpname" as every other local var.

greetings Na_Palm

Share this post


Link to post
Share on other sites
Hi Zlin,

to get a working reference to "LVgroup..." i use:

call compile format["_grpname = LVgroup%1",_id];

after that you can use:

cntLVgroup1 = count units _grpname;

or use "_grpname" as every other local var.

greetings Na_Palm

Hi Na_Palm and thank you very much for your reply but I still cannot seem to get it to work.

I have a script file that is spawning a fillhouse group. Here is my code to spawn the group:

nul = ["SelakanoAirfield",2,true,2,[10,10],80,"default",nil,nil,1] execVM "LV\fillHouse.sqf";

I then tried the code you provided after that line:

call compile format["_grpname = LVgroup%1",_id];

and then:

cntLVgroup1 = count units _grpname;

after that when I try to display cntLVgroup1:

systemChat format ["cntLVgroup1= %1", cntLVgroup1];

I still get "any" as the count.

What am I doing wrong?

If I create a radio call trigger and use hint format["OpFor on Map: %1", (east countSide allUnits)]; in the onAct, I get the correct amount of units.

Thank you so much for your assistance though. I really appreciate it.

Share this post


Link to post
Share on other sites

One more question. What would I put in the Trigger if I wanted it to set when only 10% of enemy is left? I am having a problem where randomly it is placing enemy in the churches and of course they can't be killed so trigger wont activate until all are dead.

Share this post


Link to post
Share on other sites
Hi Na_Palm and thank you very much for your reply but I still cannot seem to get it to work.

I have a script file that is spawning a fillhouse group. Here is my code to spawn the group:

nul = ["SelakanoAirfield",2,true,2,[10,10],80,"default",nil,nil,1] execVM "LV\fillHouse.sqf";

I then tried the code you provided after that line:

call compile format["_grpname = LVgroup%1",_id];

and then:

cntLVgroup1 = count units _grpname;

after that when I try to display cntLVgroup1:

systemChat format ["cntLVgroup1= %1", cntLVgroup1];

I still get "any" as the count.

What am I doing wrong?

If I create a radio call trigger and use hint format["OpFor on Map: %1", (east countSide allUnits)]; in the onAct, I get the correct amount of units.

Thank you so much for your assistance though. I really appreciate it.

Most probably you have overlooked to fill "_id" with the ID you used in the fillHouse call. Try something like this in your script:

_id = 1; 
_hndl = ["SelakanoAirfield",2,true,2,[10,10],80,"default",nil,nil,_id] execVM "LV\fillHouse.sqf"; 
waitUntil {scriptDone _hndl}; 
call compile format["_grpname = LVgroup%1",_id]; 
cntLVgroup1 = (count units _grpname); 
systemChat format ["cntLVgroup1= %1", cntLVgroup1]; 

-------------------------------------------------

One more question. What would I put in the Trigger if I wanted it to set when only 10% of enemy is left? I am having a problem where randomly it is placing enemy in the churches and of course they can't be killed so trigger wont activate until all are dead.

To master this you need to somehow get the initial groupsize AND the current groupsize, best way would be to use some form of global var there, that you can then also use in your militarize call.

Lets assume you use the following:

grpSizeforMil = [20,10];

your call for militarize would then be:

_hndl = [this,3,200,[true,false],[true,false,false],false,grpSizeforMil,[3,2],[0.7],nil,nil,1] execVM "LV\militarize.sqf";
waitUntil {scriptDone _hndl};
spawn {
   _id = 1;
   call compile format["_grpname = LVgroup%1",_id];
   while {!isNull _grpname} do {
       grpSizeforMil set [2, (count (units _grpname))];
       sleep 0.001;
   };
};

You now have an array with 3 entities:

first -> min group size

second -> variable count added to group size

third -> actual groupsize

in your trigger condition you can then use something like:

(grpSizeforMil select 2) < (((grpSizeforMil select 0)+(grpSizeforMil select 1)) * 0.1)

Hope you get the points there.

greetings Na_Palm

PS: the code here is not tested as i wrote it just down here.

Edited by Na_Palm
forgot an waitUntil And changed condition in trigger, corrected missing code line

Share this post


Link to post
Share on other sites
Most probably you have overlooked to fill "_id" with the ID you used in the fillHouse call. Try something like this in your script:

_id = 1;
_hndl = ["SelakanoAirfield",2,true,2,[10,10],80,"default",nil,nil,_id] execVM "LV\fillHouse.sqf";
waitUntil {scriptDone _hndl};
call compile format["_grpname = LVgroup%1",_id];
systemChat format ["cntLVgroup1= %1", cntLVgroup1];

-------------------------------------------------

Again sir, thank you for your help. This works fine on my client PC when I'm running the mission from the editor. I get a systemChat message that does show the correct unit count. However, when I try to run the same command from a radio trigger when running on a dedicated server, I am still getting "scalar" as my unit count.

This is my trigger (Radio Bravo, Repeatedly) onAct: hint format ["cntLVgroup1: %1", (count units LVgroup1)];

which still gives me the result of "scalar".

When I run the mission from the editor though, I get the correct unit count every time.

It seems that somehow the groupId is not accessible when running on dedicated server?

Share this post


Link to post
Share on other sites

"Take away that sir. I work for my money!" :)

(to quote a nice one)

in an MP scenario you have to consider the locality of the script's/commands, where they run. Therefor you want to make sure that the AI, spawns, triggers, most off all things run on the server and not on the clients.

This code should also run only on the server, then.

I don't know your MP mission setup and as it does give a lot of ways to achieve the above, its mostly not possible to tell you what to do there, without knowing your mission.

I noted that i missed a line in my code above, The corrected one:

_id = 1;
_hndl = ["SelakanoAirfield",2,true,2,[10,10],80,"default",nil,nil,_id] execVM "LV\fillHouse.sqf";
waitUntil {scriptDone _hndl};
call compile format["_grpname = LVgroup%1",_id];
cntLVgroup1 = (count units _grpname);
systemChat format ["cntLVgroup1= %1", cntLVgroup1]; 

greetings Na_Palm

Share this post


Link to post
Share on other sites

Thanks Na_Palm I will give that a try and see what works

Edited -

OK quick question- Where would I place- grpSizeforMil = [20,10]; In the init.sqf?

Edited by mech79

Share this post


Link to post
Share on other sites

Okay First Things First, Really Great Scripts. Thanks

Now My Problem is This I'm Using "Militarize" and I used the flash app to config what I want it to do. My Set up 2 triggers one to start the script and one to end it with one game logic for the area to be populated. Now the script fires and populates just fine, but once I get to the trigger to stop it, Nothing happens. So Please Here is My Scripts on each trigger, and the name of My Game Logic as Well

Trigger one no name just the Activation script

nul = [marshal_1,2,250,[true,false],[true,false,true],false,[10,5],[3,3],"default",nil,nil,77] execVM "LV\militarize.sqf"; hint "Your Screwed Now"

Game logic ID Name marshal_1

Trigger two no name just the stop code

nul = [LVgroup77] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf"; hint "Wow! You're Still Alive!"

Can Anyone tell me what I'm doing wrong on this. Thanks I'm really looking forward to pushing these scripts to have my own fun.

To the Developer You did a great job as My system is 10 years old and I get a brief CPU max spike and that says allot when you see my system spec's So Thank You for these as I'll get more use from my Arma 3 than I had even though I would get.

System Spec's

Intel Core 2 Quad Q6600

Windows Vista Ultimate Edition 64-bit SP2 (Build 6002)

CPU Arch : 1 CPU - 4 Cores - 4 Threads

CPU PSN : Intel Core2 Quad CPU Q6600 @ 2.40GHz

CPU EXT : MMX, SSE (1, 2, 3, 3S), EM64T, VT-x

CPUID : 6.F.B / Extended : 6.F

CPU Cache : L1 : 4 x 32 / 4 x 32 KB - L2 : 2 x 4096 KB

Core : Kentsfield (65 nm) / Stepping : G0

Freq : 1600.2 MHz (266.73 * 6)

MB Brand : Asus

MB Model : Berkeley

NB : Intel P35/G33/G31 rev A2

SB : Intel 82801IR (ICH9R) rev 02

GPU Type : NVIDIA GeForce GTX 650

DirectX Version : 11.0

RAM : 8192 MB DDR2 Dual Channel

RAM Speed : 400.1 MHz (2:3) @ 6-6-6-18

Slot 1 : 2048MB (8900)

Slot 1 Manufacturer : Crucial Technology

Slot 2 : 2048MB (8900)

Slot 2 Manufacturer : Crucial Technology

Slot 3 : 2048MB (8900)

Slot 3 Manufacturer : Micron Technology

Slot 4 : 2048MB (8900)

Slot 4 Manufacturer : Micron Technology

Share this post


Link to post
Share on other sites

hi Silent_Sniper,

for Trigger 2:

call compile format["LV_grpname = LVgroup%1",77];
nul = [LV_grpname] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf"; hint "Wow! You're Still Alive!"

should do the trick. Also you could try "LV\LV_functions\LV_fnc_removeGroupv2.sqf", too.

greetings Na_Palm

Share this post


Link to post
Share on other sites
hi Silent_Sniper,

for Trigger 2:

call compile format["LV_grpname = LVgroup%1",77];
nul = [LV_grpname] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf"; hint "Wow! You're Still Alive!"

should do the trick. Also you could try "LV\LV_functions\LV_fnc_removeGroupv2.sqf", too.

greetings Na_Palm

Well either I'm not understanding the code witch is more likely or was I to place part of this in my init.sqf main file on my mission?

So I placed the code you gave me in the Init field of trigger 2, and This did nothing, I adjusted the code the the 2nd option and nothing as well. I'm not a Code guy really I am Not as I'm dyslexic and this is really hard for me to do, but I do do it. I use the editor for almost everything, so what my question is How do I make Militarize De-spawn no mater what every time trigger 2 is tripped No matter what configuration I use from the AISSP . Or Is this code not working due to game logic on as the place holder? The reason I say this is well I was able to take Ambient Combat and use 2 triggers only and it will stop and start no problem every time I Trip the triggers in the game.

Thanks Your Help is really appreciated Na_Palm

Share this post


Link to post
Share on other sites

if spawning is working fine,

put this in the onActivation field of your Trigger 2:

call compile format["LV_grpname = LVgroup%1",77]; 
nul = [LV_grpname] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf";
hint "Now stay dead!";

and change the condition in it as you need.

Hope this is working for you. If you need further explanations let me now.

greetings Na_Palm

Share this post


Link to post
Share on other sites
if spawning is working fine,

put this in the onActivation field of your Trigger 2:

call compile format["LV_grpname = LVgroup%1",77]; 
nul = [LV_grpname] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf";
hint "Now stay dead!";

and change the condition in it as you need.

Hope this is working for you. If you need further explanations let me now.

greetings Na_Palm

Okay I was not able to make My original set up work with this code for some reason! But I figured out a way around this My First problem was and I noticed this on the AISSP was I was not using "" on the object name for where this script was to spawn in and around. So I tried that first and still no go, But then I read the Nice little ? as to where this was supposed to be applied to a marker, so I tried that, and By Golly it works just like the I have for Ambient Combat. So Thanks so much for your Help Na_Palm. Also I posted on the thread about the lootspawner seems to be a big issue and it took me 5 days to make that thing work perfectly and now my build is a bit of a mess. I Thank Arma's Update for that. LOL

Share this post


Link to post
Share on other sites

What i get from you, is that's now working on your end. Wonderful, no really! On the lootspawner, I'am working towards an update to go public in a few hour's.

Share this post


Link to post
Share on other sites
if spawning is working fine,

put this in the onActivation field of your Trigger 2:

call compile format["LV_grpname = LVgroup%1",77]; 
nul = [LV_grpname] execVM "LV\LV_functions\LV_fnc_removeGroup.sqf";
hint "Now stay dead!";

and change the condition in it as you need.

Hope this is working for you. If you need further explanations let me now.

greetings Na_Palm

Ok I have tried to use this script also the script from the original LV File for leave group and leave group v2 I can not get any to work right. I can get the the militarize call to work once Bluefor is not present I am trying to get trigger to delete militarized group, but like I sadi I have tried three different codes but none seem to work. I am placing them in the act section of the trigger as well. Any help?

Share this post


Link to post
Share on other sites
Can you send me the mission as zip preferably to look into it?

I am not completely done with it but I will send you the part I am trying to get to work.

Share this post


Link to post
Share on other sites

Hi guys,i just realized now,that i can stop ambient combat.Iv read all there is,but confess,i cant understand exactly how to do it.

Is there a way someone could explain in simple terms of how to use a trigger to stop AC from spawning?

Thank you

Share this post


Link to post
Share on other sites

Hey Redarmy,

Try this as this is what I did and was able to use the same 2 triggers to activate and de-activate when ever I went in the location I set the Triggers up at on the map.

Okay all you need for this is 2 triggers, no names on triggers.

Now First Trigger will have your start code, and set to repeatedly.

 test_1 = [250,400,25,30,6,[1,1,1],Player_1,"default",0,2500,nil,["CARELESS","MOVE"],false] execVM "LV\ambientCombat.sqf"; hint "This Starts Ambeint Combat"

Now test_1 is the unique name given to the start code instead of nul. Player_1 is where this Ambient Combat starts around which in this case would be Player_1 on the name for the unit 1 man rifle man.

Make Trigger 2 and this will have the stop code, and set to repeatedly.

 nul = [test_1,0,Player_1,60] execVM "LV\LV_functions\LV_fnc_removeAC.sqf"; hint "Ambeint Combat Stoped"

now see where in the stop code test_1 is this is where the unique name goes when you gave the start code a unique name in the start trigger, and Player_1 will need to be there as well as it was where the script was to spawn around. I hope this explains what I did.

Hi guys,i just realized now,that i can stop ambient combat.Iv read all there is,but confess,i cant understand exactly how to do it.

Is there a way someone could explain in simple terms of how to use a trigger to stop AC from spawning?

Thank you

Share this post


Link to post
Share on other sites
Hey Redarmy,

Try this as this is what I did and was able to use the same 2 triggers to activate and de-activate when ever I went in the location I set the Triggers up at on the map.

Okay all you need for this is 2 triggers, no names on triggers.

Now First Trigger will have your start code, and set to repeatedly.

 test_1 = [250,400,25,30,6,[1,1,1],Player_1,"default",0,2500,nil,["CARELESS","MOVE"],false] execVM "LV\ambientCombat.sqf"; hint "This Starts Ambeint Combat"

Now test_1 is the unique name given to the start code instead of nul. Player_1 is where this Ambient Combat starts around which in this case would be Player_1 on the name for the unit 1 man rifle man.

Make Trigger 2 and this will have the stop code, and set to repeatedly.

 nul = [test_1,0,Player_1,60] execVM "LV\LV_functions\LV_fnc_removeAC.sqf"; hint "Ambeint Combat Stoped"

now see where in the stop code test_1 is this is where the unique name goes when you gave the start code a unique name in the start trigger, and Player_1 will need to be there as well as it was where the script was to spawn around. I hope this explains what I did.

That was well explained thank you going to put it into action rite now.

Appreciate it mate thanks again!

Share this post


Link to post
Share on other sites

I would like to know for example I'm using Heliparadrop, and my custom code is

 nul = ["para_1",2,true,false,1500,"random",true,200,200,4,0.5,50,false,false,false,true,["para_1","para_2"],true,"default",nil,nil,66,false] execVM "LV\heliParadrop.sqf"; 

Now I gave the Helipardrop a custom name through the AISS of "66" Now all I want to be able to do is get a hint message to show if all members of this group are dead. No mater how many their are in the group. I tried

({alive _x} count units group66 == 0) AND ({alive _x} count units group66 == 0); hint "All Unit's Are Dead"  

But All I Get in Editor is Type Booline Expect Nothing? I'll Be honest My syntax may be way off in the first place, as I'm not that great with code, Does anyone have an idea on how to do this?

Edited by Silent_Sniper

Share this post


Link to post
Share on other sites

Whenever you want to get the group to perform commands/scripts on it use:

call compile format["_grpname = LVgroup%1",_id];

fill the var _id with the ID from the LV command.

And afterwards you can use _grpname, for all required tasks.

greetings Na_Palm

Share this post


Link to post
Share on other sites

@Na_Palm

I did try your suggestion but had no luck on a dedicated server. It worked fine locally but on dedicated I could never get a unit count for the spawned group.

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

×