I think you will have to put all the regions when you want enemy units to spawn into an array. Then use the Random Integer function to select an array index to get a region.
Each second a zealot gets spawned into one of the 3 regions. Done using a Region array combined with Random Integer.
----
I'm glad to see that choosing random regions is fairly simple, would it be possible to see an example of also placing a random unit?
There's a map on this site that does place a random unit, but I really think it's a lot more complicated than it needs to be.
I need to create a enemy unit is a random region(1-8).
I think you will have to put all the regions when you want enemy units to spawn into an array. Then use the Random Integer function to select an array index to get a region.
you can merge those regions with Edit>Merge Selection, than with the create unit trigger change the region field to random point in region.
http://sc2.grum.nl/randomspawn.SC2Map
Did this example map for someone else.
Each second a zealot gets spawned into one of the 3 regions. Done using a Region array combined with Random Integer.
Yeah i did that by combining a RandomInt fuction and the list of regions.
I created a function called "Random region" working like that:
· Get a random integer
· If random int value=1 -> return region 1
· if random int value=2 -> return region 2
·.............
· In any other case, return region x (the last region you want)
----------------I'm working in a function to avoid creating unit in a region that have some unit inside.
Is like this:
· Get a random region by the upper method
· for(i=0; i<num of units; i) (for each integer..)
{
if (position of unit[i] == random point at random region)
return false;
}
return true;
This will return true if the region is completely empty of the unit you have in the array.
Anybody know other method for checking if the region is already with units?
I get this when I try to save
Script failed to compile: Syntax error (See Trigger Editor for more details) line 21
with this highlighted:: region[9] gv_;
http://i422.photobucket.com/albums/pp306/EpicurusDarwin/prob02.png
http://i422.photobucket.com/albums/pp306/EpicurusDarwin/prob01.png
http://i422.photobucket.com/albums/pp306/EpicurusDarwin/prob03.png
Also, can I use those two setup triggers to create multiple attack triggers?
Maybe give your variable a NAME? >_>
@Eldrazor: Go
+1 for you -1 for my intelligence
thanks
Quote from grum:
http://sc2.grum.nl/randomspawn.SC2Map
Did this example map for someone else.
Each second a zealot gets spawned into one of the 3 regions. Done using a Region array combined with Random Integer.
----
I'm glad to see that choosing random regions is fairly simple, would it be possible to see an example of also placing a random unit?
There's a map on this site that does place a random unit, but I really think it's a lot more complicated than it needs to be.
EDIT: Nevermind, I managed to figure it out, and it was as simple as I hoped.
If anyone else is curious though, PM and I'll send you my test map.
@KerenskyLI: Go
Updated my map to also spawn random units; http://sc2.grum.nl/randomspawn.SC2Map
I have gotten the same problem and still cant figure it out
@Arthur2120: Go
can you post the trigger you are using so we could help =)
@Molsterr: Go
This? Also the highlighted line was "unit[3] gv_;"
================================================================================================== Generated Map Script Name: Ghost Commando Author: GeneralTalon ================================================================================================== include "TriggerLibs/NativeLib"
--------------------Library Initialization-------------------- void InitLibs () { libNtve_InitLib(); }--------------------Global Variables-------------------- unit[3] gv_; fixed gv_; fixed gv_; bool[3] gv_; bool[3] gv_; bool[3] gv_; bool[3] gv_; fixed gv_; bool[3] gv_; int gv_; int[3] gv_; bool[3] gv_; bool[3] gv_; bool[3] gv_; unit[3] gv_; point[3] gv_;void InitGlobals () { int init_i;
init_i = 0; while (init_i <= 2) { gv_[init_i] = null; init_i = init_i + 1; } gv_ = 4.0; gv_ = 1.1; init_i = 0; while (init_i <= 2) { gv_[init_i] = false; init_i = init_i + 1; } init_i = 0; while (init_i <= 2) { gv_[init_i] = false; init_i = init_i + 1; } init_i = 0; while (init_i <= 2) { gv_[init_i] = false; init_i = init_i + 1; } init_i = 0; while (init_i <= 2) { gv_[init_i] = false; init_i = init_i + 1; } gv_ = 0.8; init_i = 0; while (init_i <= 2) { gv_[init_i] = false; init_i = init_i + 1; } gv_ = 12; init_i = 0; while (init_i <= 2) { gv_[init_i] = gv_; init_i = init_i + 1; } init_i = 0; while (init_i <= 2) { gv_[init_i] = false; init_i = init_i + 1; } init_i = 0; while (init_i <= 2) { gv_[init_i] = false; init_i = init_i + 1; } init_i = 0; while (init_i <= 2) { gv_[init_i] = false; init_i = init_i + 1; } init_i = 0; while (init_i <= 2) { gv_[init_i] = null; init_i = init_i + 1; } init_i = 0; while (init_i <= 2) { gv_[init_i] = null; init_i = init_i + 1; } }
--------------------Global Function Declarations-------------------- void gf_Traceline (int lp_);--------------------Trigger Variables-------------------- trigger gt_MapInitialization; trigger gt_SetEnemyUnitHeight; trigger gt_Victory; trigger gt_Defeat; trigger gt_RotateCamera; trigger gt_Shoot; trigger gt_CooldownAttack; trigger gt_Reload; trigger gt_PressRReload; trigger gt_Zoom; trigger gt_Unzoom; trigger gt_PressW; trigger gt_ReleaseW; trigger gt_PressA; trigger gt_ReleaseA; trigger gt_PressS; trigger gt_ReleaseS; trigger gt_PressD; trigger gt_ReleaseD; trigger gt_MovePlayerUnit; trigger gt_PressFFlashlight;--------------------Global Functions-------------------- void gf_Traceline (int lp_) { fixed auto60E39A1C_as; fixed auto60E39A1C_ae; fixed auto60E39A1C_ai;Variable Declarations int lv_; fixed lv_; fixed lv_; fixed lv_; fixed lv_; fixed lv_; point lv_; region lv_; fixed lv_; unit lv_; fixed lv_;
Variable Initialization lv_ = 100; lv_ = CameraGetYaw(lp_); lv_ = CameraGetPitch(lp_); lv_ = (WorldHeight(c_heightMapGround, UnitGetPosition(gv_[lp_])) + gv_); lv_ = 0.0; lv_ = 0.0; lv_ = null; lv_ = null; lv_ = 0.0; lv_ = null; lv_ = 0.0;
Implementation auto60E39A1C_as = 0.0; auto60E39A1C_ae = IntToFixed(lv_); auto60E39A1C_ai = 0.1; lv_ = auto60E39A1C_as; if (auto60E39A1C_ai > 0 || (auto60E39A1C_ai == 0 && auto60E39A1C_as < auto60E39A1C_ae)) { while (lv_ <= auto60E39A1C_ae) { if ((lv_ < 90.0)) { lv_ = (Tan(lv_) * (lv_ * -1.0)); } else { if ((lv_ > 270.0)) { lv_ = (Tan((360.0 - lv_)) * lv_); } else { } } lv_ = PointWithOffsetPolar(UnitGetPosition(gv_[lp_]), lv_, lv_); lv_ = RegionCircle(lv_, 0.3); lv_ = WorldHeight(c_heightMapGround, lv_); lv_ = libNtve_gf_ClosestUnitToPoint(lv_, UnitGroup(null, 15, lv_, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0)); lv_ = WorldHeight(c_heightMapGround, UnitGetPosition(lv_)); gv_[lp_] = null; gv_[lp_] = null; if (((lv_ != null) && (AbsF((lv_ + (lv_ - lv_))) >= 0.0) && (AbsF((lv_ + (lv_ - lv_))) <= UnitGetCustomValue(lv_, 0)))) { gv_[lp_] = lv_; return ; } else { if ((AbsF((lv_ + lv_)) <= WorldHeight(c_heightMapGround, lv_))) { gv_[lp_] = lv_; return ; } else { } } lv_ = lv_ + auto60E39A1C_ai; } } else if (auto60E39A1C_ai < 0 || (auto60E39A1C_ai == 0 && auto60E39A1C_ae < auto60E39A1C_as)) { while (lv_ >= auto60E39A1C_ae) { if ((lv_ < 90.0)) { lv_ = (Tan(lv_) * (lv_ * -1.0)); } else { if ((lv_ > 270.0)) { lv_ = (Tan((360.0 - lv_)) * lv_); } else { } } lv_ = PointWithOffsetPolar(UnitGetPosition(gv_[lp_]), lv_, lv_); lv_ = RegionCircle(lv_, 0.3); lv_ = WorldHeight(c_heightMapGround, lv_); lv_ = libNtve_gf_ClosestUnitToPoint(lv_, UnitGroup(null, 15, lv_, UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0)); lv_ = WorldHeight(c_heightMapGround, UnitGetPosition(lv_)); gv_[lp_] = null; gv_[lp_] = null; if (((lv_ != null) && (AbsF((lv_ + (lv_ - lv_))) >= 0.0) && (AbsF((lv_ + (lv_ - lv_))) <= UnitGetCustomValue(lv_, 0)))) { gv_[lp_] = lv_; return ; } else { if ((AbsF((lv_ + lv_)) <= WorldHeight(c_heightMapGround, lv_))) { gv_[lp_] = lv_; return ; } else { } } lv_ = lv_ + auto60E39A1C_ai; } } }
--------------------Trigger: Map Initialization-------------------- bool gt_MapInitialization_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }GameSetSpeedValue(c_gameSpeedNormal); TriggerExecute(gt_SetEnemyUnitHeight, false, false); gv_[1] = UnitFromId(4); gv_[2] = UnitFromId(401); libNtve_gf_SetPlayerGroupAlliance(PlayerGroupActive(), 1); if ((PlayerStatus(1) != c_playerStatusActive)) { UnitRemove(gv_[1]); } else { } if ((PlayerStatus(2) != c_playerStatusActive)) { UnitRemove(gv_[2]); } else { } PlayerGroupLoopBegin(PlayerGroupActive()); while (!PlayerGroupLoopDone()) { VisRevealerCreate(PlayerGroupLoopCurrent(), RegionPlayableMap()); PlayerGroupLoopStep(); } PlayerGroupLoopEnd(); UIDisplayMessage(PlayerGroupAll(), c_messageAreaSubtitle, StringExternal("Param/Value/9EC610A6")); PlayerGroupLoopBegin(PlayerGroupActive()); while (!PlayerGroupLoopDone()) { CameraForceMouseRelative(PlayerGroupLoopCurrent(), true); CameraSetMouseRotates(PlayerGroupLoopCurrent(), true); CameraUseHeightDisplacement(PlayerGroupLoopCurrent(), false); CameraUseHeightSmoothing(PlayerGroupLoopCurrent(), false); CameraPan(PlayerGroupLoopCurrent(), UnitGetPosition(gv_[PlayerGroupLoopCurrent()]), 0.0, -1, 0, false); CameraFollowUnitGroup(PlayerGroupLoopCurrent(), libNtve_gf_ConvertUnitToUnitGroup(gv_[PlayerGroupLoopCurrent()]), true, false); CameraSetValue(PlayerGroupLoopCurrent(), c_cameraValueYaw, UnitGetFacing(gv_[PlayerGroupLoopCurrent()]), 0.0, -1, 10); CameraSetValue(PlayerGroupLoopCurrent(), c_cameraValuePitch, 0.0, 0.0, -1, 0); CameraSetValue(PlayerGroupLoopCurrent(), c_cameraValueDistance, gv_, 0.0, -1, 0); CameraSetValue(PlayerGroupLoopCurrent(), c_cameraValueHeightOffset, gv_, 0.0, -1, 0); libNtve_gf_HideGameUI(false, PlayerGroupAll()); libNtve_gf_DisplayBossBar(PlayerGroupLoopCurrent(), "Assets
Textures
icon-health-protoss.dds", StringExternal("Param/Value/60D72290"), 100, PlayerGroupSingle(PlayerGroupLoopCurrent())); libNtve_gf_SetBossBarBoss(PlayerGroupLoopCurrent(), gv_[PlayerGroupLoopCurrent()], true); libNtve_gf_SetBossBarRace(PlayerGroupLoopCurrent(), 0, true); libNtve_gf_MoveBossBar(PlayerGroupLoopCurrent(), c_anchorTopLeft, 20, 20); libNtve_gf_DisplayBossBar((PlayerGroupLoopCurrent() + 2), "Assets
Textures
icon-gas.dds", StringExternal("Param/Value/86E28E3A"), 100, PlayerGroupSingle(PlayerGroupLoopCurrent())); libNtve_gf_SetBossBarMaximumValue((PlayerGroupLoopCurrent() + 2), gv_, true); libNtve_gf_SetBossBarCurrentValue((PlayerGroupLoopCurrent() + 2), gv_[PlayerGroupLoopCurrent()], true); libNtve_gf_SetBossBarRace((PlayerGroupLoopCurrent() + 2), 0, true); libNtve_gf_MoveBossBar((PlayerGroupLoopCurrent() + 2), c_anchorTopRight, 20, 20); libNtve_gf_DisplayScreenImage(1, "Assets
Textures
btn-border-protoss-normal.dds", c_triggerBlendModeAdd, 32, 32, c_anchorCenter, 0, 0); PlayerGroupLoopStep(); } PlayerGroupLoopEnd(); return true; }
-------------------- void gt_MapInitialization_Init () { gt_MapInitialization = TriggerCreate("gt_MapInitialization_Func"); TriggerAddEventMapInit(gt_MapInitialization); }--------------------Trigger: Set Enemy Unit Height-------------------- bool gt_SetEnemyUnitHeight_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }UnitGroupLoopBegin(UnitGroupAlliance(1, c_unitAllianceEnemy, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0)); while (!UnitGroupLoopDone()) { if ((UnitGetType(UnitGroupLoopCurrent()) == "Zergling")) { UnitSetCustomValue(UnitGroupLoopCurrent(), 0, 0.5); } else { if ((UnitGetType(UnitGroupLoopCurrent()) == "Baneling")) { UnitSetCustomValue(UnitGroupLoopCurrent(), 0, 0.7); } else { if ((UnitGetType(UnitGroupLoopCurrent()) == "Hydralisk")) { UnitSetCustomValue(UnitGroupLoopCurrent(), 0, 1.5); } else { if ((UnitGetType(UnitGroupLoopCurrent()) == "Ultralisk")) { UnitSetCustomValue(UnitGroupLoopCurrent(), 0, 6.2); } else { } } } } UnitGroupLoopStep(); } UnitGroupLoopEnd(); return true; }
-------------------- void gt_SetEnemyUnitHeight_Init () { gt_SetEnemyUnitHeight = TriggerCreate("gt_SetEnemyUnitHeight_Func"); TriggerEnable(gt_SetEnemyUnitHeight, false); }--------------------Trigger: Victory-------------------- bool gt_Victory_Func (bool testConds, bool runActions) {Conditions if (testConds) { if (!(((UnitGetOwner(EventUnit()) == 15) && (UnitGroupCount(UnitGroupAlliance(c_playerAny, c_unitAllianceEnemy, RegionEntireMap(), UnitFilter(0, 0, (1 << c_targetFilterMissile), (1 << (c_targetFilterDead - 32)) | (1 << (c_targetFilterHidden - 32))), 0), c_unitCountAlive) == 0)))) { return false; } }Actions if (!runActions) { return true; }
Wait(1.5, c_timeReal); PlayerGroupLoopBegin(PlayerGroupActive()); while (!PlayerGroupLoopDone()) { GameOver(PlayerGroupLoopCurrent(), c_gameOverVictory, true, false); PlayerGroupLoopStep(); } PlayerGroupLoopEnd(); return true; }
-------------------- void gt_Victory_Init () { gt_Victory = TriggerCreate("gt_Victory_Func"); TriggerAddEventUnitDied(gt_Victory, null); }--------------------Trigger: Defeat-------------------- bool gt_Defeat_Func (bool testConds, bool runActions) {Conditions if (testConds) { if (!((EventPlayer() != 15))) { return false; } }Actions if (!runActions) { return true; }
Wait(3.0, c_timeReal); PlayerGroupLoopBegin(PlayerGroupActive()); while (!PlayerGroupLoopDone()) { GameOver(PlayerGroupLoopCurrent(), c_gameOverDefeat, true, false); PlayerGroupLoopStep(); } PlayerGroupLoopEnd(); return true; }
-------------------- void gt_Defeat_Init () { gt_Defeat = TriggerCreate("gt_Defeat_Func"); TriggerAddEventUnitDied(gt_Defeat, UnitRefFromVariable("gv_[1]")); TriggerAddEventUnitDied(gt_Defeat, UnitRefFromVariable("gv_[2]")); }--------------------Trigger: Rotate Camera-------------------- bool gt_RotateCamera_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }PlayerGroupLoopBegin(PlayerGroupActive()); while (!PlayerGroupLoopDone()) { UnitSetFacing(gv_[PlayerGroupLoopCurrent()], CameraGetYaw(PlayerGroupLoopCurrent()), 0.2); PlayerGroupLoopStep(); } PlayerGroupLoopEnd(); return true; }
-------------------- void gt_RotateCamera_Init () { gt_RotateCamera = TriggerCreate("gt_RotateCamera_Func"); TriggerAddEventTimePeriodic(gt_RotateCamera, 0.1, c_timeGame); }--------------------Trigger: Shoot-------------------- bool gt_Shoot_Func (bool testConds, bool runActions) {Conditions if (testConds) { if (!(((UnitIsAlive(gv_[EventPlayer()]) == true) && (gv_[EventPlayer()] == false) && (gv_[EventPlayer()] > 0) && (gv_[EventPlayer()] == false) && (gv_[EventPlayer()] == false) && (gv_[EventPlayer()] == false) && (gv_[EventPlayer()] == false)))) { return false; } }Actions if (!runActions) { return true; }
gv_[EventPlayer()] = true; TriggerExecute(gt_CooldownAttack, false, false); gv_[EventPlayer()]=gv_[EventPlayer()] - 1; libNtve_gf_SetBossBarCurrentValue((EventPlayer() + 2), gv_[EventPlayer()], true); if ((gv_[EventPlayer()] == 0)) { gv_[EventPlayer()] = true; TriggerExecute(gt_Reload, false, false); } else { } libNtve_gf_PlayAnimation(libNtve_gf_MainActorofUnit(gv_[EventPlayer()]), c_animNameDefault, "Attack", 0, c_animTimeDefault); gf_Traceline(EventPlayer()); if ((gv_[EventPlayer()] != null)) { UnitCreateEffectUnit(gv_[EventPlayer()], "C10CanisterRifle", gv_[EventPlayer()]); UnitIssueOrder(gv_[EventPlayer()], OrderTargetingUnit(AbilityCommand("attack", 0), gv_[EventPlayer()]), c_orderQueueReplace); } else { if ((gv_[EventPlayer()] != null)) { UnitCreateEffectPoint(gv_[EventPlayer()], "C10CanisterRifle", gv_[EventPlayer()]); } else { SoundPlay(SoundLink("Ghost_AttackLaunch", -1), PlayerGroupAll(), 100.0, 0.0); } } return true; }
-------------------- void gt_Shoot_Init () { gt_Shoot = TriggerCreate("gt_Shoot_Func"); TriggerAddEventMouseClicked(gt_Shoot, 1, c_mouseButtonLeft, true); TriggerAddEventMouseClicked(gt_Shoot, 2, c_mouseButtonLeft, true); }--------------------Trigger: Cooldown Attack-------------------- bool gt_CooldownAttack_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }Wait(AbsF(gv_), c_timeReal); gv_[EventPlayer()] = false; return true; }
-------------------- void gt_CooldownAttack_Init () { gt_CooldownAttack = TriggerCreate("gt_CooldownAttack_Func"); TriggerEnable(gt_CooldownAttack, false); }--------------------Trigger: Reload-------------------- bool gt_Reload_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }Wait(3.0, c_timeReal); gv_[EventPlayer()] = gv_; libNtve_gf_SetBossBarCurrentValue((EventPlayer() + 2), gv_[EventPlayer()], true); return true; }
-------------------- void gt_Reload_Init () { gt_Reload = TriggerCreate("gt_Reload_Func"); TriggerEnable(gt_Reload, false); }--------------------Trigger: Press R (Reload)-------------------- bool gt_PressRReload_Func (bool testConds, bool runActions) {Conditions if (testConds) { if (!(((UnitIsAlive(gv_[EventPlayer()]) == true) && (gv_[EventPlayer()] > 0) && (gv_[EventPlayer()] < gv_)))) { return false; } }Actions if (!runActions) { return true; }
gv_[EventPlayer()] = 0; libNtve_gf_SetBossBarCurrentValue((EventPlayer() + 2), gv_[EventPlayer()], true); TriggerExecute(gt_Reload, false, false); return true; }
-------------------- void gt_PressRReload_Init () { gt_PressRReload = TriggerCreate("gt_PressRReload_Func"); TriggerAddEventKeyPressed(gt_PressRReload, 1, c_keyR, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_PressRReload, 2, c_keyR, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: Zoom-------------------- bool gt_Zoom_Func (bool testConds, bool runActions) {Conditions if (testConds) { if (!(((gv_[EventPlayer()] == false) && (gv_[EventPlayer()] == false) && (gv_[EventPlayer()] == false) && (gv_[EventPlayer()] == false)))) { return false; } }Actions if (!runActions) { return true; }
gv_[EventPlayer()] = true; CameraSetValue(EventPlayer(), c_cameraValueDistance, 1.0, 0.3, -1, 10); return true; }
-------------------- void gt_Zoom_Init () { gt_Zoom = TriggerCreate("gt_Zoom_Func"); TriggerAddEventMouseClicked(gt_Zoom, 1, c_mouseButtonRight, true); TriggerAddEventMouseClicked(gt_Zoom, 2, c_mouseButtonRight, true); }--------------------Trigger: Unzoom-------------------- bool gt_Unzoom_Func (bool testConds, bool runActions) {Conditions if (testConds) { if (!((gv_[EventPlayer()] == true))) { return false; } }Actions if (!runActions) { return true; }
gv_[EventPlayer()] = false; CameraSetValue(EventPlayer(), c_cameraValueDistance, 4.0, 0.55, -1, 10); return true; }
-------------------- void gt_Unzoom_Init () { gt_Unzoom = TriggerCreate("gt_Unzoom_Func"); TriggerAddEventMouseClicked(gt_Unzoom, 1, c_mouseButtonRight, false); TriggerAddEventMouseClicked(gt_Unzoom, 2, c_mouseButtonRight, false); }--------------------Trigger: Press W-------------------- bool gt_PressW_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }gv_[EventPlayer()] = true; libNtve_gf_ClearAnimation(libNtve_gf_MainActorofUnit(gv_[EventPlayer()]), c_animNameDefault); TriggerExecute(gt_Unzoom, true, false); return true; }
-------------------- void gt_PressW_Init () { gt_PressW = TriggerCreate("gt_PressW_Func"); TriggerAddEventKeyPressed(gt_PressW, 1, c_keyW, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_PressW, 2, c_keyW, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: Release W-------------------- bool gt_ReleaseW_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }gv_[EventPlayer()] = false; return true; }
-------------------- void gt_ReleaseW_Init () { gt_ReleaseW = TriggerCreate("gt_ReleaseW_Func"); TriggerAddEventKeyPressed(gt_ReleaseW, 1, c_keyW, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_ReleaseW, 2, c_keyW, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: Press A-------------------- bool gt_PressA_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }gv_[EventPlayer()] = true; libNtve_gf_ClearAnimation(libNtve_gf_MainActorofUnit(gv_[EventPlayer()]), c_animNameDefault); TriggerExecute(gt_Unzoom, true, false); return true; }
-------------------- void gt_PressA_Init () { gt_PressA = TriggerCreate("gt_PressA_Func"); TriggerAddEventKeyPressed(gt_PressA, 1, c_keyA, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_PressA, 2, c_keyA, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: Release A-------------------- bool gt_ReleaseA_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }gv_[EventPlayer()] = false; return true; }
-------------------- void gt_ReleaseA_Init () { gt_ReleaseA = TriggerCreate("gt_ReleaseA_Func"); TriggerAddEventKeyPressed(gt_ReleaseA, 1, c_keyA, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_ReleaseA, 2, c_keyA, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: Press S-------------------- bool gt_PressS_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }gv_[EventPlayer()] = true; libNtve_gf_ClearAnimation(libNtve_gf_MainActorofUnit(gv_[EventPlayer()]), c_animNameDefault); TriggerExecute(gt_Unzoom, true, false); return true; }
-------------------- void gt_PressS_Init () { gt_PressS = TriggerCreate("gt_PressS_Func"); TriggerAddEventKeyPressed(gt_PressS, 1, c_keyS, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_PressS, 2, c_keyS, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: ReleaseS-------------------- bool gt_ReleaseS_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }gv_[EventPlayer()] = false; return true; }
-------------------- void gt_ReleaseS_Init () { gt_ReleaseS = TriggerCreate("gt_ReleaseS_Func"); TriggerAddEventKeyPressed(gt_ReleaseS, 1, c_keyS, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_ReleaseS, 2, c_keyS, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: Press D-------------------- bool gt_PressD_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }gv_[EventPlayer()] = true; libNtve_gf_ClearAnimation(libNtve_gf_MainActorofUnit(gv_[EventPlayer()]), c_animNameDefault); TriggerExecute(gt_Unzoom, true, false); return true; }
-------------------- void gt_PressD_Init () { gt_PressD = TriggerCreate("gt_PressD_Func"); TriggerAddEventKeyPressed(gt_PressD, 1, c_keyD, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_PressD, 2, c_keyD, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: Release D-------------------- bool gt_ReleaseD_Func (bool testConds, bool runActions) {Actions if (!runActions) { return true; }gv_[EventPlayer()] = false; return true; }
-------------------- void gt_ReleaseD_Init () { gt_ReleaseD = TriggerCreate("gt_ReleaseD_Func"); TriggerAddEventKeyPressed(gt_ReleaseD, 1, c_keyD, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_ReleaseD, 2, c_keyD, false, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger: Move Player Unit-------------------- bool gt_MovePlayerUnit_Func (bool testConds, bool runActions) {Variable Declarations int lv_;Variable Initialization lv_ = 0;
Actions if (!runActions) { return true; }
PlayerGroupLoopBegin(PlayerGroupActive()); while (!PlayerGroupLoopDone()) { lv_ = PlayerGroupLoopCurrent(); if (((gv_[lv_] == true) && (gv_[lv_] == false) && (gv_[lv_] == false) && (gv_[lv_] == false))) { UnitIssueOrder(gv_[lv_], OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(gv_[lv_]), 0.5, CameraGetYaw(lv_))), c_orderQueueReplace); } else { } if (((gv_[lv_] == false) && (gv_[lv_] == true) && (gv_[lv_] == false) && (gv_[lv_] == false))) { UnitIssueOrder(gv_[lv_], OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(gv_[lv_]), 0.5, (CameraGetYaw(lv_) + 90.0))), c_orderQueueReplace); } else { } if (((gv_[lv_] == false) && (gv_[lv_] == false) && (gv_[lv_] == true) && (gv_[lv_] == false))) { UnitIssueOrder(gv_[lv_], OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(gv_[lv_]), 0.5, (CameraGetYaw(lv_) + 180.0))), c_orderQueueReplace); } else { } if (((gv_[lv_] == false) && (gv_[lv_] == false) && (gv_[lv_] == false) && (gv_[lv_] == true))) { UnitIssueOrder(gv_[lv_], OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(gv_[lv_]), 0.5, (CameraGetYaw(lv_) + -90.0))), c_orderQueueReplace); } else { } if (((gv_[lv_] == true) && (gv_[lv_] == true) && (gv_[lv_] == false) && (gv_[lv_] == false))) { UnitIssueOrder(gv_[lv_], OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(gv_[lv_]), 0.5, (CameraGetYaw(lv_) + 45.0))), c_orderQueueReplace); } else { } if (((gv_[lv_] == true) && (gv_[lv_] == false) && (gv_[lv_] == false) && (gv_[lv_] == true))) { UnitIssueOrder(gv_[lv_], OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(gv_[lv_]), 0.5, (CameraGetYaw(lv_) + -45.0))), c_orderQueueReplace); } else { } if (((gv_[lv_] == false) && (gv_[lv_] == true) && (gv_[lv_] == true) && (gv_[lv_] == false))) { UnitIssueOrder(gv_[lv_], OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(gv_[lv_]), 0.5, (CameraGetYaw(lv_) + 135.0))), c_orderQueueReplace); } else { } if (((gv_[lv_] == false) && (gv_[lv_] == false) && (gv_[lv_] == true) && (gv_[lv_] == true))) { UnitIssueOrder(gv_[lv_], OrderTargetingPoint(AbilityCommand("move", 0), PointWithOffsetPolar(UnitGetPosition(gv_[lv_]), 0.5, (CameraGetYaw(lv_) + -135.0))), c_orderQueueReplace); } else { } PlayerGroupLoopStep(); } PlayerGroupLoopEnd(); return true; }
-------------------- void gt_MovePlayerUnit_Init () { gt_MovePlayerUnit = TriggerCreate("gt_MovePlayerUnit_Func"); TriggerAddEventTimePeriodic(gt_MovePlayerUnit, 0.04, c_timeGame); }--------------------Trigger: Press F (Flashlight)-------------------- bool gt_PressFFlashlight_Func (bool testConds, bool runActions) {Variable Declarations int lv_;Variable Initialization lv_ = EventPlayer();
Actions if (!runActions) { return true; }
if ((gv_[lv_] == false)) { gv_[lv_] = true; UnitBehaviorAddPlayer(gv_[lv_], "Flashlight", lv_, 1); } else { gv_[lv_] = false; UnitBehaviorRemovePlayer(gv_[lv_], "Flashlight", lv_, 1); } return true; }
-------------------- void gt_PressFFlashlight_Init () { gt_PressFFlashlight = TriggerCreate("gt_PressFFlashlight_Func"); TriggerAddEventKeyPressed(gt_PressFFlashlight, 1, c_keyF, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); TriggerAddEventKeyPressed(gt_PressFFlashlight, 2, c_keyF, true, c_keyModifierStateIgnore, c_keyModifierStateIgnore, c_keyModifierStateIgnore); }--------------------Trigger Initialization-------------------- void InitTriggers () { gt_MapInitialization_Init(); gt_SetEnemyUnitHeight_Init(); gt_Victory_Init(); gt_Defeat_Init(); gt_RotateCamera_Init(); gt_Shoot_Init(); gt_CooldownAttack_Init(); gt_Reload_Init(); gt_PressRReload_Init(); gt_Zoom_Init(); gt_Unzoom_Init(); gt_PressW_Init(); gt_ReleaseW_Init(); gt_PressA_Init(); gt_ReleaseA_Init(); gt_PressS_Init(); gt_ReleaseS_Init(); gt_PressD_Init(); gt_ReleaseD_Init(); gt_MovePlayerUnit_Init(); gt_PressFFlashlight_Init(); }--------------------Map Initialization-------------------- void InitMap () { InitLibs(); InitGlobals(); InitTriggers(); }