Jump to content
Sign in to follow this  
jandrews

How to get AI units to move into newly "SPAWNED" buildings from editor??

Recommended Posts

Hello, I have found a nice way to build bases and such with this code...

INIT of the Helipad:

wokka= "Land_Airport_Tower_F" createVehicle position this; deleteVehicle this;

this link will help you with building class names and pictures.

My question is.... other than modules using "site" and "base" or whatever you like to fill this newly spawned base/buildings, I am trying to get AI units to move into these "spawned" buildings with waypoints.

I have tried buildingPos, spawning AI units in the buildings however since they are spawned in, its difficult to place correctly, there are no ID markers since its spawned in....So I am at a holding point.

Ideas? Thanks in advance.

Share this post


Link to post
Share on other sites

You've tried something like this?

_house = createVehicle ["Land_Airport_Tower_F", getPos [color=#ff0000]myPos[/color], [], 0, "CAN_COLLIDE"];
[color=#ff0000]_grp[/color] = [getPos [color=#ff0000]mySpawnPos[/color], WEST, (configFile >>  "CfgGroups" >> "West" >> "BLU_F" >> "Infantry"  >> "BUS_InfTeam")] call BIS_fnc_spawnGroup;

sleep 1;

_wp = [color=#ff0000]_grp[/color] addWaypoint [getPos [color=#ff0000]_house[/color], 0];
_wp setWaypointType "MOVE";
_wp setWaypointStatements ["true", ""];
_wp setWaypointCombatMode "blue";
_wp setWaypointBehaviour "Aware";
[color=#008000]_wp setWaypointHousePosition 1;[/color]

Edited by Iceman77

Share this post


Link to post
Share on other sites
You've tried something like this?

_house = createVehicle ["Land_Airport_Tower_F", getPos [color=#ff0000]myPos[/color], [], 0, "CAN_COLLIDE"];
[color=#ff0000]_grp[/color] = [getPos [color=#ff0000]mySpawnPos[/color], WEST, (configFile >>  "CfgGroups" >> "West" >> "BLU_F" >> "Infantry"  >> "BUS_InfTeam")] call BIS_fnc_spawnGroup;

sleep 1;

_wp = [color=#ff0000]_grp[/color] addWaypoint [getPos [color=#ff0000]_house[/color], 0];
_wp setWaypointType "MOVE";
_wp setWaypointStatements ["true", ""];
_wp setWaypointCombatMode "blue";
_wp setWaypointBehaviour "Aware";
[color=#008000]_wp setWaypointHousePosition 1;[/color]

does this go into the Act box on waypoint? I can try it when I get home. thanks for your help

Share this post


Link to post
Share on other sites

Hello, I have interest on this.

Andrews, you better use this in a script or on act of a trigger. Did it work? I suppose yes.

Iceman, what about existing buildings. For example, I want scriped waypoints for several units in different groups on the same building, so doing it via editor would be extremely messy.

So if this method Works, Placing a logic in the building, creating a waypoint position logic, and setWaypointHousePosition could be the solution.

Thanks in advance

Share this post


Link to post
Share on other sites

I tried this code in waypoint Act line and it said variable error. However, when messing around with my newly spawned HQ, I placed unit waypoint directly over object to "get in" and every time he enters the HQ like he knows what he is suppose to do. weird.

Share this post


Link to post
Share on other sites

I did a little testing and the code seems to be missing the last line.

_wp waypointAttachObject _house;

Share this post


Link to post
Share on other sites

Ok, so is this the way it should look? (below) Now I presume I can change "Land_Airport_Tower_F", "West" "BLU_F", I guess I was going to use team leader or officer and combatmode color, all going in Act line of waypoint? thanks for your efforts too guys. This stuff is about my pay grade.

_house = createVehicle ["Land_Airport_Tower_F", getPos myPos, [], 0, "CAN_COLLIDE"];

_grp = [getPos mySpawnPos, WEST, (configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfTeam")] call BIS_fnc_spawnGroup;

sleep 1;

_wp = _grp addWaypoint [getPos _house, 0];

_wp setWaypointType "MOVE";

_wp setWaypointStatements ["true", ""];

_wp setWaypointCombatMode "blue";

_wp setWaypointBehaviour "Aware";

_wp setWaypointHousePosition 1;

_wp waypointAttachObject _house;

I wanted to change it to an AAF officer. EAST, WEST, ?? what are the AAF?

Edited by JAndrews1

Share this post


Link to post
Share on other sites

I am experiencing a weird thing.

While spawning in New buildings, my AI are shooting at these buildings, I cannot figure out why or how to avoid this. Is there a script I can place in the buildings init box to make them friendly to opfor? I just need opfor to stop blowing these buildings up. they are mostly the HQ, cargo house/patrol buildings.

Any help is grateful. this is really a pain in the azz.

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  

×