Jump to content
Sign in to follow this  
masterarrow1

Need Basic Scripting help AI respawn and Waypoints

Recommended Posts

Today i decided to try scripting in arma 3 for the first time so i picked up Fockers guide here http://fockers.moonfruit.com/arma-23-scripting/4566406735 and read chapter 1.

So now that ive finished that ive started my first creations and am having a hard time understanding a few of the concepts. Now i know this is extremely basic but i would like some advice in helping me understand it better.

Im trying to create a spawn whether it be at an object or marker and make the move to a specified location. I cannot seem to get the men to move to the specified marker whether it be a doMove, MoveTo, Addwaypoint ive tried fiddling around with it for over and because of my lack of knowledge i have no ide. Heres what i have not including the waypoint portion.

I have in my initialization on my player in the editor addaction ["Spawn USarmy Group" , "Spawnblue.sqf"]'; and in my init.sqf file limit = 0;

_BLU = creategroup west;

sleep 1;

if (limit < 10) then {

hint "Spawning BLUFOR squad";

sleep 0.5;

_newSoldier1 = "rhsusf_army_ocp_squadleader" createUnit [position ARMYSPAWN, _BLU];

_newSoldier2 = "rhsusf_army_ocp_autorifleman" createUnit [position ARMYSPAWN, _BLU];

_newSoldier3 = "rhsusf_army_ocp_rifleman" createUnit [position ARMYSPAWN, _BLU];

_newSoldier4 = "rhsusf_army_ocp_medic" createUnit [position ARMYSPAWN, _BLU];

limit = limit + 1;

hint "Squad Has been Spawned";

} else {

hint "You have reached the Maximum number of squads you may spawn";

};

i've seen Tay_uk's script for arma 2 OA here and i dont quite understand it http://www.armaholic.com/forums.php?m=posts&q=7984

The part i mainly dont understand is the _this select 0; which im assuming is the target and Group leader _unit;

_unit = _this select 0;

_Group = Group leader _unit;

GrpOne = Creategroup east;

_leader = "RU_Soldier_TL"createunit [getmarkerpos"GrponeM",grpone,"",1,"Sergant"];

_Unit2 = "MVD_Soldier"createunit [getmarkerpos"GrponeM",grpone,"",1,"Corporal"];

_Unit3 = "RU_Soldier_SniperH"createunit [getmarkerpos"GrponeM",grpone,"",1,"Corporal"];

_Unit4 = "MVD_Soldier"createunit [getmarkerpos"GrponeM",grpone,"",1,"Corporal"];

_Unit5 = "RUS_Soldier_Marksman"createunit [getmarkerpos"GrponeM",grpone,"",1,"Corporal"];

_Unit6 = "RU_Soldier"createunit [getmarkerpos"GrponeM",grpone,"",1,"Corporal"];

_Unit7 = "RU_Soldier_AT"createunit [getmarkerpos"GrponeM",grpone,"",1,"Corporal"];

_Unit8 = "RU_Soldier_AT"createunit [getmarkerpos"GrponeM",grpone,"",1,"Corporal"];

_waypoint0 = _Group addWaypoint [GetMarkerPos "Patrol", 0];

_waypoint0 setWaypointType "MOVE";

_waypoint1 = _Group addWaypoint [GetMarkerPos "patrol1", 0];

_waypoint1 setWaypointType "Seek and Destroy";

Any advice would be appreciated. I hope im in the correct section of the forums :confused: :yay:

Share this post


Link to post
Share on other sites

In your addWaypoint command, you have _Group, not GrpOne. You are giving the waypoints to yourself (or the parameter that is sent to the script), not the created units.

If you launch with -showScriptErrors, the game will tell you errors.

Also, fockers guide should of covered topics like _this select 0, which selects the first position in the array _this.

If you are calling the script from an addAction attached to yourself (the player), then the array _this consists of [object with action, caller, addaction id]. _this select 0 is selecting the first element in the array, the object with the action attached.

Edited by Fight9

Share this post


Link to post
Share on other sites

The second script is not my work(the link will redirect to it) I was using that as an example but I may have figured out a solution and will try it later.

Share this post


Link to post
Share on other sites

Oh, ok. I guess I was confused. I seem to have skipped over the line, "Heres what i have not including the waypoint portion.".

Be sure to read the rest of Fockers guide. It was invaluable to me when I was first getting started.

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  

×