swoop 15 Posted July 25, 2007 If I use the editor to create a group of infantry with a manned ural, all in the same group, and set a single waypoint "GUARD" then when an enemy is detected by another unit this unit Ive created will all jump in the ural, drive off to the contact, unload and engage. If I try the same using a script: Quote[/b] ]code sample;AI spawn script group1 = createGroup east _ural= "URAL" createVehicle (getPos ai), group1; ~2 "SoldierEB" createunit [position ai,group1,"driver1 = this", 1, "PRIVATE"]; ~2 "SoldierEB" createunit [position ai,group1,"driver2 = this", 1, "PRIVATE"]; ~2 driver1 moveinDriver _ural; _waypoint0 = group1 addWaypoint [getMarkerPos "wp", 0] _waypoint0 setWaypointType "GUARD" then when contact is made they dont get in the truck, they just walk very slowly towards the contact. I don't want to script the loading and unloading, I want to use the hard coded wonders of the "GUARD" waypoint. Â Um.....help? Share this post Link to post Share on other sites
norrin 9 Posted July 27, 2007 Swoop this is a spawning reinforcement script in sqf format that I've written for a mission I'm currently in the process of putting together that may help. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">/* SPAWNING REINFORCEMENT SCRIPT © JULY 2007 - norrin (norrins_nook@iprimus.com.au) =================================================================================== begin reinforce_1.sqf */ if (!local server) exitWith {}; _marker_1 = getMarkerPos "reinforce_1"; _grp_rein_1 = createGroup east; truck_1 = "UralCivil2" createVehicle _marker_1, _grp_rein_1; truck_1 setdir (180); vcl_1 = nearestObject [_marker_1, "LAND"]; sleep 0.2; _civ_1 = "Civilian" createUnit [(_marker_1), _grp_rein_1, "civ_m_1 = this"]; removeallweapons this; civ_m_1 addMagazine "30Rnd_545x39_AK"; civ_m_1 addMagazine "30Rnd_545x39_AK"; civ_m_1 addMagazine "30Rnd_545x39_AK"; civ_m_1 addMagazine "30Rnd_545x39_AK"; civ_m_1 addweapon "AK74"; sleep 0.2; civ_m_1 moveInDriver vcl_1; _civ_2 = "Civilian5" createUnit [(_marker_1), _grp_rein_1, "civ_m_2 = this"]; removeallweapons this; civ_m_2 addMagazine "30Rnd_545x39_AK"; civ_m_2 addMagazine "30Rnd_545x39_AK"; civ_m_2 addMagazine "30Rnd_545x39_AK"; civ_m_2 addMagazine "30Rnd_545x39_AK"; civ_m_2 addweapon "AK74"; sleep 0.2; civ_m_2 moveInCargo vcl_1; _civ_3 = "Civilian5" createUnit [(_marker_1), _grp_rein_1, "civ_m_3 = this"]; removeallweapons this; civ_m_3 addMagazine "30Rnd_545x39_AK"; civ_m_3 addMagazine "30Rnd_545x39_AK"; civ_m_3 addMagazine "30Rnd_545x39_AK"; civ_m_3 addMagazine "30Rnd_545x39_AK"; civ_m_3 addweapon "AK74"; sleep 0.2; civ_m_3 moveInCargo vcl_1; _civ_4 = "Civilian8" createUnit [(_marker_1), _grp_rein_1, "civ_m_4 = this"]; removeallweapons this; civ_m_4 addMagazine "30Rnd_545x39_AK"; civ_m_4 addMagazine "30Rnd_545x39_AK"; civ_m_4 addMagazine "30Rnd_545x39_AK"; civ_m_4 addMagazine "30Rnd_545x39_AK"; civ_m_4 addweapon "AK74"; sleep 0.2; civ_m_4 moveInCargo vcl_1; _civ_5 = "Civilian12" createUnit [(_marker_1), _grp_rein_1, "civ_m_5 = this"]; removeallweapons this; civ_m_5 addMagazine "30Rnd_545x39_AK"; civ_m_5 addMagazine "30Rnd_545x39_AK"; civ_m_5 addMagazine "30Rnd_545x39_AK"; civ_m_5 addMagazine "30Rnd_545x39_AK"; civ_m_5 addweapon "AK74"; sleep 0.2; civ_m_5 moveInCargo vcl_1; _civ_6 = "Civilian15" createUnit [(_marker_1), _grp_rein_1, "civ_m_6 = this"]; removeallweapons this; civ_m_6 addMagazine "30Rnd_545x39_AK"; civ_m_6 addMagazine "30Rnd_545x39_AK"; civ_m_6 addMagazine "30Rnd_545x39_AK"; civ_m_6 addMagazine "30Rnd_545x39_AK"; civ_m_6 addweapon "AK74"; sleep 0.2; civ_m_6 moveInCargo vcl_1; sleep 0.2; _grp_rein_1 setBehaviour "SAFE"; _grp_rein_1 move getMarkerPos "re_1_WP1"; waitUntil {(vcl_1 distance getMarkerPos "re_1_WP1") < 15}; sleep 1; {unAssignVehicle _x} forEach units _grp_rein_1; sleep 1; {doGetOut _x} forEach units _grp_rein_1; sleep 5; _grp_rein_1 setBehaviour "AWARE"; _waypoint1 = _grp_rein_1 addWaypoint [mkr_crew, 0]; _waypoint1 setWaypointType "SAD"; sleep 2; if(true) exitWith {}; The truck and the units spawn and then the units are placed on the truck. The truck then moves to a marker (re_1_WP1) using the doMove command (but I could've used addwaypoint here), the units then dismount and continue onto another marker (mkr_crew) using the addwaypoint command by foot. Share this post Link to post Share on other sites
swoop 15 Posted July 27, 2007 Thats nice, ta for the help, only thing is.....I notice in your script youre using a "moveincargo" command. I dont want the troops spawned to spawn in cargo, only the vehicle driver. Trouble is, leaving the "moveincargo" command out causes them to NEVER get in a vehicle. Share this post Link to post Share on other sites
-)rStrangelove 0 Posted July 27, 2007 To let them getin with animation, this could work: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> {_x assignascargo truck_1} foreach units <groupX>; units <groupX> ordergetin true; Share this post Link to post Share on other sites
swoop 15 Posted July 27, 2007 ta for the reply but that still makes them get in the truck at the start of the mission. Lemme give ya some background....... I've made this mission with the absolute maximum number of groups, large groups. At last count there were 3000+ enemy soldiers on the map. And it actually runs in multiplayer, it's a slide show for the first 30 seconds after launch as the AI settles down and then it's playable. I've managed this by a) spreading out the AI all over Sahrani and b) making sure not that many of em actually move at once, cos ArmA doesnt send out updates to clients for units that havn't changed in state at all. however, certain people with slower systems have complained about lag, especially during firefights. Therefore, what I want to do is replace a lot of the units with a spawn script that'll trigger when players get close ish. The mission works by major use of the GUARD waypoint. If you use the in game editor to create a group of infantry with a manned truck and give them a guard waypoint, then when an enemy unit is spotted by either themselves or another unit this group of infantry will load up into the truck, drive to vaguely near the contact, disembark and go on a hunt. The GUARD waypoint is hard coded and is the greatest thing ever cos it means the AI doesn't have to be scripted in any way. However, when I use the script shown in post 1, it all works fine except now they wont get in the truck. If I spawn them in the truck then everything works fine, they'll drive to a contact, disembark and go hunting as normal. But then it makes it much easier for players to sneak past them (or blow the truck with an RPG, etc). Share this post Link to post Share on other sites
swoop 15 Posted July 27, 2007 Had a brainwave then but found another problem. What I could do is spawn them from a trigger when BLUFOR enters the area. And from a 2nd trigger (BLUFOR detected by OPFOR) I can then script them getting in the truck and issuing a GUARD waypoint. However.....what that means is it's possible for BLUFOR to get close to the truck, OPFOR spots them....and instead of engaging OPFOR would get in the truck. Share this post Link to post Share on other sites
norrin 9 Posted July 28, 2007 Ignore this if you've already tried it but Swoop have you tried synchronizing a trigger and a "getIn" waypoint so that when a certain condition is met the spawned units in guard mode get on the vehicle before moving to the next waypoint? If you haven't already you can read a little more about the getIn waypoint (about 2/3 of the way down the page) and synchronizing (almost at the bottom the page) here: http://community.bistudio.com/wiki/ArmA:_Mission_Editor . Share this post Link to post Share on other sites
swoop 15 Posted July 28, 2007 *sigh* For anyone else having this issue here's the answer....and it's so simple, a command I was missing: x AssignAsCargo x eg driver2 AssignAsCargo _ural Now they load and unload just fine. Share this post Link to post Share on other sites