• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!

[Trigger] Spawn System issue

Status
Not open for further replies.
Level 6
Joined
Aug 30, 2005
Messages
161
i created a simple trigger spawn system but i have an issue. At a certain moment it causes players to Econnreset and crashes their game. This is only happening with the current map i am playtesting.


  • start
    • Events
      • Unit - A unit enters start <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an ally of Player 11 (Dark Green)) Equal to (==) True
    • Actions
      • Sound - Play AcolytePissed1 <gen>
      • Trigger - Turn on unit A1 <gen>
      • Trigger - Turn on unit A2 <gen>
      • Trigger - Turn on unit A3 <gen>
      • Trigger - Turn off (This trigger)

  • Enters A1
    • Events
      • Unit - A unit enters A1 <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an enemy of Player 10 (Light Blue)) Equal to (==) False
      • ((Entering unit) is A structure) Equal to (==) False
    • Actions
      • Unit - Order (Entering unit) to Attack-Move To (Center of main 1 <gen>)
      • Wait 5.00 seconds
      • Unit - Order (Entering unit) to Attack-Move To (Center of main 1 <gen>)
  • unit A1
    • Events
      • Time - Every (Random real number between 20.00 and 30.00) seconds of game time
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gates 0014 <gen> is alive) Equal to (==) True
        • Then - Actions
          • Set House1 = (Position of Gates 0014 <gen>)
          • Unit - Create Wave_augment (Random level (Random integer number between 1 and 2) creep unit-type) for Player 10 (Light Blue) at House1 facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation (udg_House1)
        • Else - Actions
          • Trigger - Turn off (This trigger)
The thread of triggers is simple: a unit enters region, it activates the other two triggers which check if a certain building is still alive, if it is then it creates units around it, if it isnt then it doesnt create anything.

My issue is that when i repeat this trigger it causes the error i mentioned. If anyone might know what could be causing this it would be great.
 
Level 8
Joined
Aug 21, 2009
Messages
333
A couple things - I don't know if these will stop your map from crashing, but...

1. The wait 5.00 seconds and then ordering the entering unit to move again is a dangerous thing to do. During the 5.00 seconds, "Entering unit" could very easily change to another unit.
2. Maybe try changing the Periodic event with a random wait time to either a set wait time, or try using a timer instead with the random number. Again, I don't know if this will help; I'm just speculating with the limited knowledge I have of your map.
 
Level 6
Joined
Aug 30, 2005
Messages
161
A couple things - I don't know if these will stop your map from crashing, but...

1. The wait 5.00 seconds and then ordering the entering unit to move again is a dangerous thing to do. During the 5.00 seconds, "Entering unit" could very easily change to another unit.
2. Maybe try changing the Periodic event with a random wait time to either a set wait time, or try using a timer instead with the random number. Again, I don't know if this will help; I'm just speculating with the limited knowledge I have of your map.

Thank you for your quick reply but, it didnt work.. let me post all the codes that are involved in the issue, perhaps it might give you more insight on the matter.

  • start
    • Events
      • Unit - A unit enters start <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an ally of Player 11 (Dark Green)) Equal to (==) True
    • Actions
      • Sound - Play AcolytePissed1 <gen>
      • Trigger - Turn on unit A1 <gen>
      • Trigger - Turn on unit A2 <gen>
      • Trigger - Turn on unit A3 <gen>
      • Trigger - Turn off (This trigger)
  • Enters A1
    • Events
      • Unit - A unit enters A1 <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an enemy of Player 10 (Light Blue)) Equal to (==) False
      • ((Entering unit) is A structure) Equal to (==) False
    • Actions
      • Unit - Order (Entering unit) to Attack-Move To (Center of main 1 <gen>)
  • unit A1
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gates 0014 <gen> is alive) Equal to (==) True
        • Then - Actions
          • Set House1 = (Position of Gates 0014 <gen>)
          • Unit - Create Wave_augment (Random level (Random integer number between 1 and 2) creep unit-type) for Player 10 (Light Blue) at House1 facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation (udg_House1)
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • Enters A2
    • Events
      • Unit - A unit enters A2 <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an enemy of Player 10 (Light Blue)) Equal to (==) False
      • ((Entering unit) is A structure) Equal to (==) False
    • Actions
      • Unit - Order (Entering unit) to Attack-Move To (Center of main 2 <gen>)
  • unit A2
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gates 0016 <gen> is alive) Equal to (==) True
        • Then - Actions
          • Set House2 = (Position of Gates 0016 <gen>)
          • Unit - Create Wave_augment (Random level (Random integer number between 1 and 2) creep unit-type) for Player 10 (Light Blue) at House2 facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation (udg_House2)
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • Enters A3
    • Events
      • Unit - A unit enters A3 <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an enemy of Player 10 (Light Blue)) Equal to (==) False
      • ((Entering unit) is A structure) Equal to (==) False
    • Actions
      • Unit - Order (Entering unit) to Attack-Move To (Center of main3 <gen>)
  • unit A3
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gates 0017 <gen> is alive) Equal to (==) True
        • Then - Actions
          • Set House3 = (Position of Gates 0017 <gen>)
          • Unit - Create Wave_augment (Random level (Random integer number between 1 and 2) creep unit-type) for Player 10 (Light Blue) at House3 facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation (udg_House3)
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • start B
    • Events
      • Unit - A unit enters StartB <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an ally of Player 11 (Dark Green)) Equal to (==) True
    • Actions
      • Sound - Play AcolytePissed1 <gen>
      • Trigger - Turn on unit B1 <gen>
      • Trigger - Turn on unit B2 <gen>
      • Trigger - Turn on unit B3 <gen>
      • Trigger - Turn off (This trigger)
  • Enters B1
    • Events
      • Unit - A unit enters B1 <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an enemy of Player 10 (Light Blue)) Equal to (==) False
      • ((Entering unit) is A structure) Equal to (==) False
    • Actions
      • Unit - Order (Entering unit) to Attack-Move To (Center of main 1 <gen>)
      • Wait 5.00 seconds
      • Unit - Order (Entering unit) to Attack-Move To (Center of main 1 <gen>)
  • Events
    • Time - Every 25.00 seconds of game time
  • Enters B2
    • Events
      • Unit - A unit enters B2 <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an enemy of Player 10 (Light Blue)) Equal to (==) False
      • ((Entering unit) is A structure) Equal to (==) False
    • Actions
      • Unit - Order (Entering unit) to Attack-Move To (Center of main 2 <gen>)
      • Wait 5.00 seconds
      • Unit - Order (Entering unit) to Attack-Move To (Center of main 2 <gen>)
  • unit B2
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gates 0035 <gen> is alive) Equal to (==) True
        • Then - Actions
          • Set House2_Copy = (Position of Gates 0035 <gen>)
          • Unit - Create (1 + Player_count) (Random level (Random integer number between 2 and 4) creep unit-type) for Player 10 (Light Blue) at House2_Copy facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation (udg_House2_Copy)
        • Else - Actions
          • Trigger - Turn off (This trigger)
  • Enters B3
    • Events
      • Unit - A unit enters B3 <gen>
    • Conditions
      • ((Owner of (Entering unit)) is an enemy of Player 10 (Light Blue)) Equal to (==) False
      • ((Entering unit) is A structure) Equal to (==) False
    • Actions
      • Unit - Order (Entering unit) to Attack-Move To (Center of main3 <gen>)
      • Wait 5.00 seconds
      • Unit - Order (Entering unit) to Attack-Move To (Center of main3 <gen>)
  • unit B3
    • Events
      • Time - Every 25.00 seconds of game time
    • Conditions
    • Actions
      • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Gates 0036 <gen> is alive) Equal to (==) True
        • Then - Actions
          • Set House3_Copy = (Position of Gates 0036 <gen>)
          • Unit - Create (1 + Player_count) (Random level (Random integer number between 2 and 4) creep unit-type) for Player 10 (Light Blue) at House3_Copy facing Default building facing (270.0) degrees
          • Custom script: call RemoveLocation (udg_House3_Copy)
        • Else - Actions
          • Trigger - Turn off (This trigger)
 
Level 7
Joined
May 18, 2010
Messages
264
i read this all and i dont get why some things are made the way they are it chould be realy simpler but k...
i dont get the problem ? the units dont spawn?
 
Level 6
Joined
Aug 30, 2005
Messages
161
i read this all and i dont get why some things are made the way they are it chould be realy simpler but k...
i dont get the problem ? the units dont spawn?

No, as i stated on the first post "At a certain moment it causes players to Econnreset and crashes their game."It usually happens when units start spawning in area B1, B2, and B3, it can also happen after the first 3 gates are killed. My guess is that the issue is in the triggers, so i posted the triggers to see if anyone could shed some light because i cant seem to find the reason.
 
Level 5
Joined
May 3, 2009
Messages
129
why don't you remoe the wait 5 sec as its not needed beause you alrdy make it move to the same place

the trigger unita1 a2 a3 all can be on the same page same with the unitb1 b2 b3
and the triiges entersa1 a2 a3 all can be on the same page and enters b1 b2 b3
 
Level 6
Joined
Aug 30, 2005
Messages
161
why don't you remoe the wait 5 sec as its not needed beause you alrdy make it move to the same place

the trigger unita1 a2 a3 all can be on the same page same with the unitb1 b2 b3
and the triiges entersa1 a2 a3 all can be on the same page and enters b1 b2 b3

i forgot to remove it from the "B" side, but thats not the issue, what i am concern is the Econnreset and the crashing =).
 
Level 13
Joined
May 11, 2008
Messages
1,198
tl;dr?
this part of your triggers is using locations, which are leaking. you have many parts just like this.
Center of...
  • Unit - Order (Entering unit) to Attack-Move To (Center of main 2 <gen>)
you need to learn jass to spawn units. for an example you can see my taf map in my sig. i wanted to edit an old mass spawning map(whic had same problem as you), but sadly i had protected it and don't want to remake the game from scratch.
as it was, when i was first making tdht and even when it was first appproved here it had some crashing problems. now after learning jass we are fine and without those crashes.

i even remember weird black screen bugs. that was very odd.
when you mouse over the terrain in a map there's a number set in the bottom left with the word poimt. that's like what a location is. unfortunately each time you say center of a region you are creating a new sort of variable but it's not refreshed. your map is like a bottle or a glass of water. too many variables means you can't fit the water in the glass. but if we purify the water by reverse osmosis then we can fit more water into the glass, because the water is no longer extra fat, but nice and silky.

so you need to at the very least learn to use variables properly. when to use globals, and when to use locals, even.

ley's look at the code.
  • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
here's what your gui code really looks like:
JASS:
call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )

//let's look at it in the function list and comment on the way
function GetRectCenter takes rect whichRect returns location
    return Location(GetRectCenterX(whichRect), GetRectCenterY(whichRect))
    //////////////X IS FIRST NUMBER OF POINT////Y IS SECOND
endfunction
//THIS IS WHERE WE GET THE LOCATION.
//BUT WE CANNOT DO MUCH HERE
//because locations don't have good functions for their use

////////////////////our integer called count was 1
///////////////////////////////////////otherinteger is a unit type id
/////////////////////////////////////////////////////////////////player(0)=red,player(1)=blue,etc//location
//////////////////////////////////////////////////////////////locations are called objects i believe
///this is our problem, too many objects in the map, or rather, too manu pointers to objects gives memory issues, and the map crashes
///////////////////////////////////////////////////////////////////////////////////////////////real face is number from 0.0-360.0, where 270.0 is toward player
    function CreateNUnitsAtLoc takes integer count, integer unitId, player whichPlayer, location loc, real face returns group
    call GroupClear(bj_lastCreatedGroup)//a default group
    //used for handling units//it is emptied for creating 
    //multiple footmen
    loop
        set count = count - 1
        exitwhen count < 0
       //another function is called
       call CreateUnitAtLocSaveLast(whichPlayer, unitId, loc, face)
        //we are making all the footmen spawn at same time
        call GroupAddUnit(bj_lastCreatedGroup, bj_lastCreatedUnit)
    endloop
    return bj_lastCreatedGroup
endfunction
////see above? taking those variables that have been
// carried over from the first trigger
function CreateUnitAtLocSaveLast takes player id, integer unitid, location loc, real face returns unit
    if (unitid == 'ugol') then//ugol is goldmine undead
    //style, like, seriously?
    
    //now the map wonders if you will build more than one
    //gold mine at the same location, lol, so inefficient
        set bj_lastCreatedUnit = CreateBlightedGoldmine(id, GetLocationX(loc), GetLocationY(loc), face)
    else
    //no, we're not done yet. onde final function is called
        set bj_lastCreatedUnit = CreateUnitAtLoc(id, unitid, loc, face)
    endif

    return bj_lastCreatedUnit
endfunction
//now look at the end of this next function it says 
//returns unit so what can we do with location
// none of these did return location.
//we cannot use variable for location properly here
// and be able to point it to a new location, thus
//saving us valuable pointers, which cost memory
//overload of pointers would lead to game crashing
native CreateUnitAtLoc takes player id, integer unitid, location whichLocation, real face returns unit
//this is all what your gui did.
//it points to a location on the terrain of the map, and 
//then tries to use a new finger to later point at another
//location when you want to spawn a unit.
//this of course is just an example.  anytime you dealing
// with locations they need  pointers so they'll leak
//if you can't use the pointing again.
//so let's use another function
//HERE IS ALTERNATIVE
native CreateUnit takes player id, integer unitid, real x, real y, real face returns unit
//we can do like...
call CreateUnit(Player(0),'hfoo',0.0,0.0,0.0)//this
//footman will face to the right.

//if you mouse over the middle of the map the 2 numbers are 0.
//so mouse over to the points you want.
so we find the single jass function does so much. we can simply run a loop and make the function pop up again and again, or we can simply duplicate the times we call the function. we can even try posting the troops in lines or some other pattern for fun. you could use math to accomplish this, as an entry as a real can be a mathematical equation.

even if your map would be leak free, it might hiccup and be annoying while it calls so many functions as shown above.

in future i recommend you look at sticky threads, or better yet look at good coding... i think there's one that discusses leaks. that's what it means that these locations are crashing your map. as for maps...i think there's an unprotected kodo tag map that handles leaks very well.
 
Last edited:
Level 6
Joined
Aug 30, 2005
Messages
161
tl;dr?
this part of your triggers is using locations, which are leaking. you have many parts just like this.
Center of...
  • Unit - Order (Entering unit) to Attack-Move To (Center of main 2 <gen>)
you need to learn jass to spawn units. for an example you can see my taf map in my sig. i wanted to edit an old mass spawning map(whic had same problem as you), but sadly i had protected it and don't want to remake the game from scratch.
as it was, when i was first making tdht and even when it was first appproved here it had some crashing problems. now after learning jass we are fine and without those crashes.

i even remember weird black screen bugs. that was very odd.
when you mouse over the terrain in a map there's a number set in the bottom left with the word poimt. that's like what a location is. unfortunately each time you say center of a region you are creating a new sort of variable but it's not refreshed. your map is like a bottle or a glass of water. too many variables means you can't fit the water in the glass. but if we purify the water by reverse osmosis then we can fit more water into the glass, because the water is no longer extra fat, but nice and silky.

so you need to at the very least learn to use variables properly. when to use globals, and when to use locals, even.

ley's look at the code.
  • Unit - Create 1 Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
here's what your gui code really looks like:
JASS:
call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), GetRectCenter(GetPlayableMapRect()), bj_UNIT_FACING )

//let's look at it in the function list and comment on the way
function GetRectCenter takes rect whichRect returns location
    return Location(GetRectCenterX(whichRect), GetRectCenterY(whichRect))
    //////////////X IS FIRST NUMBER OF POINT////Y IS SECOND
endfunction
//THIS IS WHERE WE GET THE LOCATION.
//BUT WE CANNOT DO MUCH HERE
//because locations don't have good functions for their use

////////////////////our integer called count was 1
///////////////////////////////////////otherinteger is a unit type id
/////////////////////////////////////////////////////////////////player(0)=red,player(1)=blue,etc//location
//////////////////////////////////////////////////////////////locations are called objects i believe
///this is our problem, too many objects in the map, or rather, too manu pointers to objects gives memory issues, and the map crashes
///////////////////////////////////////////////////////////////////////////////////////////////real face is number from 0.0-360.0, where 270.0 is toward player
    function CreateNUnitsAtLoc takes integer count, integer unitId, player whichPlayer, location loc, real face returns group
    call GroupClear(bj_lastCreatedGroup)//a default group
    //used for handling units//it is emptied for creating 
    //multiple footmen
    loop
        set count = count - 1
        exitwhen count < 0
       //another function is called
       call CreateUnitAtLocSaveLast(whichPlayer, unitId, loc, face)
        //we are making all the footmen spawn at same time
        call GroupAddUnit(bj_lastCreatedGroup, bj_lastCreatedUnit)
    endloop
    return bj_lastCreatedGroup
endfunction
////see above? taking those variables that have been
// carried over from the first trigger
function CreateUnitAtLocSaveLast takes player id, integer unitid, location loc, real face returns unit
    if (unitid == 'ugol') then//ugol is goldmine undead
    //style, like, seriously?
    
    //now the map wonders if you will build more than one
    //gold mine at the same location, lol, so inefficient
        set bj_lastCreatedUnit = CreateBlightedGoldmine(id, GetLocationX(loc), GetLocationY(loc), face)
    else
    //no, we're not done yet. onde final function is called
        set bj_lastCreatedUnit = CreateUnitAtLoc(id, unitid, loc, face)
    endif

    return bj_lastCreatedUnit
endfunction
//now look at the end of this next function it says 
//returns unit so what can we do with location
// none of these did return location.
//we cannot use variable for location properly here
// and be able to point it to a new location, thus
//saving us valuable pointers, which cost memory
//overload of pointers would lead to game crashing
native CreateUnitAtLoc takes player id, integer unitid, location whichLocation, real face returns unit
//this is all what your gui did.
//it points to a location on the terrain of the map, and 
//then tries to use a new finger to later point at another
//location when you want to spawn a unit.
//this of course is just an example.  anytime you dealing
// with locations they need  pointers so they'll leak
//if you can't use the pointing again.
//so let's use another function
//HERE IS ALTERNATIVE
native CreateUnit takes player id, integer unitid, real x, real y, real face returns unit
//we can do like...
call CreateUnit(Player(0),'hfoo',0.0,0.0,0.0)//this
//footman will face to the right.

//if you mouse over the middle of the map the 2 numbers are 0.
//so mouse over to the points you want.
so we find the single jass function does so much. we can simply run a loop and make the function pop up again and again, or we can simply duplicate the times we call the function. we can even try posting the troops in lines or some other pattern for fun. you could use math to accomplish this, as an entry as a real can be a mathematical equation.

even if your map would be leak free, it might hiccup and be annoying while it calls so many functions as shown above.

I cant code Jass but i can understand it somewhat. i see you used footmen as an example for spawning the units near a goldmine? but how can i set the unit as a variable that will spawn random critters of a certain level? thats my main issue with some jass spawn systems ive seen around here, i couldn't figure out a way to use a variable to spawn units of random levels.
 
Level 13
Joined
May 11, 2008
Messages
1,198
tl;dr? use integer array variable
it takes a lot longer to make arrays in gui than it does in jass, imo...
scroll to second to last jass box which is just a single line and use that GetRandomInt function with your array.

it's not so. for one thing, the function CreateUnit( had nothing to do with a gold mine, unless your gold mine is at the center of the map.
i was merely showing the processes the editor takes when you use gui actions.

using jass you can write your own actions, and decide just which functions to call, ignoring others.

all that code above was a whole bunch of gui and a single jass function that did everything all that gui stuff did but better.

using jass you can do something like:
(scroll to bottom area)
JASS:
scope DeadRunnerOrChaser initializer I
globals
private itempool array poolitems
group DESTROYGROUP=CreateGroup()
endglobals
struct chasernotplaying extends array
//! runtextmacro AIDS()
private trigger t
private integer utype
private static method Callback takes nothing returns boolean
local thistype this=KT_GetData()
call this.AIDS_removeLock()
return true
endmethod
private static method OnDeath takes nothing returns boolean
local thistype this=thistype[GetTriggerUnit()]
call this.AIDS_addLock() // So the struct can't disappear before the timer ticks.
call KT_Add(function thistype.Callback,this,5.0)
call DestroyTrigger(this.t)
set this.t=null
return false
endmethod
private static method AIDS_filter takes unit u returns boolean
return GetUnitTypeId(u)=='nfnp'
endmethod
private method AIDS_onCreate takes nothing returns nothing
set this.utype=GetUnitTypeId(this.unit)
set this.t=CreateTrigger()
call TriggerAddCondition(this.t,Condition(function thistype.OnDeath))
call TriggerRegisterUnitEvent(this.t,this.unit, EVENT_UNIT_DEATH )
endmethod
endstruct
private function Ec takes nothing returns boolean
local integer pi = GetPlayerSlotMultiboard(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))
local integer pik = GetPlayerSlotMultiboard(GetPlayerId(GetOwningPlayer(GetKillingUnit())))
if IsUnitIllusion(GetTriggerUnit()) then
return false
endif
call jBoard_TDHT.field(pik,0).addR(3)
call jBoard_TDHT.field(pi,1).setIconPathR(iconX)
call SetPlayerState(Player(bj_PLAYER_NEUTRAL_EXTRA), PLAYER_STATE_GOLD_GATHERED, GetPlayerState(Player(bj_PLAYER_NEUTRAL_EXTRA), PLAYER_STATE_GOLD_GATHERED) + 1)
call SetPlayerState(Player(bj_PLAYER_NEUTRAL_EXTRA), PLAYER_STATE_RESOURCE_GOLD, GetPlayerState(Player(bj_PLAYER_NEUTRAL_EXTRA), PLAYER_STATE_RESOURCE_GOLD) + 1)
if GetPlayerSlotState(GetOwningPlayer(GetTriggerUnit())) == PLAYER_SLOT_STATE_PLAYING then
call msgone180(GetOwningPlayer(GetTriggerUnit()),gtc_coralblue("You have lost your Demon Hunter.  You may continue to watch your fellow Demon Hunters hunt the remaining demons.  You can also ask the better players in the game for advice to do better.  Thanks for playing, wish you a better game next time!"),true)
call msgone75(GetOwningPlayer(GetTriggerUnit()),gtc_coralpink("Oh, the Disgrace! A Chaser Has Been Eliminated From the Tournament!"),false)
endif
return false
endfunction
private function A takes nothing returns boolean
local real ux = GetUnitX(GetDyingUnit())
local real uy = GetUnitY(GetDyingUnit())
if GetOwningPlayer(GetKillingUnit())==Player(0) or GetOwningPlayer(GetKillingUnit())==Player(1) or GetOwningPlayer(GetKillingUnit())==Player(10) then
else
return false
endif
if GetUnitAbilityLevel(GetKillingUnit(),'BEah') > 0 then
call PlaceRandomItem(poolitems[0],ux,uy)
call PlaceRandomItem(poolitems[1],ux,uy)
else
call PlaceRandomItem(poolitems[2],ux,uy)
call PlaceRandomItem(poolitems[1],ux,uy)
endif
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(15), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(15)) + 1)
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(1), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(1)) + 1)
return false
endfunction
private function B takes nothing returns boolean
local integer x = GetRandomInt(1,4)
local real ux = GetUnitX(GetDyingUnit())
local real uy = GetUnitY(GetDyingUnit())
if GetOwningPlayer(GetKillingUnit())==Player(0) or GetOwningPlayer(GetKillingUnit())==Player(1) or GetOwningPlayer(GetKillingUnit())==Player(10) then
else
return false
endif
if IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO) then
call PlaceRandomItem(poolitems[1],ux,uy)
if GetUnitAbilityLevel(GetKillingUnit(),'BEah') > 0 then
call PlaceRandomItem(poolitems[1],ux,uy)
endif
call PlaceRandomItem(poolitems[3],ux,uy)
endif
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(15), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(15)) + 1)
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(1), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(1)) + 1)
if x==1 then
call CreateItem('I00C',ux,uy)
endif
return false
endfunction
private function C takes nothing returns boolean
local real ux = GetUnitX(GetDyingUnit())
local real uy = GetUnitY(GetDyingUnit())
if GetOwningPlayer(GetKillingUnit())==Player(0) or GetOwningPlayer(GetKillingUnit())==Player(1) or GetOwningPlayer(GetKillingUnit())==Player(10) then
else
return false
endif
if IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO) then
call PlaceRandomItem(poolitems[4],ux,uy)
endif
return false
endfunction
private function D takes nothing returns boolean
local real ux = GetUnitX(GetDyingUnit())
local real uy = GetUnitY(GetDyingUnit())
if GetOwningPlayer(GetKillingUnit())==Player(0) or GetOwningPlayer(GetKillingUnit())==Player(1) or GetOwningPlayer(GetKillingUnit())==Player(10) then
else
return false
endif
if IsUnitType(GetKillingUnit(), UNIT_TYPE_HERO) then
call PlaceRandomItem(poolitems[1],ux,uy)
if GetUnitAbilityLevel(GetKillingUnit(),'BEah') > 0 then
call PlaceRandomItem(poolitems[1],ux,uy)
endif
endif
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(15), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(15)) + 1)
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(1), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(1)) + 1)
return false
endfunction
private function ru takes nothing returns boolean
if GetUnitTypeId(GetFilterUnit()) == 'npgf' then
call KillUnit(GetFilterUnit())
call RemoveUnit(GetFilterUnit())
elseif GetUnitTypeId(GetFilterUnit()) == 'uzg2' then
call RemoveUnit(GetFilterUnit())
elseif GetUnitTypeId(GetFilterUnit()) == 'uzig' then
call RemoveUnit(GetFilterUnit())
elseif GetUnitTypeId(GetFilterUnit()) == 'hatw' then
call RemoveUnit(GetFilterUnit())
elseif GetUnitTypeId(GetFilterUnit()) == 'hwtw' then
call RemoveUnit(GetFilterUnit())
elseif GetUnitTypeId(GetFilterUnit()) == 'eaom' then
call RemoveUnit(GetFilterUnit())
elseif GetUnitTypeId(GetFilterUnit()) == 'etrp' then
call RemoveUnit(GetFilterUnit())
endif
return false
endfunction
private function removeall takes nothing returns nothing
local integer ipid = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
call GroupEnumUnitsOfPlayer(DESTROYGROUP, Player(ipid), Filter(function ru))
if runnerSERVANT[ipid] != null then
call RemoveUnit(runnerSERVANT[ipid])
endif
endfunction
private function E takes nothing returns boolean
local integer pi = GetPlayerSlotMultiboard(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))
local integer pik = GetPlayerSlotMultiboard(GetPlayerId(GetOwningPlayer(GetKillingUnit())))
local real ux = GetUnitX(GetTriggerUnit())
local real uy = GetUnitY(GetTriggerUnit())
if IsUnitIllusion(GetTriggerUnit()) == false then
call PlaceRandomItem(poolitems[5],ux,uy)
if GetUnitAbilityLevel(GetKillingUnit(),'BEah') > 0 then
call PlaceRandomItem(poolitems[6],ux,uy)
endif
call SetItemCharges( UnitItemInSlot(GetKillingUnit(), 0), ( GetItemCharges(UnitItemInSlot(GetKillingUnit(), 0)) + 1 ) )
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(16), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(16)) + 1)
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(2), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(2)) + 1)
if GetKillingUnit()==CHASER[pik] then
call jBoard_TDHT.field(pi,0).addR(-1)
call jBoard_TDHT.field(pik,0).addR(1)
endif
call jBoard_TDHT.field(pi,1).setIconPathR(ICON[pi+1])
call CreateUnit(Player(bj_PLAYER_NEUTRAL_EXTRA), SPECIALCRITTER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))], (GetRandomReal(-215.00, 50.00)), (GetRandomReal(-715.00, -420.00)), GetRandomReal(0.00,359.99))
call removeall()
if GetKillingUnit() != null then
if GetPlayerSlotState(Player(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))) == PLAYER_SLOT_STATE_PLAYING then
call msgone20(GetOwningPlayer(GetTriggerUnit()),gtc_brightgreen("Your runner died to "+GetPlayerName(GetOwningPlayer(GetKillingUnit()))+"!"),true)
call msgone15(GetOwningPlayer(GetKillingUnit()),gtc_coralblue("You killed the runner of "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+"!"),true)
call msgall25(gtc_brightorange(GetPlayerName(GetOwningPlayer(GetKillingUnit()))+" has killed a runner! "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+" must wait for a critter to die at the middle to get another chance to play!"))
endif
endif
endif
return false
endfunction
private function F takes nothing returns boolean
local integer pi = GetPlayerSlotMultiboard(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))
call jBoard_TDHT.field(pi,1).setIconPathR(ICON[pi+1])
call CreateUnit(Player(bj_PLAYER_NEUTRAL_EXTRA), SPECIALCRITTER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))], (GetRandomReal(-215.00, 50.00)), (GetRandomReal(-715.00, -420.00)), GetRandomReal(0.00,359.99))
call removeall()
if GetPlayerSlotState(Player(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))) == PLAYER_SLOT_STATE_PLAYING then
if GetKillingUnit()==null then
call msgone25(GetOwningPlayer(GetTriggerUnit()),gtc_sand("The host has destroyed a demon gate! "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+" must wait for a critter to die at the middle to get another chance to play!"),false)
call msgone75(GetOwningPlayer(GetTriggerUnit()),gtc_brightorange("The host has destroyed your demon gate! You must wait for a critter to die at the middle to get another chance to play!"),true)
return false
endif
call msgone15(GetOwningPlayer(GetKillingUnit()),gtc_coralblue("You destroyed the demon gate of "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+"!"),true)
call msgone55(GetOwningPlayer(GetTriggerUnit()),gtc_brightorange("Your demon gate has been destroyed by "+GetPlayerName(GetOwningPlayer(GetKillingUnit()))+"!"),true)
call msgall25(gtc_sand(GetPlayerName(GetOwningPlayer(GetKillingUnit()))+" has destroyed a demon gate! "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+" must wait for a critter to die at the middle to get another chance to play!"))
endif
return false
endfunction
private function Fc takes nothing returns boolean
local integer pi = GetPlayerSlotMultiboard(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))
call AdjustPlayerStateBJ( 1, Player(bj_PLAYER_NEUTRAL_EXTRA), PLAYER_STATE_RESOURCE_GOLD )
call jBoard_TDHT.field(pi,1).setIconPathR(iconX)
return false
endfunction
private function G takes nothing returns boolean
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(15), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(15)) + 1)
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(1), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(1)) + 1)
return false
endfunction
private function H takes nothing returns boolean
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(16), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(16)) + 1)
call SetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(2), GetPlayerState(GetOwningPlayer(GetKillingUnit()), ConvertPlayerState(2)) + 1)
return false
endfunction
private function I takes nothing returns nothing
local integer loopinteger=0
  loop
  set poolitems[loopinteger]=CreateItemPool()
  set loopinteger=loopinteger+1
  exitwhen loopinteger>6
  endloop
call ItemPoolAddItemType(poolitems[0], 'pams', 4) // Chance: 4/43
call ItemPoolAddItemType(poolitems[0], 'rnec', 6) // Chance: 6/43
call ItemPoolAddItemType(poolitems[0], 'desc', 5) // Chance: 5/43
call ItemPoolAddItemType(poolitems[0], 'fgsk', 6) // Chance: 6/43
call ItemPoolAddItemType(poolitems[0], 'fgfh', 6) // Chance: 6/43
call ItemPoolAddItemType(poolitems[0], 'pgma', 5) // Chance: 5/43
call ItemPoolAddItemType(poolitems[0], 'pclr', 3) // Chance: 3/43
call ItemPoolAddItemType(poolitems[0], 'mcri', 3) // Chance: 3/43
call ItemPoolAddItemType(poolitems[0], 'moon', 2) // Chance: 2/43
call ItemPoolAddItemType(poolitems[0], 'pman', 3) // Chance: 3/43
call ItemPoolAddItemType(poolitems[1], 'pams', 1) // Chance: 1/12 potion of antimagic
call ItemPoolAddItemType(poolitems[1], 'pclr', 3) // Chance: 3/12 clarity potion
call ItemPoolAddItemType(poolitems[1], 'mcri', 3) // Chance: 3/12 
call ItemPoolAddItemType(poolitems[1], 'moon', 2) // Chance: 2/12 moonstone
call ItemPoolAddItemType(poolitems[1], 'pman', 3) // Chance: 3/12 potion of mana
call ItemPoolAddItemType(poolitems[2], 'pams', 1) // Chance: 1/14
call ItemPoolAddItemType(poolitems[2], 'rnec', 3) // Chance: 3/14
call ItemPoolAddItemType(poolitems[2], 'desc', 2) // Chance: 2/14
call ItemPoolAddItemType(poolitems[2], 'fgsk', 3) // Chance: 3/14
call ItemPoolAddItemType(poolitems[2], 'fgfh', 3) // Chance: 3/14
call ItemPoolAddItemType(poolitems[2], 'pgma', 2) // Chance: 2/14
call ItemPoolAddItemType(poolitems[3], 'pams', 1) // Chance: 1/19
call ItemPoolAddItemType(poolitems[3], 'pclr', 4) // Chance: 4/19
call ItemPoolAddItemType(poolitems[3], 'mcri', 4) // Chance: 4/19
call ItemPoolAddItemType(poolitems[3], 'moon', 4) // Chance: 4/19
call ItemPoolAddItemType(poolitems[3], 'pman', 4) // Chance: 4/19
call ItemPoolAddItemType(poolitems[3], 'whwd', 1) // Chance: 1/19
call ItemPoolAddItemType(poolitems[3], 'tgxp', 1) // Chance: 1/19
call ItemPoolAddItemType(poolitems[4], 'pclr', 1) // Chance: 1/4
call ItemPoolAddItemType(poolitems[4], 'mcri', 1) // Chance: 1/4
call ItemPoolAddItemType(poolitems[4], 'moon', 1) // Chance: 1/4
call ItemPoolAddItemType(poolitems[4], 'pman', 1) // Chance: 1/4
call ItemPoolAddItemType(poolitems[5], 'pams', 3)  //Chance: 3/33
call ItemPoolAddItemType(poolitems[5], 'pclr', 4)  //Chance: 4/33
call ItemPoolAddItemType(poolitems[5], 'mcri', 4)  //Chance: 4/33
call ItemPoolAddItemType(poolitems[5], 'moon', 4)  //Chance: 4/33
call ItemPoolAddItemType(poolitems[5], 'pman', 4)  //Chance: 4/33
call ItemPoolAddItemType(poolitems[5], 'rnec', 2)  //Chance: 2/33
call ItemPoolAddItemType(poolitems[5], 'desc', 1)  //Chance: 1/33
call ItemPoolAddItemType(poolitems[5], 'whwd', 3)  //Chance: 3/33
call ItemPoolAddItemType(poolitems[5], 'fgsk', 2)  //Chance: 2/33
call ItemPoolAddItemType(poolitems[5], 'fgfh', 2)  //Chance: 2/33
call ItemPoolAddItemType(poolitems[5], 'pgma', 1)  //Chance: 1/33
call ItemPoolAddItemType(poolitems[5], 'txgp', 3)  //Chance: 3/33
call ItemPoolAddItemType(poolitems[6], 'pams', 4)  //Chance: 4/34
call ItemPoolAddItemType(poolitems[6], 'pclr', 6)  //Chance: 6/34
call ItemPoolAddItemType(poolitems[6], 'mcri', 6)  //Chance: 6/34
call ItemPoolAddItemType(poolitems[6], 'moon', 6)  //Chance: 6/34
call ItemPoolAddItemType(poolitems[6], 'pman', 6)  //Chance: 6/34
call ItemPoolAddItemType(poolitems[6], 'whwd', 3)  //Chance: 3/34
call ItemPoolAddItemType(poolitems[6], 'tgxp', 3)  //Chance: 3/34
call GT_AddUnitDiesAction(function A, 'eaom')//ancient of war
call GT_AddUnitDiesAction(function B, 'etol')//tree of life
call GT_AddUnitDiesAction(function C, 'ugol')//haunted gold mine
call GT_AddUnitDiesAction(function D, 'htow')//any other hall/
call GT_AddUnitDiesAction(function D, 'ofrt')//any other hall/
call GT_AddUnitDiesAction(function D, 'ogre')//any other hall/
call GT_AddUnitDiesAction(function D, 'nntt')//any other hall/
call GT_AddUnitDiesAction(function D, 'ndh2')//any other hall/
call GT_AddUnitDiesAction(function D, 'e002')//any other hall/
call GT_AddUnitDiesAction(function G, 'emow')//singlegoldpiecebounty/
call GT_AddUnitDiesAction(function G, 'e001')//singlegoldpiecebounty/
call GT_AddUnitDiesAction(function G, 'zcso')//singlegoldpiecebounty/
call GT_AddUnitDiesAction(function G, 'nnmg')//singlegoldpiecebounty/
call GT_AddUnitDiesAction(function H, 'hdfR')//singlewoodpiecebounty/
set RUNNERTYPEID[0] = 'uaco'
set RUNNERTYPEID[1] = 'ushd'
set RUNNERTYPEID[2] = 'ugho'
set RUNNERTYPEID[3] = 'uabo'
set RUNNERTYPEID[4] = 'umtw'
set RUNNERTYPEID[5] = 'ucry'
set RUNNERTYPEID[6] = 'ugar'
set RUNNERTYPEID[7] = 'uban'
set RUNNERTYPEID[8] = 'unec'
set RUNNERTYPEID[9] = 'uobs'
set RUNNERTYPEID[10] = 'ufro'
set RUNNERTYPEID[11] = 'hfoo'
set RUNNERTYPEID[12] = 'hkni'
set RUNNERTYPEID[13] = 'hrif'
set RUNNERTYPEID[14] = 'hmtm'
set RUNNERTYPEID[15] = 'hgyr'
set RUNNERTYPEID[16] = 'hgry'
set RUNNERTYPEID[17] = 'hmpr'
set RUNNERTYPEID[18] = 'hsor'
set RUNNERTYPEID[19] = 'hmtt'
set RUNNERTYPEID[20] = 'hspt'
set RUNNERTYPEID[21] = 'hdhw'
set RUNNERTYPEID[22] = 'ogru'
set RUNNERTYPEID[23] = 'orai'
set RUNNERTYPEID[24] = 'otau'
set RUNNERTYPEID[25] = 'ohun'
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[0])////sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[1])////sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[2])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[3])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[4])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[5])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[6])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[7])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[8])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[9])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[10])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[11])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[12])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[13])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[14])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[15])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[16])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[17])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[18])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[19])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[20])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[21])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[22])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[23])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[24])//sapper
call GT_AddUnitDiesAction(function E, RUNNERTYPEID[25])//sapper
call GT_AddUnitDiesAction(function F, DEMONGATEA)//demongate
call GT_AddUnitDiesAction(function F, DEMONGATEB)//demongate
call GT_AddUnitDiesAction(function F, DEMONGATEC)//demongate
call GT_AddUnitDiesAction(function Fc, 'nfnp')//fountain
set CHASERTYPEID[0] = 'ECHA'
set CHASERTYPEID[1] = 'EMAG'
set CHASERTYPEID[2] = 'EDRU'
set CHASERTYPEID[3] = 'EDAR'
set CHASERTYPEID[4] = 'HDES'
set CHASERTYPEID[5] = 'HBLO'
set CHASERTYPEID[6] = 'HSLA'
set CHASERTYPEID[7] = 'HTRA'
set CHASERTYPEID[8] = 'OWAR'
set CHASERTYPEID[9] = 'OPAN'
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[0])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[1])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[2])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[3])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[4])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[5])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[6])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[7])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[8])//HUNTER
call GT_AddUnitDiesAction(function Ec, CHASERTYPEID[9])//HUNTER
endfunction
endscope
you saw all those variables i was setting? they were from the globals in my library
scroll down in the library, two more jass boxes down a little to some integer array variables, should see them named like the above variables, like this:

JASS:
integer array RUNNERTYPEID
integer array CHASERTYPEID
integer array SPECIALCRITTER
JASS:
//==============================================================================
//  TDHT - Library for The Demon Hunt Tournament by SanKakU -
//==============================================================================
//  THANKS TO : TEXT TAG - Floating text system by Cohadar - v4.0
//  I was able to learn how to make a library from examining that simple system
//==============================================================================
//  allows time to be saved while adding new triggers.
//  to use: call RUNNERPUE(nameoftrigger, thekindofevent) and that's it.
//  you can make your own teams from any combination of colors and edit the
//  functions like that.  like if you had a map with teams just like dota,
//  then you can make a function like SENTINELPUE and Player(1,2,3,4,5) and 
//  SCOURGEPUE Player(7,8,9,10,11) instead of RUNNERPUE and CHASERPUE and
//  instead of Player(2,3,4,5,6,7,8,9,11) and Player(0,1,10)
//  if you allow things like all pick then this won't work for spell triggers.
//  but it might still be useful for things like giving gold to enemy team of
//  a dying tower or hero or something like that.
//==============================================================================


library TDHT
globals
camerasetup array customCAM
real array customCAMrotatereal
real array customCAManglereal
real array customCAMdistancereal
real array CAMX
real array CAMY
sound gg_snd_demonstration=null 
sound gg_snd_Tension = null
sound gg_snd_ilaughinthefaceofdanger = null
sound gg_snd_ColdSounds= null
sound gg_snd_RainAmbience= null
sound gg_snd_Vision= null
sound gg_snd_EvilLaugh = null
public group ug
integer array earngold5
unit efdr=null
unit nndk=null
string iconX="war3mapImported\\x.blp"
string iconP="ReplaceableTextures\\CommandButtons\\BTNGem.blp"
string iconR="ReplaceableTextures\\CommandButtons\\BTNFireBolt.blp"
string iconDG="ReplaceableTextures\\CommandButtons\\BTNDemonGate.blp"
string iconF="ReplaceableTextures\\CommandButtons\\BTNFountainOfLife.blp"
constant integer CLOCK15='R000'
constant integer CLOCK15B='Ropg'
constant integer CLOCK53='R001'
constant integer DUMMY='earc'
constant integer DEMONGATEA='ndmg'
constant integer DEMONGATEB='ncbf'
constant integer DEMONGATEC='ncbe'
constant integer ATOI='ehpr'
constant integer JTOR='echm'
constant integer STOZ='ehip'
camerasetup array CAM
string array ICON
string array RANDOMTIP
integer array RUNNERTYPEID
integer array CHASERTYPEID
integer array SPECIALCRITTER
integer array diadifint
constant integer POINT='phlt'
timer tmrTDHT=CreateTimer()
timerdialog tmrdiaTDHT=null 
unit array runnerSERVANT
unit array RUNNER
unit array CHASER
button array diadifbut
dialog diadif=DialogCreate()
group GROUPRUNNERS
constant string C_goldbrown="|cffdaa520"
constant string C_gold="|cffffd700"
constant string C_palegreen="|cff7aff7c"
constant string C_pretty="|cffee82ee"
constant string C_grassgreen="|cff7fff00"
constant string C_brightgreen="|cff00ff00"
constant string C_brightblue="|cff0000ff"
constant string C_aqua="|cff00ffff"
constant string C_white="|cfff0ffff"
constant string C_seagreen="|cff7fffd4"
constant string C_twilightblur="|cff20b2aa"
constant string C_twilightgreen="|cff009966"
constant string C_coralgreen="|cff00fa9a"
constant string C_coralpink="|cfff08080"
constant string C_coralblue="|cff33aaff"
constant string C_plum="|cffba55d3"
constant string C_indigo="|cff4169e1"
constant string C_brightpurple="|cffff00ff"
constant string C_flowerred="|cffee2222"
constant string C_flowerpurple="|cffaaaaff"
constant string C_green="|cff32cd32"
constant string C_blue="|cff4169e1"
constant string C_yellowgreen="|cffadff2f"
constant string C_paledenim="|cffc3dbff"
constant string C_orange="|cffffa500"
constant string C_brightorange="|cffff8000"
constant string C_purple="|cffda70d6"  
constant string C_royalpurple="|cffaa00ff"  
constant string C_grey="|cffc0c0c0"
constant string C_gray="|cffc0c0c0"
constant string C_redorange="|cffff4500"
constant string C_red="|cffff0000"
constant string C_spanishgreen="|cff9acd32"
constant string C_darkspanishgreen="|cff6b8e23"
constant string C_brown ="|cff995500"
constant string C_yellow="|cffffff00"
constant string C_sand="|cffffffcc"
constant string C_CLOSE ="|r" 
endglobals
//! textmacro givetextcolor takes TYPEWORD
function gtc_$TYPEWORD$ takes string s returns string
return C_$TYPEWORD$ + s + C_CLOSE
endfunction
//! endtextmacro
//! runtextmacro givetextcolor("goldbrown")
//! runtextmacro givetextcolor("gold")
//! runtextmacro givetextcolor("palegreen")
//! runtextmacro givetextcolor("pretty")
//! runtextmacro givetextcolor("grassgreen")
//! runtextmacro givetextcolor("brightgreen")
//! runtextmacro givetextcolor("aqua")
//! runtextmacro givetextcolor("brightblue")
//! runtextmacro givetextcolor("white")
//! runtextmacro givetextcolor("seagreen")
//! runtextmacro givetextcolor("twilightblur")
//! runtextmacro givetextcolor("twilightgreen")
//! runtextmacro givetextcolor("coralgreen")
//! runtextmacro givetextcolor("coralpink")
//! runtextmacro givetextcolor("coralblue")
//! runtextmacro givetextcolor("plum")
//! runtextmacro givetextcolor("indigo")
//! runtextmacro givetextcolor("brightpurple")
//! runtextmacro givetextcolor("flowerred")
//! runtextmacro givetextcolor("flowerpurple")
//! runtextmacro givetextcolor("green")
//! runtextmacro givetextcolor("blue")
//! runtextmacro givetextcolor("yellowgreen")
//! runtextmacro givetextcolor("paledenim")
//! runtextmacro givetextcolor("orange")
//! runtextmacro givetextcolor("brightorange")
//! runtextmacro givetextcolor("purple")
//! runtextmacro givetextcolor("royalpurple")
//! runtextmacro givetextcolor("grey")
//! runtextmacro givetextcolor("gray")
//! runtextmacro givetextcolor("redorange")
//! runtextmacro givetextcolor("red")
//! runtextmacro givetextcolor("spanishgreen")
//! runtextmacro givetextcolor("darkspanishgreen")
//! runtextmacro givetextcolor("brown")
//! runtextmacro givetextcolor("yellow")
//! runtextmacro givetextcolor("sand")
function CheckRunnerCount takes nothing returns integer
local integer index=0
local integer total=0
loop
exitwhen index >12
if RUNNER[index] != null then
set total=total+1
endif
set index=index+1
endloop
return total
endfunction
function CheckChaserCount takes nothing returns integer
local integer index=0
local integer total=0
loop
exitwhen index >12
if CHASER[index] != null then
set total=total+1
endif
set index=index+1
endloop
return total
endfunction
function GetPlayerSlotMultiboard takes integer playerid returns integer
if playerid==0 then
return 0
elseif playerid==1 then
return 1
elseif playerid==2 then
return 3
elseif playerid==3 then
return 4
elseif playerid==4 then
return 5
elseif playerid==5 then
return 6
elseif playerid==6 then
return 7
elseif playerid==7 then
return 8
elseif playerid==8 then
return 9
elseif playerid==9 then
return 10
elseif playerid==10 then
return 2
elseif playerid==11 then
return 11
endif
return 12
endfunction
function FilterDebug takes nothing returns boolean
return true
endfunction
public function RUNNERPCE takes trigger trig, string s returns nothing
call TriggerRegisterPlayerChatEvent(trig,Player(2),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(3),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(4),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(5),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(6),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(7),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(8),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(9),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(11),s,true)
endfunction
public function CHASERPCE takes trigger trig, string s returns nothing
call TriggerRegisterPlayerChatEvent(trig,Player(0),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(1),s,true)
call TriggerRegisterPlayerChatEvent(trig,Player(10),s,true)
endfunction
public function RUNNERPCESS takes trigger trig, string s returns nothing
call TriggerRegisterPlayerChatEvent(trig,Player(2),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(3),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(4),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(5),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(6),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(7),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(8),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(9),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(11),s,false)
endfunction
public function CHASERPCESS takes trigger trig, string s returns nothing
call TriggerRegisterPlayerChatEvent(trig,Player(0),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(1),s,false)
call TriggerRegisterPlayerChatEvent(trig,Player(10),s,false)
endfunction
public function PLAYERLEAVING takes unit whichUnit returns nothing
call KillUnit(whichUnit)
call DisplayTextToPlayer(GetLocalPlayer(), 0, 0, ( GetPlayerName(GetTriggerPlayer()) + gtc_yellow(" has fled the tournament in terror!") ) )
endfunction
public function RUNNERPEL takes trigger trig returns nothing
call TriggerRegisterPlayerEvent(trig, Player (2), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (3), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (4), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (5), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (6), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (7), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (8), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (9), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (11), EVENT_PLAYER_LEAVE)
endfunction
public function CHASERPEL takes trigger trig returns nothing
call TriggerRegisterPlayerEvent(trig, Player (0), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (1), EVENT_PLAYER_LEAVE)
call TriggerRegisterPlayerEvent(trig, Player (10), EVENT_PLAYER_LEAVE)
endfunction
//
function USA takes integer x, integer y, string b, unit damager, unit a returns unit
local unit z = CreateUnit(GetOwningPlayer(damager),DUMMY,GetUnitX(a),GetUnitY(a),0.00)
call UnitAddAbility(z,x)
call SetUnitAbilityLevel(z,x,y)
call IssueTargetOrder(z,b,a)
call UnitApplyTimedLife(z, 'BTLF', 3.0)
set z=null
return a
endfunction
//
public function TRPEEC takes trigger trig returns nothing
call TriggerRegisterPlayerEventEndCinematic( trig, Player(0) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(1) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(2) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(3) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(4) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(5) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(6) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(7) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(8) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(9) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(10) )
call TriggerRegisterPlayerEventEndCinematic( trig, Player(11) )
endfunction
public function RUNNERPUE takes trigger trig, playerunitevent whichPlayerUnitEvent returns nothing
call TriggerRegisterPlayerUnitEvent( trig, Player(2),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(3),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(4),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(5),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(6),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(7),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(8),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(9),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(11),whichPlayerUnitEvent, null )
endfunction
//
public function CHASERPUE takes trigger trig, playerunitevent whichPlayerUnitEvent returns nothing
call TriggerRegisterPlayerUnitEvent( trig, Player(0),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(1),whichPlayerUnitEvent, null )
call TriggerRegisterPlayerUnitEvent( trig, Player(10),whichPlayerUnitEvent, null )
endfunction

//== snippet by Jesus4Lyf
function SetDistanceToUnit takes unit y, unit x, real dist returns nothing
local real rx=GetUnitX(x)-GetUnitX(y)
local real ry=GetUnitY(x)-GetUnitY(y)
local real factor=dist/SquareRoot(rx*rx+ry*ry)
call SetUnitX(x,GetUnitX(y)+rx*factor)
call SetUnitY(x,GetUnitY(y)+ry*factor)
endfunction
function SetDistanceToXY takes real rx, real ry, unit x, real dist returns nothing
local real tx=GetUnitX(x)-rx
local real ty=GetUnitY(x)-ry
local real factor=dist/SquareRoot(tx*tx+ty*ty)
call SetUnitX(x,rx+tx*factor)
call SetUnitY(x,ry+ty*factor)
endfunction
//extension to snippet.
function getdis takes unit x, unit y returns real
local real dx = GetUnitX(x) - GetUnitX(y)
local real dy = GetUnitY(x) - GetUnitY(y)
return SquareRoot(dx * dx + dy * dy)
endfunction
function getdisr takes real x, real y, unit z returns real
local real dx = x - GetUnitX(z)
local real dy = y - GetUnitY(z)
return SquareRoot(dx * dx + dy * dy)
endfunction
endlibrary
now i have 3 random functions like what you described. one is a random message system which might not interest you now, but if you want to look at it, you'll see that it's pretty simple.

let's just look at the final trigger i was using for the example
scroll down a little bit to the private function randomrunner and the other one called randomchaser

JASS:
scope pickmain initializer I
private function selfdestruct takes unit sd returns boolean
call UnitAddAbility(sd, 'A00W')
call IssueTargetOrder(sd,"transmute",GetTriggerUnit())
call UnitApplyTimedLife(sd, 'BTLF', 2.0 )
return false
endfunction
private function killhuman takes nothing returns boolean
if GetUnitTypeId(GetTriggerUnit())=='otau' and IsUnitIllusion(GetTriggerUnit())==false then
call StartSound(gg_snd_demonstration)
call msgall15(gtc_red("oh! Player "+GetPlayerName(GetOwningPlayer(GetTriggerUnit()))+" registered a human for the tournament! A vampire is eating his human runner!"))
elseif GetUnitTypeId(GetTriggerUnit())=='h00B' and IsUnitIllusion(GetTriggerUnit())==false then//peasant
elseif GetUnitTypeId(GetTriggerUnit())=='hdfR' and IsUnitIllusion(GetTriggerUnit())==false then
elseif GetUnitTypeId(GetTriggerUnit())=='nvlk' and IsUnitIllusion(GetTriggerUnit())==false then
elseif GetUnitTypeId(GetTriggerUnit())=='nvk2' and IsUnitIllusion(GetTriggerUnit())==false then
elseif GetUnitTypeId(GetTriggerUnit())=='nvlw' and IsUnitIllusion(GetTriggerUnit())==false then
elseif GetUnitTypeId(GetTriggerUnit())=='nvl2' and IsUnitIllusion(GetTriggerUnit())==false then
elseif GetUnitTypeId(GetTriggerUnit())=='hvil' and IsUnitIllusion(GetTriggerUnit())==false then
else
return false
endif
call USA('A00X',1,"rejuvination",GetTriggerUnit(),GetTriggerUnit())
return false
endfunction
private function fz takes nothing returns boolean
local trigger t =null
if GetUnitTypeId(GetTriggerUnit())=='uske' then
elseif GetUnitTypeId(GetTriggerUnit())=='ufro' then
set t=CreateTrigger()
call TriggerRegisterUnitInRangeSimple( t, 350.00,GetTriggerUnit())
call TriggerAddCondition( t, Condition(function killhuman) )
endif
return false
endfunction
private function randomeddemonmageskills takes nothing returns nothing
local integer ip = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
call UnitAddItemById(RUNNER[ip], 'I000')
call UnitAddItemById(RUNNER[ip], 'I001')
endfunction
private function demonmageskills takes nothing returns nothing
call UnitAddItemById(GetTrainedUnit(), 'I000')
call UnitAddItemById(GetTrainedUnit(), 'I001')
endfunction
private function chasertagfunction takes nothing returns nothing
set CHASER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))] = GetTrainedUnit()
endfunction
private function runnertagfunction takes nothing returns nothing
set RUNNER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))] = GetTrainedUnit()
endfunction
private function randomchaser takes nothing returns nothing
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local integer ip = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
call RemoveUnit(GetTrainedUnit())
set CHASER[ip] = CreateUnit(Player(ip), CHASERTYPEID[GetRandomInt(0,9)], x, y, GetRandomReal(0.00, 360.00))
endfunction
private function randomrunner takes nothing returns nothing
local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())
local integer ip = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
call RemoveUnit(GetTrainedUnit())
set RUNNER[ip] = CreateUnit(Player(ip), RUNNERTYPEID[GetRandomInt(0,25)], x, y, GetRandomReal(0.00, 360.00))
if GetUnitTypeId(RUNNER[ip]) == 'hdhw' then
call randomeddemonmageskills()
endif
endfunction
private function seticonformbi takes unit x returns boolean
local integer ip = GetPlayerSlotMultiboard(GetPlayerId(GetOwningPlayer(GetTriggerUnit())))
if GetUnitTypeId(x) =='edot' then
call jBoard_TDHT.field(ip,1).setIconPathR(ICON[GetUnitPointValue(RUNNER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))])])
return false
elseif GetUnitTypeId(x) =='edry' then
call jBoard_TDHT.field(ip,1).setIconPathR(ICON[GetUnitPointValue(CHASER[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))])])
return false
else
call jBoard_TDHT.field(ip,1).setIconPathR(ICON[GetUnitPointValue(x)])
return false
endif
return false
endfunction
private function rru takes nothing returns nothing
local integer ip = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
call UnitAddItemById(CHASER[ip], POINT)
call RemoveUnit(GetTriggerUnit())
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
call ClearSelection()
call SelectUnit(CHASER[ip], true)
endif   
endfunction
private function ru takes nothing returns nothing
call UnitAddItemById(GetTrainedUnit(), POINT)
call RemoveUnit(GetTriggerUnit())
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
call ClearSelection()
call SelectUnit(GetTrainedUnit(), true)
endif   
endfunction
private function spawnflyer takes nothing returns nothing
call RemoveUnit(GetTriggerUnit())
if runnerSERVANT[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))] == null then
set runnerSERVANT[GetPlayerId(GetOwningPlayer(GetTriggerUnit()))] = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'nnht', GetUnitX(GetTriggerUnit()), GetUnitY(GetTriggerUnit()), GetRandomReal(0.01, 360.00))
endif
endfunction
private function selectrunnernotflyer takes nothing returns nothing
local integer ip = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
if GetLocalPlayer() == GetOwningPlayer(GetTriggerUnit()) then
call ClearSelection()
call SelectUnit(RUNNER[ip], true)
endif   
endfunction
private function f takes nothing returns boolean
local integer i = GetUnitTypeId(GetTrainedUnit())
local integer it = GetUnitTypeId(GetTriggerUnit())
if it == DEMONGATEA or it == DEMONGATEB or it == DEMONGATEC then
if i == 'edot' then
call randomrunner()
call seticonformbi(GetTrainedUnit())
call spawnflyer()
call selectrunnernotflyer()
return false
elseif i == 'hdhw' then
call runnertagfunction()
call demonmageskills()
call seticonformbi(GetTrainedUnit())
call spawnflyer()
call selectrunnernotflyer()
return false
elseif i == 'otau' then
call runnertagfunction()
call seticonformbi(GetTrainedUnit())
call spawnflyer()
call selectrunnernotflyer()
return false
else
call runnertagfunction()
call seticonformbi(GetTrainedUnit())
call spawnflyer()
call selectrunnernotflyer()
return false
endif
elseif it == 'nfnp' then
if i == 'edry' then
call randomchaser()
call seticonformbi(GetTrainedUnit())
call rru()
return false
else
call chasertagfunction()
call seticonformbi(GetTrainedUnit())
call ru()
return false
endif
elseif it == 'nntt' then
if i == 'ebal' then
call selfdestruct(GetTrainedUnit())
return false
endif
return false
endif
return false
endfunction
private function I takes nothing returns nothing
local trigger t = CreateTrigger(  )
local integer i = 0
loop
exitwhen i>11
call TriggerRegisterPlayerUnitEvent( t, Player(i),EVENT_PLAYER_UNIT_TRAIN_FINISH, Filter(function FilterDebug) )
set i=i+1
endloop
call TriggerAddCondition( t, Condition(function f) )
set t=CreateTrigger()
call TriggerRegisterEnterRectSimple( t, GetEntireMapRect() )
call TriggerAddCondition( t, Condition(function fz) )
call XE_PreloadAbility('A00W')
call XE_PreloadAbility('A00X')
endfunction
endscope

there are some variables again.
take note of this line:
set RUNNER[ip] = CreateUnit(Player(ip), RUNNERTYPEID[GetRandomInt(0,25)], x, y, GetRandomReal(0.00, 360.00))
first we notice i didn't start off with call. that's because i wanted each player to have only one runner, so i might as well keep track of each runner. doesn't hurt.
but the second variable is one of the ones that i was pointing out earlier

RUNNERTYPEID, it's an integer array variable so i can put many integers under the same name, and do [GetRandomInt(0,25)] for a total of a random chance of getting 1/26 different units. if you look back up at the first trigger i pointed out from my map it has lines like this:
JASS:
set RUNNERTYPEID[0] = 'uaco'
set RUNNERTYPEID[1] = 'ushd'
set RUNNERTYPEID[2] = 'ugho'
set RUNNERTYPEID[3] = 'uabo'
set RUNNERTYPEID[4] = 'umtw'
set RUNNERTYPEID[5] = 'ucry'
set RUNNERTYPEID[6] = 'ugar'
set RUNNERTYPEID[7] = 'uban'
set RUNNERTYPEID[8] = 'unec'
set RUNNERTYPEID[9] = 'uobs'
set RUNNERTYPEID[10] = 'ufro'
set RUNNERTYPEID[11] = 'hfoo'
there's even 'hfoo' the code for footman, in there.
at any rate my map making style includes me putting a lot of information in fewer triggers, it helps me keep things organiazed. although you can possibly learn stuff from looking at the rest of those triggers, you might get more out of it if you were looking at the entire map, of course.

actually it is brand new code, these triggers won't be exactly as you would see in my latest map. that's because this code is from the map i'm currently working on(from m to n). i'm almost done updating the camera system(it was barebones before). i already gave it some functionality but i'm going to smooth out the functionality before releasing it.

also, if you like how unitpool and itempool work you can get a system called integer pools where you can do that sort of random chance with things such as my random message system. in fact i think after i work on the cameras i might just do that for that system.
 
Level 8
Joined
Aug 21, 2009
Messages
333
You don't need to know JASS to write leakless code.
Just create a Point variable: name it "temp_loc"
then each time you use a location, it won't leak if you make this update:

change
  • Unit - Order (Entering unit) to Attack-Move To (Center of main 1 <gen>)
to
  • Set temp_loc = (Center of main 1 <gen>)
  • Unit - Order (Entering unit) to Attack-Move To temp_loc
  • Custom script: call RemoveLocation(udg_temp_loc)
I don't know if cleaning up the leaks will stop your map from crashing, but it's definitely worth a try.
 
Level 6
Joined
Aug 30, 2005
Messages
161
You don't need to know JASS to write leakless code.
Just create a Point variable: name it "temp_loc"
then each time you use a location, it won't leak if you make this update:

change
  • Unit - Order (Entering unit) to Attack-Move To (Center of main 1 <gen>)
to
  • Set temp_loc = (Center of main 1 <gen>)
  • Unit - Order (Entering unit) to Attack-Move To temp_loc
  • Custom script: call RemoveLocation(udg_temp_loc)
I don't know if cleaning up the leaks will stop your map from crashing, but it's definitely worth a try.

I am a simple man and i like simple things, i will try this first and if it doesn't work ill go with what SanKakU suggested. I will also like to thank everyone who has offered help one way or another... i really appreciate the quick and helpful replies.
 
Status
Not open for further replies.
Top