Kabolte 10 Posted July 3, 2009 I'm making a free roam map, and I want to create a patrol when I enter an area. Right now I have a trigger and one unit but I can't figure out how to make the unit spawn when I enter the trigger. I'm an independent guerrilla and I have the trigger set to independent present. What do I need to put in the Activation field and the condition of presence for the patrol unit? Share this post Link to post Share on other sites
Kabolte 10 Posted July 5, 2009 Can anyone help me out? Share this post Link to post Share on other sites
TurokGMT 0 Posted July 5, 2009 1. place an enemy unit on the map and set it's probability of existance to 0 (this is used to setup an enemy "HQ" which is necessary for groups to be created. 2. place the functions module anywhere on the map, no need to sync it to the player or anything else. 3. put gamelogic unit on the map which will act as a spawn location for the enemy. give it a name eg troops. 4. in the on activation field of your trigger, use the spawn group function: [<position>,<side>,<number of units>] call bis_fnc_spawngroup; so if you want 30 east dudes to spawn, you'd write: [(getpos troops),east,30] call bis_fnc_spawngroup; enjoy Share this post Link to post Share on other sites
Kabolte 10 Posted July 5, 2009 (edited) Cool, thanks! edit: How can I delete them? Edited July 5, 2009 by Kabolte Share this post Link to post Share on other sites
TurokGMT 0 Posted July 6, 2009 the spawning function returns the group, so if you do something like this on spawn: dudes = [(getpos troops),east,30] call bis_fnc_spawngroup; you have created a group called dude. To delete them use deletegroup dudes; Share this post Link to post Share on other sites
dale0404 5 Posted July 7, 2009 Gents, I want to spawn not just infantry but also Armour and maybe Air assets using this, is it possible and if so how? Please Also, once they are spawned I want them to move around, ie follow waypoints. Is there a way to do this also? Thanks Dale Share this post Link to post Share on other sites
doford 10 Posted July 7, 2009 This is from a thread that has help me understand how to spawn units and create waypoints: This code creates a usmc ahiz (with pilots) to search and destroy around the player GroupAlpha1 = CreateGroup West; Helo1 = createVehicle ["AH1Z", [(getMarkerPos "Startingpoint") select 0,(getMarkerPos "Startingpoint") select 1,100], [], 0, "FLY"]; HeliPilot1 = GroupAlpha1 createUnit ["USMC_Soldier_Pilot", [0,0,1], [], 0, "CAN_COLLIDE"]; HeliPilot1 moveInDriver Helo1; HeliPilot2 = GroupAlpha1 createUnit ["USMC_Soldier_Pilot", [0,0,2], [], 0, "CAN_COLLIDE"]; HeliPilot2 moveIncargo Helo1; wp12 = GroupAlpha1 addwaypoint [position player, 0]; wp12 setwaypointtype "SAD"; Change parts of the code to fit whatever you want. GroupAlpha1 is the group name you're creating Helo1 is the name of the created ah1z Startingpoint is the name of a marker you have to place helipilot1 is the name of the pilot "USMC_Soldier_Pilot" change this for whatever unit you want spawned "AH1Z" change for different vehicles [0,0,1] I think this is the units position in the group. With waypoints you can change "player" for the name of a object or marker. I'm guessing you can use a grid referance too. I'll have to try that. These are the names of different waypoint types http://community.bistudio.com/wiki/setWaypointType And check out the sticky for classnames so you can have whatever you need spawn. You can also use commands like unitname moveinCargo [vehiclename, 2]; This spawns a unit in the back of a vehicle. 2 is the position in the vehicle. 0 is the driving position or Unitname moveinGunner [vehiclename, 1] Adds a gunner unitname setunitrank Lieutenant; To change the units rank And it goes on and on... Share this post Link to post Share on other sites
dale0404 5 Posted July 8, 2009 Brilliant, thx mate. Share this post Link to post Share on other sites
Apocca 10 Posted July 8, 2009 (edited) What about for setting their skill? If you spawn serveral groups at the same time, will something like Group1 SetSkill 0.1 still work? Wouldn't that only count for the first spawned group? Their skill seems to be maxed. And what about a way to make all enemy units move for the player location at all times? Edited July 8, 2009 by Apocca Share this post Link to post Share on other sites
Apocca 10 Posted July 9, 2009 Bump. Still can't get it working. Their skill is far too high. They target and kill in less than a second from 400m distance, with almost 100% accuracy :mad: Share this post Link to post Share on other sites
Carpaazi 0 Posted July 9, 2009 Question: How could i make the spawned patrol to be deleted after a couple minutes they have been killed? Share this post Link to post Share on other sites
Apocca 10 Posted July 9, 2009 This is driving me nuts. All enemies with 1.0 skill is ridiculous! How do i add skill to the spawn code??? Can't do any progress in my mission until this is fixed. Share this post Link to post Share on other sites
Kabolte 10 Posted July 10, 2009 Hmm try something like {setSkill 0.1} forEach units yourgroup; Not sure if that will work or not, as I'm not the most experienced scripter, but just play around with that. Share this post Link to post Share on other sites
Daveyboy154 10 Posted July 26, 2009 I came accross this thread while searching, just in case anyone is still looking for the answer you can use "{_x setSkill 0.5} foreach units groupname;" I'm not 100% on this, but i'm not getting any RPT errors so I guess it works... Dave Share this post Link to post Share on other sites
Doggolainen 10 Posted July 29, 2009 (edited) Bumping this thread a bit. The "deleteGroup" doesnt seem to work. I name it and try to delete it on a trigger, but wont get it to work somehow :S Any clues? Trigger1: hint "You have been detected, take cover!"; troops1 = [(getpos troopSpawn1),east,1] call bis_fnc_spawngroup; Trigger2: deleteGroup troops1; hint "You are no longer detected!" Edited July 29, 2009 by Doggolainen Share this post Link to post Share on other sites
nullsystems 0 Posted July 29, 2009 I tried executing the createUnit/Vehicle script from a trigger. Nothing happened at all. Odd. No matter what "createUnit" style of code I use, no units are ever created in the editor. Share this post Link to post Share on other sites