Jump to content
Sign in to follow this  
Naiss

Random AI spawn?

Recommended Posts

how would i create a script where the AI randomly spawn on the map with a function activated on them like they got a script on them with this [this] execVM "myscript.sqf";

Share this post


Link to post
Share on other sites

Well, you could place a trigger on your map, when entered by a certain faction, would spawn an opposing faction of troops with an objective to seek out the faction that triggered their spawn.

Do you want someone to actually post the trigger condition and the myscript.sqf, or do you want some help and guidance on how to write the script?

It might be considered a little arrogant just to ask for the solution without at least attempting to post your efforts so far.

To get you started, you'll need to know how to spawn a group. Google this for some solutions and post back with your findings and we'll help you on your way.

See BIS_fnc_spawnGroup

Remember, we're here to help you, and we'll offer positive criticism and guidance.

Lets see how you get on.

Tackle each one of these objectives:-

1. Place a trigger on your map

2. When this trigger is entered by a certain faction, the trigger would call myscript.sqf

3. myscript.sqf would spawn a group of opposing faction units

4. Set the spawned units an objective to seek out the units that triggered their spawn.

Edited by Beerkan
The spelling bee told me to.

Share this post


Link to post
Share on other sites

okey thanks i did not start making the script file yet because im not sure how i would make the sqf file run on a AI

Share this post


Link to post
Share on other sites
okey thanks i did not start making the script file yet because im not sure how i would make the sqf file run on a AI
If you are as far as having a spawn script, then you're nearly there.

So what do you want them to do?

Partol an area?

Move through a selection of waypoints?

Seekout the other faction?

Attack or defend somewhere/something?

Post your spawn script so we can see what you call the spawned units, and we'll show you how to get them to do something.

Share this post


Link to post
Share on other sites

i got the spawn stuff now but when the unit spawn the just stand still and dont even move at all

this is the code i got:

_spawn = ["z1","z2","z3","z4","z5","z6","z7","z8","z9","z10","z11","z12"] call bis_fnc_selectRandom;

spawnmodule = "O_Soldier_F" createVehicleLocal (getMarkerPos _spawn);

spawnmodule setvariable ["LifeZ_Spawn_time",30,true];

spawnmodule setvariable ["LifeZ_Spawn_Number",10,true];

spawnmodule setvariable ["LifeZ_Spawn_move","MOVER",true];

spawnmodule setvariable ["LifeZ_Spawn_pos",position bunker,true];

removeallweapons _x;

[spawnmodule] execVM "core\shaun.sqf";

Share this post


Link to post
Share on other sites
i got the spawn stuff now but when the unit spawn the just stand still and dont even move at all

this is the code i got:

_spawn = ["z1","z2","z3","z4","z5","z6","z7","z8","z9","z10","z11","z12"] call bis_fnc_selectRandom;

spawnmodule = "O_Soldier_F" createVehicleLocal (getMarkerPos _spawn);
spawnmodule setvariable ["LifeZ_Spawn_time",30,true];
spawnmodule setvariable ["LifeZ_Spawn_Number",10,true];
spawnmodule setvariable ["LifeZ_Spawn_move","MOVER",true];
spawnmodule setvariable ["LifeZ_Spawn_pos",position bunker,true];
removeallweapons _x;
[spawnmodule] execVM "core\shaun.sqf";

OK.. I'm going to have to make some guesses here as you haven't told us what you want the spawned unit to do.

My Assumptions.

Reading your script "z1","z2","z3" etc are markers where the unit "spawnmodule" can spawn at.

All the "LifeZ_Spawn_????" must be variables declared elsewhere. They serve no purpose in your spawned script.

You don't specify what shaun.sqf script does.

I assume "bunker" is a markername on your map.

You don't tell us what do you want the spawned unit "spawnmodule" to do?

For example to get "spawnmodule" to move to "bunker" add this to your script.

_grp = group spawnmodule;
wp1 = _grp addWaypoint [getmarkerpos "bunker", 0];
wp1 setWaypointType "MOVE";
wp1 setWaypointSpeed "NORMAL";
wp1 setWaypointBehaviour "AWARE";

This will move spawnmodule unit to the position bunker.

(Although why call the spawned unit "spawnmodule"? Why not call it "_spawnedunit"? Easier to understand the script. Unless "spawnmodule" is used by another script you haven't mentioned.

Share this post


Link to post
Share on other sites

the shaun is a zombie script where it makes the AI to a zombie and can i make them just move around without any waypoints because i just want them to walk around

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  

×