Calling tmpPoint in GUI ?

killbuzz

Member
Reaction score
9
I'm currently working on a creep respawn system that will respawn the dead creep in its original location and only if there are no enemy players nearby. here is what I have so far:
Code:
Respawn Init
    Events
        Map initialization
    Conditions
    Actions
        Set Respawn_Time = 25.00
        Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
            Loop - Actions
                Set Temp_Integer = (Temp_Integer + 1)
                Unit - Set the custom value of (Picked unit) to Temp_Integer
                Set Creep_Point[Temp_Integer] = (Position of (Picked unit))
                Set Creep_Angle[Temp_Integer] = (Facing of (Picked unit))

Code:
Respawn
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Not equal to Sapphiron (undead)
                (Unit-type of (Triggering unit)) Not equal to Lich King (Evil)
                (Unit-type of (Triggering unit)) Not equal to Ghost
                (Unit-type of (Triggering unit)) Not equal to Horn of Cenarius Pedestal
                (Unit-type of (Triggering unit)) Not equal to Unique Artifact
                ((Triggering unit) is A Hero) Equal to False
                ((Triggering unit) is Summoned) Equal to False
                (Custom value of (Triggering unit)) Greater than 0
                ((Triggering unit) is A flying unit) Equal to False
    Actions
        Custom script:  local integer i = GetUnitTypeId(GetTriggerUnit())
        Custom script:  local integer ii = GetUnitUserData(GetTriggerUnit())
        Custom script:  local location tmpPoint = GetUnitLoc(GetTriggerUnit())
        Wait until (((Units within 800.00 of tmpPoint matching (((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True)) is empty) Equal to True), checking every Respawn_Time seconds
        Custom script:  call SetUnitUserData(CreateUnit(Player(12),i,GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),udg_Creep_Angle[ii]),ii)
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
        Custom script:  call RemoveLocation (udg_tmpPoint)
I'm having problems with the local location 'tmpPoint' I would like to call it in the wait until function and I'm wondering if its possible/how to do it. I have tried converting to custom text and editing the variables from there but I always get an error.
 

vypur85

Hibernate
Reaction score
803
Code:
Wait until (((Units within 800.00 of tmpPoint matching (((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True)) is empty) Equal to True), checking every Respawn_Time seconds
This tmpPoint is actually a global variable.

When you set this variable,
Code:
Custom script:  local location tmpPoint = GetUnitLoc(GetTriggerUnit())
it's a local variable.

So you have 2 different variables here, tmpPoint and udg_tmpPoint. They are separate entity, which is why your trigger didn't work.

Also, local variables are known to not work in GUI condition block.

My suggestion is to use periodic trigger. When a unit dies, add the unit into a unit group. Then periodically check for presence of units around the said unit. If no units around, create your creep and set their custom value accordingly. Then, remove the dead unit from the unit group.
 

killbuzz

Member
Reaction score
9
That could potentially work, but the problem with that is when the corpse decays/is raised it will be removed from the unit group, and then revived at the next condition check. I tried to solve this in my original trigger by hiding the dying unit, suspending corpse decay on that unit, then creating a corpse of that unit type so there was still something to be raised:
Code:
Respawn
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Not equal to Sapphiron (undead)
                (Unit-type of (Triggering unit)) Not equal to Lich King (Evil)
                (Unit-type of (Triggering unit)) Not equal to Ghost
                (Unit-type of (Triggering unit)) Not equal to Horn of Cenarius Pedestal
                (Unit-type of (Triggering unit)) Not equal to Unique Artifact
                ((Triggering unit) is A Hero) Equal to False
                ((Triggering unit) is Summoned) Equal to False
                (Custom value of (Triggering unit)) Greater than 0
                ((Triggering unit) is A flying unit) Equal to False
    Actions
        Custom script:  local integer i = GetUnitTypeId(GetTriggerUnit())
        Custom script:  local integer ii = GetUnitUserData(GetTriggerUnit())
        Unit - Hide (Triggering unit)
        Unit - Suspend corpse decay for (Triggering unit)
        Unit - Create a (Unit-type of (Triggering unit)) corpse for Neutral Hostile at (Position of (Triggering unit))
        Wait until (((Units within 800.00 of Creep_Point[(Custom value of (Triggering unit))] matching (((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True)) is empty) Equal to True), checking every Respawn_Time seconds
        Custom script:  call SetUnitUserData(CreateUnit(Player(12),i,GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),udg_Creep_Angle[ii]),ii)
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
This didn't work as creatures like revenants don't have corpses so it would just create their base models and I think it would screw up the custom value of the unit as well. (Had mobs respawning when players were nearby) I also tried to put the location of the triggering unit into another point array, in hopes that it would bypass the corpse decay problem:
Code:
Respawn
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Not equal to Sapphiron (undead)
                (Unit-type of (Triggering unit)) Not equal to Lich King (Evil)
                (Unit-type of (Triggering unit)) Not equal to Ghost
                (Unit-type of (Triggering unit)) Not equal to Horn of Cenarius Pedestal
                (Unit-type of (Triggering unit)) Not equal to Unique Artifact
                ((Triggering unit) is A Hero) Equal to False
                ((Triggering unit) is Summoned) Equal to False
                (Custom value of (Triggering unit)) Greater than 0
                ((Triggering unit) is A flying unit) Equal to False
    Actions
        Custom script:  local integer i = GetUnitTypeId(GetTriggerUnit())
        Custom script:  local integer ii = GetUnitUserData(GetTriggerUnit())
        Set tmpPointArray[(Custom value of (Triggering unit))] = Creep_Point[(Custom value of (Triggering unit))]
        Wait until (((Units within 800.00 of tmpPointArray[(Custom value of (Triggering unit))] matching (((Matching unit) belongs to an enemy of Neutral Hostile) Equal to True)) is empty) Equal to True), checking every Respawn_Time seconds
        Custom script:  call SetUnitUserData(CreateUnit(Player(12),i,GetLocationX(udg_Creep_Point[ii]),GetLocationY(udg_Creep_Point[ii]),udg_Creep_Angle[ii]),ii)
        Unit - Set the custom value of (Last created unit) to (Custom value of (Triggering unit))
That didn't work either, as it seemed to set the most recently killed unit as the position for all of the currently dead creeps.
I thought I had read somewhere that if you called a local variable in a GUI condition with the same name it would work properly, but I guess I read wrong or else blizz changed it. So if it isn't possible my next question is how do I go about solving the creeps that have no corpses problem?
Thank you for your reply btw :)

EDIT: Seems like adding every dead unit to a single group wouldn't work, because either all of the creep locations would have to have a player nearby or else all the creeps would respawn, or the opposite would happen and none of the creeps would respawn if even 1 location had a player nearby. Maybe i'm missing something?
 

vypur85

Hibernate
Reaction score
803
> I thought I had read somewhere that if you called a local variable in a GUI condition with the same name it would work properly, but I guess I read wrong or else blizz changed it

Don't think this is possible. I believe what you read was globalising the local variable. Ie, you create a local variable, then you set the local variable as a global variable. Then you use this global within a condition block. This way, you can 'mask' the local variable usage within GUI conditions. But I guess this way won't do it for your case here.


> Seems like adding every dead unit to a single group wouldn't work

I can imagine it to work though. Just add them into single group. Within that group, you create another group again for each picked unit:

Code:
Pick... in SomeUnitGroup and do...
   Loop - Actions
     Set TempGroup - Units within 300 range of Position of Picked unit
     If number of unit in TempGroup is 0, then....
         - Remove Picked unit grom SomeUnitGroup
         - Create your new creep at Somewhere[Custom value of Picked unit]

Some thing along the line, perhaps? Of course, by doing this, you'd need to make sure the decay time for units is set to a large value, about 88 seconds seem fine to me.


> solving the creeps that have no corpses problem?

Make the unit drop corpse upon death. This can be set in the Object Editor for that specific unit.


Ps: Not sure how familiar are you with WE. But from the triggers you posted above, you seemed rather experienced. So I just generally describe my ideas here.
 

killbuzz

Member
Reaction score
9
Ok I think I see what you are getting at and how it could be made to work, just wondering what exactly 'make unit drop corpse on death' does? Will it make the trigger behave differently? I'll set something up for this, thank you for the help :). (Also i'm just coming back to WE after a 2 year break, starting to use custom script and wish I had started a long time ago lol)

EDIT: Alright here are all the triggers I have:
Code:
Respawn Setup
    Events
        Map initialization
    Conditions
    Actions
        Set Respawn_Time = 25.00
        Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
            Loop - Actions
                Set Temp_Integer = (Temp_Integer + 1)
                Unit - Set the custom value of (Picked unit) to Temp_Integer
                Set Creep_Point[Temp_Integer] = (Position of (Picked unit))
                Set Creep_Angle[Temp_Integer] = (Facing of (Picked unit))

Code:
Respawn Init
    Events
        Unit - A unit owned by Neutral Hostile Dies
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Triggering unit)) Not equal to Sapphiron (undead)
                (Unit-type of (Triggering unit)) Not equal to Lich King (Evil)
                (Unit-type of (Triggering unit)) Not equal to Ghost
                (Unit-type of (Triggering unit)) Not equal to Horn of Cenarius Pedestal
                (Unit-type of (Triggering unit)) Not equal to Unique Artifact
                ((Triggering unit) is A Hero) Equal to False
                ((Triggering unit) is Summoned) Equal to False
                (Custom value of (Triggering unit)) Greater than 0
                ((Triggering unit) is A flying unit) Equal to False
    Actions
        Unit Group - Add (Triggering unit) to DeadCreeps

Code:
Respawn
    Events
        Time - Every 25.00 seconds of game time
    Conditions
        (Number of units in (Units within 800.00 of (Position of (Picked unit)) matching ((Owner of (Matching unit)) Not equal to Neutral Hostile))) Equal to 0
    Actions
        Unit Group - Pick every unit in DeadCreeps and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of units in (Units within 800.00 of (Position of (Picked unit)) matching ((Owner of (Matching unit)) Not equal to Neutral Hostile))) Equal to 0
                    Then - Actions
                        Unit - Create 1 (Unit-type of (Picked unit)) for Neutral Hostile at Creep_Point[(Custom value of (Picked unit))] facing Creep_Angle[(Custom value of (Picked unit))] degrees  <--- Turns out I wasn't able to put custom script here for some reason
                        Unit - Set the custom value of (Last created unit) to (Custom value of (Picked unit))
                        Unit Group - Remove (Picked unit) from DeadCreeps
                    Else - Actions
                        Do nothing

So assuming that "Make Unit Drop Corpse on Death" solves the decaying problem then I should be all set unless there are some leaks I forgot to clean up, kinda tired atm.
EDIT 2: Checked the object editor and i'm not seeing the option to make unit drop corpse on death, do you happen to know what it would be under? (art/combat/stats/etc.)
 

killbuzz

Member
Reaction score
9
I've recently made a respawn system that meets your requirements, here's the link.

I actually came across your trigger when I was first trying to set this whole thing up, but I really don't know how stuff like 'for each integer A do actions' works. Also, does this work even after a dying units corpse has decayed? Because that is the only problem I am having with my current triggers. Thanks for your reply :)
 

thorhunter

You can change this now in User CP.
Reaction score
32
Yes, the variables are stored at the map initialization and right after unit is respawned, so they work independly of the state of an unit. Units will respawn in their original location, despite being killed in another. Also, things like 'Remove Unit' won't affect the trigger since the condition 'Unit is Alive' will return false if the unit no longer exists, is dead and also, from what I noticed and tested, reanimated.
 

killbuzz

Member
Reaction score
9
Alright, awesome :D I looked it over again and I don't think it will be to difficult to figure out, thank you both for your replies and i'm glad this is finally dealt with. :) (Seems like TheHelper has changed since I was last here, I guess I cant give out +rep anymore?)
 

thorhunter

You can change this now in User CP.
Reaction score
32
You're welcome. If you'll find any bugs or issues with the system let me know, since I'm using it myself and will work out the fixes. I'm not familiar with +rep options since I never actually used it so I can't address your question.
 

killbuzz

Member
Reaction score
9
If you'll find any bugs or issues with the system let me know, since I'm using it myself and will work out the fixes
Alright no problem. Not going to start on it tonight though, I know I'd make to many mistakes, sometime tomorrow I think.
 

vypur85

Hibernate
Reaction score
803
> Make Unit Drop Corpse on Death

I believe it is the Death Type - Can't raise, can decay.... Or something along the line. Just test and see if it works or not. Good that everything worked out for you.
 

killbuzz

Member
Reaction score
9
> Make Unit Drop Corpse on Death

I believe it is the Death Type - Can't raise, can decay.... Or something along the line. Just test and see if it works or not. Good that everything worked out for you.

Ahh I see, and no that didnt work :| oh well going to start on the new system now :)

EDIT: finished the new trigger, and everything seems to be working fine now, thanks again and if I have any problems with it I will let you know.
Code:
Respawn Setup
    Events
        Map initialization
    Conditions
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area) owned by Neutral Hostile) and do (Actions)
            Loop - Actions
                Set Temp_Integer = (Temp_Integer + 1)
                Unit - Set the custom value of (Picked unit) to Temp_Integer
                Set Creep[Temp_Integer] = (Picked unit)
                Set CreepUnitType[Temp_Integer] = (Unit-type of (Picked unit))
                Set Creep_Point[Temp_Integer] = (Position of (Picked unit))
                Set Creep_Angle[Temp_Integer] = (Facing of (Picked unit))
                Set CreepTimer[Temp_Integer] = 76

Code:
Respawn
    Events
        Time - Every 2.00 seconds of game time
    Conditions
    Actions
        For each (Integer A) from 1 to Temp_Integer, do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Creep[(Integer A)] is alive) Equal to False
                    Then - Actions
                        Set Temp_Boolean = False
                        Set TempGroup = (Units within 800.00 of Creep_Point[(Integer A)])
                        Unit Group - Pick every unit in TempGroup and do (Actions)
                            Loop - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        ((Picked unit) belongs to an enemy of Neutral Hostile) Equal to True
                                    Then - Actions
                                        Set Temp_Boolean = True
                                    Else - Actions
                        Custom script:  call DestroyGroup(udg_TempGroup)
                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            If - Conditions
                                Temp_Boolean Equal to False
                            Then - Actions
                                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                    If - Conditions
                                        CreepTimer[(Integer A)] Greater than 0
                                    Then - Actions
                                        Set CreepTimer[(Integer A)] = (CreepTimer[(Integer A)] - 2)
                                    Else - Actions
                                        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                            If - Conditions
                                                CreepTimer[(Integer A)] Equal to 0
                                            Then - Actions
                                                Unit - Create 1 CreepUnitType[(Integer A)] for Neutral Hostile at Creep_Point[(Integer A)] facing Creep_Angle[(Integer A)] degrees
                                                Set Creep[(Integer A)] = (Last created unit)
                                                Set CreepTimer[(Integer A)] = 76
                                            Else - Actions
                            Else - Actions
                    Else - Actions
 

thorhunter

You can change this now in User CP.
Reaction score
32
This will work as long as your 'Temp_Integer' isn't used elsewhere, whereas its name suggests otherwise.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top