jpinard 10 Posted May 12, 2010 If I place an ehntire squad of infantry inside a building, is there a script command I can add to the initialization field to make them stay and defend that structure to the death? Share this post Link to post Share on other sites
Sardaukar17 10 Posted May 12, 2010 I am not a pro but the first thing that comes to mind would be to crate one or 2 Defend waypoints in the building using the editor and a trigger or marker covering basically the floor area of the building that would force a new combat behavioral mode and add a waypoint back into the building should any of the units inside leave. I would set it up as a script activated by the trigger. Not sure if that would work... but I have only been thinking about it while typing here. Hope it helps. Good luck Share this post Link to post Share on other sites
Evil_Echo 11 Posted May 12, 2010 Look at the guard waypoint. That might do the trick for you. Share this post Link to post Share on other sites
Inkompetent 0 Posted May 12, 2010 Wouldn't a Hold waypoint, or disableAI "MOVE" do the job better? With Guard waypoints they can run off, even with a guard-trigger, to engage their target. Share this post Link to post Share on other sites
Beagle 684 Posted May 12, 2010 (edited) Wouldn't a Hold waypoint, or disableAI "MOVE" do the job better? With Guard waypoints they can run off, even with a guard-trigger, to engage their target.Attack is the best defense! Just sitting at a place know to enemies and waiting for the end in form of sem heavy impact is fatalistic and "movielike".Using a "guarded by" trigger and "guard" waypoint makes it more dynamic and interesting to both sides. Edited May 12, 2010 by Beagle Share this post Link to post Share on other sites
Inkompetent 0 Posted May 12, 2010 Definitely. Just depends on the goal of it. If one really wants the soldiers to stay in the building Guard isn't the best of choices. If one wants to just defend the building, but be free to leave it until all known threats are dead, then it is :) Share this post Link to post Share on other sites
galzohar 31 Posted May 12, 2010 If you want to just defend it from the inside, then your best options are: 1. Just place them 1 by 1 with setPosASL (can choose random positions or use probability of presence to have some randomness) and give them a setUnitPos "UP" command so that they don't go prone and clip with the walls. 2. Use UPSMON with the "fortify" parameter. Though you have to make sure the building actually has valid buildingPos positions and that those positions are reachable (if UPSMON succeeds in making them go in there then it means it's working, and most buildings will not cause problems with this). Share this post Link to post Share on other sites
nettrucker 142 Posted May 12, 2010 With a guard waypoint they will engage the enemy and don't stay in the building which you want them to defend. I normally use following code snippet in the units init field to make them stay in a building this setPos ((nearestBuilding this) buildingPos 1); doStop this and I use that command only for single units placed, because in case they are grouped, the AI team leader will give the command to engage enemy units as soon as he detects them. Enterable buildings have various building positions where the units will stay once you assigned a building position in the units init field. Hope that helps a bit. regards Share this post Link to post Share on other sites
galzohar 31 Posted May 12, 2010 The problem with the above command is that some buildings have bad building positions, and while telling the AI to move into those positions will usually work, setPosing then will make them clip with the building (because they are too low, too high or inside a wall) and often die as a result. Also, it's a good idea to only setPos AI/objects on the server in the unit's/object's init line, that is, use if (isServer) then {....}; Share this post Link to post Share on other sites
jpinard 10 Posted May 14, 2010 Thanks, you've given me some great ideas. The reason why I didn't want to use the disablemove command is I want them to be able to take up defensive positions within the structre, and not just stay put to be slaughtered ex. inside an aircraft hangar or the air-traffic control tower. Share this post Link to post Share on other sites
galzohar 31 Posted May 14, 2010 The smartest you can get regarding taking defensive positions is UPSMON with fortify, but even that is very limited, as after all the AI position quality is only as good as the building positions defined by whoever made the building (usually BIS). Share this post Link to post Share on other sites