Jump to content
BooTheForest

Help Spawning AI via trigger

Recommended Posts

Hey everyone,

 

I have been encountering some issues spawning AI in via a trigger. I have been trying to do this on a multiplayer server that i host and no matter what i can't get them to spawn. I have been using the Something Something Games Youtube tutorials in order to help create the script but the videos are from 2013 so im having trouble finding my issue.

 

This is the current code im working with

 

_Allies1 = [];

if (isServer) then {
_Allies1 =[getmarkerpos "marker1",WEST, ["rhsusf_army_ocp_crewman","rhsusf_army_ocp_crewman"],[],[],[],[],[],180]call BIS_fnc_spawnGroup;}
 

Im not getting an error in game as far as i can tell. I do have a ton of addons running and one of them always creates an error popup when i launch the match so it's hard to tell if something else pops up but im pretty sure nothing is (it shouldn't conflict though its just a survivable crashes mod).

 

My ultimate goal is to be able to spawn vehicles in as well such as flying helicopters but i cannot even accomplish this. 

 

In my trigger i have blufor present and the activation field is 

 

nul= execVM "med1".sqf

 

 

Would appreciate any help or any easier methods.

 

 

Share this post


Link to post
Share on other sites

_allies1 = [] is useless.

_allies1 is a group not an array.

null = execVM "med1.sqf"   (not "med1".sqf)

 

For helo, just find the class you want. helo will spawn on fly with crew. Easy.

Share this post


Link to post
Share on other sites

@pierremgi Can you explain it a little more? I revised it to this and still no progress

 

if (isServer) then {
[getmarkerpos "marker1",WEST, ["rhsusf_army_ocp_crewman","rhsusf_army_ocp_crewman"],[],[],[],[],[],180]call BIS_fnc_spawnGroup;}

 

I have a invisible helo pad named marker1.  I have also tried vehicles and still no luck. 

Share this post


Link to post
Share on other sites

Check your classes. I don't have RHS. If the classes don't exist, you will not have error but no spawn neither.

If OK, check the condition firing the code. Replace by hint "OK" , or equivalent to verify the script runs to this line.

Share this post


Link to post
Share on other sites

@pierremgi Am i correct in assuming that the class name is the text that shows up when you hover over a unit in the editor. For example the NATO rifleman is B_Soldier_F. This is the only thing i can think of that's preventing the spawn of units. Im not getting errors or anything. Do i need to put anything in description.ext?

 

Also what do you mean by condition firing the code? Like the trigger activation stuff? That's set to blufor present. 

Share this post


Link to post
Share on other sites

Yes. the class name is given in the editor.

Yes. If the condition is in a trigger, it must be true to fire the code. Bis_fnc_spawnGroup is a great function. Just verify this code fires (a hint can help) and place some "B_Soldier_F" in the parameter. I don't remember if the function param is case sensitive but it's easy to pay attention for upper/lower case in few classes.

Share this post


Link to post
Share on other sites
6 minutes ago, pierremgi said:

Yes. the class name is given in the editor.

Yes. If the condition is in a trigger, it must be true to fire the code. Bis_fnc_spawnGroup is a great function. Just verify this code fires (a hint can help) and place some "B_Soldier_F" in the parameter. I don't remember if the function param is case sensitive but it's easy to pay attention for upper/lower case in few classes.

Alright so yes the trigger is firing if that was what you meant. I added in a hint at the end to make sure it was. Still nothing though. No errors either. I have tried using vanilla units and RHS units. 

 

 

[getmarkerpos "marker1",WEST, ["B_Soldier_F"],[0],[0],[0],[0],[0],120]call BIS_fnc_spawnGroup, hint "hey";

 

Not sure if that's exactly what you meant by adding a hint though. 

Share this post


Link to post
Share on other sites

Basic syntax: lines of code in sqf are separated by ;

So:

[getmarkerpos "marker1",WEST, ["B_Soldier_F"],[0],[0],[0],[0],[0],120]call BIS_fnc_spawnGroup ; hint "hey";

But right now the hint is useless if the trigger check is OK.

Share this post


Link to post
Share on other sites
5 minutes ago, pierremgi said:

Basic syntax: lines of code in sqf are separated by ;

So:

[getmarkerpos "marker1",WEST, ["B_Soldier_F"],[0],[0],[0],[0],[0],120]call BIS_fnc_spawnGroup ; hint "hey";

But right now the hint is useless if the trigger check is OK.

Revised it to that and same result the hint pops up. Just to make sure im on the same page the current trigger on activation field reads

 

"null= execVM "allies1.sqf" when i drive through the hint pops up on my screen but the unit doesn't appear. Im assuming this is what you wanted to see?

Share this post


Link to post
Share on other sites

I just remarked you took a bad initiative adding 0 in param arrays. Some arrays are waiting for strings list like ranks.

 

So:

[getmarkerpos "marker1",WEST, ["B_Soldier_F"],[],[],[],[],[],120]call BIS_fnc_spawnGroup; will work. Don't garble your initial post with plenty of tries!

Share this post


Link to post
Share on other sites
Just now, pierremgi said:

On the other hand, for a small code like this, no need to write an sqf.

So should i just put it straight into the trigger then? I think i tried this but if the code is good then ill give it a go.

Share this post


Link to post
Share on other sites

I can say it's not the mods. Tried on vanilla, put the code into the trigger with an activation of blufor present. No spawned rifleman. Atleast that narrows it down.

Share this post


Link to post
Share on other sites

 

I added : if (isServer) then {...} like your code, but for a trigger, you can tick on the case in the tab.

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

×