Jump to content
Sign in to follow this  
xg0ffx

Spawn Unit via a trigger?

Recommended Posts

Hi, ive been looking in the wiki for information on how to and also in the spawn scripts i have found on this site and maybe they are telling me what im trying to find out but i just dont see it. Im trying to figure out how make a unit spawn when a player enters a trigger. I looked at many re-spawn scripts but none that would just spawn a new unit when a trigger was activated. Thanks for the help. crazy_o.gif

Share this post


Link to post
Share on other sites

You can use the createvehicle command, but be advised that it takes a lot of work to alter created units.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_enemy1 = "SoldierEB" createVehicle getpos spawnpoint1

http://community.bistudio.com/wiki/Category:ArmA_Classes

_enemy1 is the assigned local name for the created guy and can only be used in the script it was introduced, you can make it global for all future scripts to use by forgetting the underscore. You can also forget the name and equals sign if you have no intentions to modify the unit. Place a game logic with a name where you want the man to be created.

Unless you're creating increasing hordes of people, I recommend teleporting (setpos) those guys so you have an easier time setting their waypoints and other options.

Share this post


Link to post
Share on other sites

activation: ANYBODY

repeatedly: if you want more than 1

on Acc:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"SoldierWB" createUnit [position player, group player]

if you only want a unit to spawn if the player goes into the trigger add

Condition:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">player in thislist

Share this post


Link to post
Share on other sites

when i do

Quote[/b] ]"SoldierWB" createUnit [position player, group player]
the unit that spawns is on my team, is the factor that changes this the group player? What would i need to change it to make it group as an enemy and not a teammate?

Share this post


Link to post
Share on other sites

the W in "SoldierWB" sets them to West (or US forces). SoldierEB (as in Celery's example) will spawn him to East (SLA forces). SoldierGB ought spawn them to Guerrilla (or RACS) forces, whom you can select who they are friendly to by clicking on intel and setting "Resistance friendly to West / East / Everybody / Nobody" to your desired setting.

Share this post


Link to post
Share on other sites

Well even when i have it set to that the resistance friendly nobody, all they do is walk around and lay down alot. Is it because they join my squad? If thats the case, how do i make it so they dont join my squad?

Share this post


Link to post
Share on other sites

easyway eg: 1

Add another unit in the mission editor and call it s1

then in the trigger ON ACT:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"SoldierWB" createUnit [position s1, s1]

look here to change the class.

eg:2

if you want to create a group from thin air without the inital s1 leader then you will need to create a group first:

put this in a init: of a game logic

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s1_center = createcenter west;s1_group = createGroup s1_center

make another gamelogic where you want the group to be created and name it here

now make the trigger that adds soldiers to the group:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">"SoldierWB" createUnit [position here, s1_group]

If you're a East player and they don't shot at you it's because there were no west units on the map at game

start so put a dummy unit in a far off place that does nothing.

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  

×