This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
arma:scripting:pmc_logic1 [2008-04-30 14:56] snakeman added bit more explanation on gamelogic |
arma:scripting:pmc_logic1 [2009-04-10 00:59] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Units on GameLogics ====== | ||
- | **Units on GameLogics** by Snake Man | ||
- | |||
- | This was the very first script I put together, took a look Evolutions makeshilka function and adapted that. This will scan all **gameLogic**s named "**pmc_**?" where the **?** is a number digit ranging from **1** to **10** or more. Then if it finds a match, it runs the functions to create vehicle + soldiers in that gamelogic's grid coordinates position. | ||
- | |||
- | The whole point of this kind of method is that to create this mission, all you need to do is to place your unit/group and then what ever number of gamelogics. When you create gamelogic called "pmc" and then copy paste it around (CTRL-C and then CTRL-V) mission editor automatically creates the "pmc_1"... "pmc_2" and so on. | ||
- | <code> | ||
- | _allvecA = ["UAZ_AGS30","UAZMG","BRDM2","BMP2","ZSU","T72"]; | ||
- | _allvecB = ["UralRepair","UralReammo","UralRefuel","Ural","UralOpen"]; | ||
- | _allvecC = ["Mi17","Mi17_mg"]; | ||
- | |||
- | _PMC_MakeTank = | ||
- | { | ||
- | _myVec = (_allvecA select round random (_maxA - 1)); | ||
- | _vcl = _myVec createVehicle _respawnpoint; | ||
- | _vcl setpos _respawnpoint; | ||
- | _grp = objNull; | ||
- | waitUntil { | ||
- | _grp = createGroup (east); | ||
- | !(isNull _grp); | ||
- | }; | ||
- | |||
- | "SoldierECrew" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierECrew" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierECrew" createUnit [_respawnpoint, _grp]; | ||
- | (units _grp select 0) moveInCommander _vcl; | ||
- | (units _grp select 1) moveInGunner _vcl; | ||
- | (units _grp select 2) moveInDriver _vcl; | ||
- | |||
- | "SquadLeaderE" createUnit [_respawnpoint, _grp]; | ||
- | "TeamLeaderE" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEG" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEMG" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEAT" createUnit [_respawnpoint, _grp]; | ||
- | "TeamLeaderE" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEG" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEMG" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierESniper" createUnit [_respawnpoint, _grp]; | ||
- | |||
- | _grp addWaypoint [_respawnpoint, 200]; | ||
- | [_grp, 0] setWaypointBehaviour "AWARE"; | ||
- | [_grp, 0] setWaypointCombatMode "RED"; | ||
- | [_grp, 0] setWaypointSpeed "FULL"; | ||
- | [_grp, 0] setWaypointFormation "WEDGE"; | ||
- | [_grp, 0] setWaypointType "MOVE"; | ||
- | [_grp, 1] setWaypointType "SENTRY"; | ||
- | }; | ||
- | |||
- | _PMC_MakeGuardInf = | ||
- | { | ||
- | _grp = objNull; | ||
- | waitUntil | ||
- | { | ||
- | _grp = createGroup (east); | ||
- | !(isNull _grp); | ||
- | }; | ||
- | |||
- | "SquadLeaderE" createUnit [_respawnpoint, _grp]; | ||
- | "TeamLeaderE" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEG" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEMG" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEAT" createUnit [_respawnpoint, _grp]; | ||
- | "TeamLeaderE" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEG" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierEMG" createUnit [_respawnpoint, _grp]; | ||
- | "SoldierESniper" createUnit [_respawnpoint, _grp]; | ||
- | |||
- | _grp addWaypoint [_respawnpoint, 500]; | ||
- | [_grp, 0] setWaypointBehaviour "AWARE"; | ||
- | [_grp, 0] setWaypointCombatMode "RED"; | ||
- | [_grp, 0] setWaypointSpeed "FULL"; | ||
- | [_grp, 0] setWaypointFormation "WEDGE"; | ||
- | [_grp, 0] setWaypointType "GUARD"; | ||
- | }; | ||
- | |||
- | // choose new digit for the gamelogic "pmc_*" | ||
- | _a = 1; | ||
- | _p = call compile format["pmc_%1",_a]; | ||
- | |||
- | // loop until we have no gamelogics left, it then should return 0. | ||
- | while {(getpos _p select 0) != 0} do | ||
- | { | ||
- | // debug :) | ||
- | player sidechat format["_p: %1 _a: %2",_p,_a]; | ||
- | |||
- | // the position of our gamelogic | ||
- | _respawnpoint = getPos _p; | ||
- | [] call _PMC_MakeTank; | ||
- | [] call _PMC_MakeGuardInf; | ||
- | |||
- | // add one digit to our gamelogic name. | ||
- | _a = _a + 1; | ||
- | _p = call compile format["pmc_%1",_a]; | ||
- | }; | ||
- | </code> | ||
- | The vehicles come in random type, however soldiers are always the "basic squad" style. |