• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Why Shouldn't Respawn Work

Status
Not open for further replies.
Level 19
Joined
Aug 8, 2007
Messages
2,765
  • GetIndex
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set CreepRespawnTable = (Last created hashtable)
      • Set Temp_UnitGroup = (Units within 1000000000.00 of MapCenter)
      • Unit Group - Pick every unit in Temp_UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Neutral Hostile
            • Then - Actions
              • Set TempLoc = (Position of (Picked unit))
              • Set TempReal = (X of TempLoc)
              • Hashtable - Save TempReal as 1 of (Custom value of (Picked unit)) in CreepRespawnTable
              • Set TempReal = (Y of TempLoc)
              • Hashtable - Save TempReal as 2 of (Custom value of (Picked unit)) in CreepRespawnTable
              • Set TempReal = (Facing of (Picked unit))
              • Hashtable - Save TempReal as 3 of (Custom value of (Picked unit)) in CreepRespawnTable
              • Custom script: call RemoveLocation(udg_TempLoc)
            • Else - Actions
              • Unit Group - Remove (Picked unit) from Temp_UnitGroup
      • Custom script: call DestroyGroup(udg_Temp_UnitGroup)

  • Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Neutral Hostile
    • Actions
      • Custom script: local unit u = GetDyingUnit()
      • Custom script: local integer i = GetUnitUserData(u)
      • Custom script: set udg_TempUnit = u
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of TempUnit) Equal to |cffff4500[Boss]|r Bandit Lord (Female)
              • (Unit-type of TempUnit) Equal to |cffff7f50[Semi-Boss]|r Bandit Lord Assistant
              • (Unit-type of TempUnit) Equal to |cff800080[Elite]|r Kobold Head-Cheif
        • Then - Actions
          • Set CV = (Custom value of TempUnit)
          • Game - Display to (All players) for 30.00 seconds the text: ((String((Load CV of 0 from CreepRespawnTable))) + (Load CV of 1 from CreepRespawnTable))
          • Wait 30.00 seconds
          • Custom script: set udg_TempUnit = u
          • Custom script: set udg_CV = i
          • Unit - Create 1 (Unit-type of TempUnit) for Neutral Hostile at (Point((Load 1 of CV from CreepRespawnTable), (Load 2 of CV from CreepRespawnTable))) facing (Load 3 of CV from CreepRespawnTable) degrees
          • Set TempLoc = (Position of (Last created unit))
          • Set TempReal = (X of TempLoc)
          • Set TempReal2 = (Y of TempLoc)
          • Set TempReal3 = (Facing of (Last created unit))
          • Hashtable - Save TempReal as 1 of (Custom value of (Last created unit)) in CreepRespawnTable
          • Hashtable - Save TempReal2 as 2 of (Custom value of (Last created unit)) in CreepRespawnTable
          • Hashtable - Save TempReal3 as 3 of (Custom value of (Last created unit)) in CreepRespawnTable
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Game - Display to (All players) for 30.00 seconds the text: ((String((Load CV of 0 from CreepRespawnTable))) + (Load CV of 1 from CreepRespawnTable))
          • Hashtable - Clear all child hashtables of child (Custom value of TempUnit) in CreepRespawnTable
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set CV = (Custom value of TempUnit)
              • Game - Display to (All players) for 30.00 seconds the text: ((String((Load CV of 0 from CreepRespawnTable))) + (Load CV of 1 from CreepRespawnTable))
              • Wait 15.00 seconds
              • Custom script: set udg_TempUnit = u
              • Custom script: set udg_CV = i
              • Unit - Create 1 (Unit-type of TempUnit) for Neutral Hostile at (Point((Load 1 of CV from CreepRespawnTable), (Load 2 of CV from CreepRespawnTable))) facing (Load 3 of CV from CreepRespawnTable) degrees
              • Set TempLoc = (Position of (Last created unit))
              • Set TempReal = (X of TempLoc)
              • Set TempReal2 = (Y of TempLoc)
              • Set TempReal3 = (Facing of (Last created unit))
              • Hashtable - Save TempReal as 1 of (Custom value of (Last created unit)) in CreepRespawnTable
              • Hashtable - Save TempReal2 as 2 of (Custom value of (Last created unit)) in CreepRespawnTable
              • Hashtable - Save TempReal3 as 3 of (Custom value of (Last created unit)) in CreepRespawnTable
              • Custom script: call RemoveLocation(udg_TempLoc)
              • Game - Display to (All players) for 30.00 seconds the text: ((String((Load CV of 0 from CreepRespawnTable))) + (Load CV of 1 from CreepRespawnTable))
              • Hashtable - Clear all child hashtables of child (Custom value of TempUnit) in CreepRespawnTable
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                • Then - Actions
                • Else - Actions
Above respawns at center of map... (yes im using a unit indexing system

Also
  • Lightning Periodic
    • Events
      • Time - Every 6.00 seconds of game time
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in LightningStormGroup) Not equal to 0
        • Then - Actions
          • Unit Group - Pick every unit in LightningStormGroup and do (Actions)
            • Loop - Actions
              • Set TempUnit = (Picked unit)
              • Set TempLoc = (Position of TempUnit)
              • Set TempUnitGroup2 = (Units within (525.00 + (75.00 x (Real((Level of Mind of the Storm T1 ELEM for TempUnit))))) of TempLoc matching (((Owner of (Matching unit)) Equal to Neutral Hostile) or ((Owner of (Matching unit)) Equal to Player 12 (Brown))))
              • Custom script: call RemoveLocation(udg_TempLoc)
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Number of units in TempUnitGroup2) Not equal to 0
                • Then - Actions
                  • Unit Group - Pick every unit in TempUnitGroup2 and do (Actions)
                    • Loop - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Picked unit) is alive) Equal to True
                        • Then - Actions
                          • Set TempLoc = (Position of (Picked unit))
                          • Special Effect - Create a special effect at TempLoc using war3mapImported\Great Lightning.mdx
                          • Special Effect - Destroy (Last created special effect)
                          • Unit - Cause TempUnit to damage (Picked unit), dealing (((Real((Intelligence of TempUnit (Include bonuses)))) x (2.00 + (Real((Level of Mind of the Storm T1 ELEM for TempUnit))))) + 0.00) damage of attack type Spells and damage type Normal
                          • Custom script: call RemoveLocation(udg_TempLoc)
                        • Else - Actions
                • Else - Actions
        • Else - Actions
Only deals damage to one unit...

Also another question : How do i apply a buff to a unit for tracking purposes? (some buffs must be visible, some buffs prefered not to be visible)
 
  • Set Temp_UnitGroup = (Units within 1000000000.00 of MapCenter)
->
  • Set Temp_UnitGroup = (Units in (Playable map area)
  • dfgdfg
    • Events
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set CreepRespawnTable = (Last created hashtable)
      • Custom script: Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to Neutral Hostile)) and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set TempInteger = (Custom value of TempUnit)
          • Set TempLoc = (Position of TempUnit)
          • Custom script: call SaveReal(udg_CreepRespawnTable,1,udg_TempInteger,GetLocationX(udg_TempLoc))
          • Custom script: call SaveReal(udg_CreepRespawnTable,2,udg_TempInteger,GetLocationY(udg_TempLoc))
          • Custom script: call SaveReal(udg_CreepRespawnTable,3,udg_TempInteger,GetUnitFacing(udg_TempUnit))
          • Custom script: call RemoveLocation(udg_TempLoc)
  • Custom script: local unit u = GetDyingUnit()
  • Custom script: local integer i = GetUnitUserData(u)
  • >>>Custom script: set udg_TempUnit = u<<<
You cannot use global variables with waits.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
  • Set Temp_UnitGroup = (Units within 1000000000.00 of MapCenter)
->
  • Set Temp_UnitGroup = (Units in (Playable map area)

I prefer to not use that because, for some reason, that produces incorrect results occasionally.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Ill test changing the initialization trigger, but why cant i use globals? i re-assign the globals to the locals after the waits
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
the trigger madeem posted didnt work.

And about the lightning ability, the problem is TempUnit is getting wiped....
 
  • dfgdfg
    • Events
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set CreepRespawnTable = (Last created hashtable)
      • Custom script: Custom script: set bj_wantDestroyGroup = true
      • Unit Group - Pick every unit in (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to Neutral Hostile)) and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set TempInteger = (Custom value of TempUnit)
          • Custom script: call SaveReal(udg_CreepRespawnTable,1,udg_TempInteger,GetUnitX(udg_TempUnit))
          • Custom script: call SaveReal(udg_CreepRespawnTable,2,udg_TempInteger,GetUnitY(udg_TempUnit))
          • Custom script: call SaveReal(udg_CreepRespawnTable,3,udg_TempInteger,GetUnitFacing(udg_TempUnit))
This does indeed work.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
hm.. i put a debug before call savereal that prints tempinteger and it ALWAYS returned 0.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
That means your indexing system is faulty, or this is running before the indexer can initialize.
Try replacing the indexing system by using unit handles like this
  • Custom script: set udg_TempInteger = GetHandleId(udg_TempUnit)

indexer dont work in map init, need elapsed time 0.01 atleast i think coz i tryed once and at map init every unit got 0 custom value so its mean indexer work after map init

but why somebody want it indexing in map init? its damn useless....

u can use the indexer trigger example is here http://www.hiveworkshop.com/forums/2107984-post13.html

its allways store the deault position what was when game started and dont need unit group or hashtable for this
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Not 0.01, but 0 seconds.
Map intialization works as well, but it depends on how your triggers are orgranized.

If you have Unit Indexer at the top of the triggers list, it should be initialized first.

By the way, 92083 should be used instead of 1000000000.

but why usefull to store units coord and map init instead in indexer? just +1 hash and anyway must keep tracking the cv in unit dying trigger so similiar in speed the 2 methode just longer
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Not 0.01, but 0 seconds.
Map intialization works as well, but it depends on how your triggers are orgranized.

If you have Unit Indexer at the top of the triggers list, it should be initialized first.

By the way, 92083 should be used instead of 1000000000.

Even if the map is a 480x480?

Anyway, the indexer was below the trigger so im going to try it with the indexer above
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Because thatd require just another 8192 array variable

Anyway, it returns the proper numbers on init now but it still returns 0.0000 on respawn

  • GetIndex
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set CreepRespawnTable = (Last created hashtable)
      • Set Temp_UnitGroup = (Units in (Playable map area) matching ((Owner of (Matching unit)) Equal to Neutral Hostile))
      • Unit Group - Pick every unit in Temp_UnitGroup and do (Actions)
        • Loop - Actions
          • Set TempUnit = (Picked unit)
          • Set TempInt = (Custom value of TempUnit)
          • Set TempLoc = (Position of TempUnit)
          • Game - Display to (All players) the text: (String(TempInt))
          • Custom script: call SaveReal(udg_CreepRespawnTable,1,udg_TempInt,GetLocationX(udg_TempLoc))
          • Custom script: call SaveReal(udg_CreepRespawnTable,2,udg_TempInt,GetLocationY(udg_TempLoc))
          • Custom script: call SaveReal(udg_CreepRespawnTable,3,udg_TempInt,GetUnitFacing(udg_TempUnit))
          • Custom script: call RemoveLocation(udg_TempLoc)
      • Custom script: call DestroyGroup(udg_Temp_UnitGroup)
  • Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Neutral Hostile
    • Actions
      • Custom script: local unit u = GetDyingUnit()
      • Custom script: local integer i = GetUnitUserData(u)
      • Custom script: set udg_TempUnit = u
      • Custom script: set udg_CV = i
      • Game - Display to (All players) for 30.00 seconds the text: (String(CV))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Unit-type of TempUnit) Equal to |cffff4500[Boss]|r Bandit Lord (Female)
              • (Unit-type of TempUnit) Equal to |cffff7f50[Semi-Boss]|r Bandit Lord Assistant
              • (Unit-type of TempUnit) Equal to |cff800080[Elite]|r Kobold Head-Cheif
        • Then - Actions
          • Set CV = (Custom value of TempUnit)
          • Game - Display to (All players) for 30.00 seconds the text: ((String((Load 0 of CV from CreepRespawnTable))) + (Load 1 of CV from CreepRespawnTable))
          • Wait 30.00 seconds
          • Custom script: set udg_TempUnit = u
          • Custom script: set udg_CV = i
          • Unit - Create 1 (Unit-type of TempUnit) for Neutral Hostile at (Point((Load 1 of CV from CreepRespawnTable), (Load 2 of CV from CreepRespawnTable))) facing (Load 3 of CV from CreepRespawnTable) degrees
          • Set TempLoc = (Position of (Last created unit))
          • Set TempReal = (X of TempLoc)
          • Set TempReal2 = (Y of TempLoc)
          • Set TempReal3 = (Facing of (Last created unit))
          • Hashtable - Save TempReal as 1 of (Custom value of (Last created unit)) in CreepRespawnTable
          • Hashtable - Save TempReal2 as 2 of (Custom value of (Last created unit)) in CreepRespawnTable
          • Hashtable - Save TempReal3 as 3 of (Custom value of (Last created unit)) in CreepRespawnTable
          • Custom script: call RemoveLocation(udg_TempLoc)
          • Game - Display to (All players) for 30.00 seconds the text: ((String((Load CV of 0 from CreepRespawnTable))) + (Load CV of 1 from CreepRespawnTable))
          • Hashtable - Clear all child hashtables of child (Custom value of TempUnit) in CreepRespawnTable
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set CV = (Custom value of TempUnit)
              • Wait 15.00 seconds
              • Custom script: set udg_TempUnit = u
              • Custom script: set udg_CV = i
              • Unit - Create 1 (Unit-type of TempUnit) for Neutral Hostile at (Point((Load 1 of CV from CreepRespawnTable), (Load 2 of CV from CreepRespawnTable))) facing (Load 3 of CV from CreepRespawnTable) degrees
              • Set TempLoc = (Position of (Last created unit))
              • Set TempReal = (X of TempLoc)
              • Set TempReal2 = (Y of TempLoc)
              • Set TempReal3 = (Facing of (Last created unit))
              • Hashtable - Save TempReal as 1 of (Custom value of (Last created unit)) in CreepRespawnTable
              • Hashtable - Save TempReal2 as 2 of (Custom value of (Last created unit)) in CreepRespawnTable
              • Hashtable - Save TempReal3 as 3 of (Custom value of (Last created unit)) in CreepRespawnTable
              • Custom script: call RemoveLocation(udg_TempLoc)
              • Game - Display to (All players) for 30.00 seconds the text: ((String((Load CV of 0 from CreepRespawnTable))) + (Load CV of 1 from CreepRespawnTable))
              • Hashtable - Clear all child hashtables of child (Custom value of TempUnit) in CreepRespawnTable
            • Else - Actions
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Because thatd require just another 8192 array variable

and in your map you have more unit than 8192? else if no then its better coz u dont need to use alot times the loadreal functions and free 1 hash also dont need unit group in map init (maybe wrong but i heard more thing in map init=>longer loading time) :p

i dont think its problem if u use +few real/integer variable array

Anyway, it returns the proper numbers on init now but it still returns 0.0000 on respawn

try what we said
 
Last edited:
Level 37
Joined
Mar 6, 2006
Messages
9,243
Even if the map is a 480x480?

A square is 128 distance units.

480*128 = 61440. Coordinates go from -x to +x, but we will offset them by x so the coordinates of lower left corner is (0,0) and upper right corner is (61440,61440)

Distance from lower left to upper right is sqrt(2*61440^2) = 86889.

I tried displaying distance between min x, miny and max x, max y of entire map and it displayed 86890.xx on a 480x480 map.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
"try what we said"

What did you say? ��

use the unit indexer event instead map init, then also dont need pick all unit on map, just make a if about unit is neutral hostile or no

That means your indexing system is faulty, or this is running before the indexer can initialize.

indexer dont work in map init, need elapsed time 0.01 atleast i think coz i tryed once and at map init every unit got 0 custom value so its mean indexer work after map init

Not 0.01, but 0 seconds.

i posted already once this link :p
http://www.hiveworkshop.com/forums/2107984-post13.html

in indexer u save coordonate exactly when unit get the index, its mean its allways save without problem, also u can consider the useing variables because faster and i doubt this real arrays eat more than hashtable

or just try elapsed time instead map init (but still i am sure indexer event the best way)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
If the indexing system does this, it is crap.

nooooooooo the indexing systeem is fine god damnit

  • Respawn
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Dying unit)) Equal to Neutral Hostile
    • Actions
      • Custom script: local unit u = GetDyingUnit()
      • Custom script: local integer i = GetUnitUserData(u)
      • Custom script: set udg_TempUnit = u
      • Custom script: set udg_CV = i
      • Game - Display to (All players) for 30.00 seconds the text: (String(CV))
returns the right value

  • Game - Display to (All players) for 30.00 seconds the text: ((String((Load 0 of CV from CreepRespawnTable))) + (Load 1 of CV from CreepRespawnTable))
returns 0
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
do
  • Custom script:set udg_Integer = LoadInteger(udg_CreepRespawnTable,1,i)

JASS:
    local integer i = GetUnitUserData(u)
    local integer i3
    local real r1
    set i3 = LoadInteger(udg_CreepRespawnTable, 1, i)
    call DisplayTimedTextToForce(GetPlayersAll(), 30, I2S(i3))

shows 0
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
  • Custom script: call SaveReal(udg_CreepRespawnTable,1,udg_TempInt,GetLocationX(udg_TempLoc))
  • Load 1 of CV from CreepRespawnTable)
The first function uses jass native function. The syntax is
(hashtable, parentKey, childKey, value)

The second action uses GUI function, BJ wrapper. The syntax is
(childKey, parentKey, hastable)

You are saving stuff by using 1, 2 and 3 as parent keys, but trying to load data by using custom value as parent keys. You should save data by using the custom value as parent key and 1, 2 and 3 as child keys.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
put the 1, 2, and 3 on the other side of TempInt but it still doesnt work.. this is honestly pissin me off atm
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Please try to not use acronyms.

So you can turn on/off unit-type spawns? Are all spawns of the same type ID independent, or is each unit independent? Like, does each unit respawn individually, are their separate groups of spawns, or do all units of the same type ID spawn at the same time?
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Neutral Hostile, sorry.

Turn off/on unit type, yes. if possible, units within 200 of eachother respawn together. Preferably able to change respawn type based on unit type. No need for specific unit spawn times
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Well if units are considered in groups then do groups respawn at the same interval, only if the unit types associated with that group are also turned on?

If a unit-type is not currently spawning, and you turn it on how would you determine what group to put it in?

Please explain how you want the group mechanics to work. I think I see what you're saying by the spawn-type-per-unit-ID thing, though.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Unit Types will not be turned back on, thats basically a typo on my part.

Unit Types should be different groups than the ones with different respawn time. say, 2 unit types have 30sec respawn and another 2 have 45sec and they are close enough to be in one "group". Kill a unit of the first unit type, and the 30sec starts. Kill a unit as the second type, the 30sec restarts. Kill a third unit type, the 45sec starts but 30sec is untouched. Kill a fourth, the 45sec restarts but 30sec still remains untouched.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
no. units with the same respawntime respawn together but individually from units that have a different respawn time or starting location from atleast one of the units in the unit group > 200
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Okay so if unit of type A dies, then another unit of the same type dies, should they both respawn at the time designated by the second unit dying? I think I have enough to start off with but I will ask questions if I need to. I'm just working on some assembly code though so I'll try to start making it as soon as possible.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Except, not unit types, unit types with the same respawn time (so if two unit types are in a group, both with registered 30sec, than they respawn together)

and if you could do it ud be my.... 4th best hive member ever ^^
 
Level 18
Joined
Jan 21, 2006
Messages
2,552
Okay well sounds simple enough. I'll have something for you soon.

By the way. I'm going to use AutoIndex for now because it doesn't look like you're on. If I need to change a few things that shouldn't be a problem.
 
Last edited:
Status
Not open for further replies.
Top