Event Response Unit lost by Trigger

XeRo13g

New Member
I've done some testing but I cannot conclude to a result 100%. Maybe someone can help...

Code:
Event
Unit - A unit Sells a unit

Conditions
(Unit-type of (Sold unit)) Equal to UnitX

Actions

Do something for (Owner of (Sold unit)) ....
Wait 5 seconds
Do something else for (Owner of (Sold unit)) ....
In these 5 seconds delay:
-What happens if another player buys ANY other unit?
-What happens if another player buys a UnitX?

Does the already running trigger loses focus on the first (Owner of (Sold unit))?

Thanks in advance.
 

evilwolf

Member
Wait action is unstable if rum multiple times.
Use a countdown timer that will run and fire only for the owner of sold unit.
 

DioD

New Member
every event variable expect GetTriggerX is LOST after wait.

sold unit in your trigger will be lost after wait in ANY case (ever if you sell no other units), you must use global or local variables to save reference.
 

XeRo13g

New Member
Yet, for some unknown reason it still works. I surely don't feel safe using such trigger and I will need some way to stabilize it.

Edit.-
 

GFreak45

I didnt slap you, i high 5'd your face.
basically if you are not using variables just event responses and owner of unit, etc the trigger will run fine as long as the owner of the unit isnt changing, variables would not work with the wait function because they can be changed before the wait function ends... by a different trigger or the same one, but once the trigger is in the que if the owner of the unit does not change then the trigger should work

if you wish to use variables and still want to use a wait function, you need to use a pick every player/unit function like this:
pick every unit in playable map area matching condition: unit comparision - matching unit = saved variable then do every action for the picked unit, because then the unit is picked for the trigger already and does not change for that trigger while it is in the que...
 

XeRo13g

New Member
basically if you are not using variables just event responses and owner of unit, etc the trigger will run fine as long as the owner of the unit isnt changing.
So, if the same trigger runs multiple times for multiple users at the same time, the (Owner of (Sold unit)) will be kept for each one of the users for as long as the sold unit (of each player) isn't modified in any way?

-I'm not very comfortable using "queue", because even though I've read a fair share about it's use, it's mechanics and placement remain unclear to me and also caused a crash that kinda scared me.

-I could use a unit variable array to store the (Owner of (Sold unit)) for each player and re-use it over and over again. Though, I haven't seen that a lot in other people coding and even though Temp_Unit variable is not supposed to leak, I don't quite trust it.

Only if i could clear those things in my mind...Ohh well..
 

hopy

Active Member
So, if the same trigger runs multiple times for multiple users at the same time, the (Owner of (Sold unit)) will be kept for each one of the users for as long as the sold unit (of each player) isn't modified in any way?
The '(Owner of (Sold unit))' shouldn't cause problems because of multiple players using it, but more because the data stored in '(Owner of (Sold unit))' gets cleared afther the wait. So no, it wouldn't work.

-I could use a unit variable array to store the (Owner of (Sold unit)) for each player and re-use it over and over again. Though, I haven't seen that a lot in other people coding and even though Temp_Unit variable is not supposed to leak, I don't quite trust it.
If every player can only use this once, or once every 5 seconds, yes.
If yes, should I show you how?
 

XeRo13g

New Member
If every player can only use this once, or once every 5 seconds, yes.
If yes, should I show you how?
I didn't quite understand what do you mean by that and yes please show me!!

PS. After looking into it a bit more, I don't see how (Owner of (Sold unit) can be stored in something that will be reused and remain unchanged even if the trigger re-runs. Let alone creating 1 trigger for each player, which I'm sure is not optimal.

EDIT: spelling
 

tommerbob

Minecraft. :D
PS. After looking into it a bit more, I don't see how (Owner of (Sold unit) can be stored in something that will be reused and remain unchanged even if the trigger re-runs. Let alone creating 1 trigger for each player, which I'm sure is not optimal.
You use variables to keep track of specific data. So in your trigger above, you would change it to this:

Trigger:
  • Events
    • Unit - A unit sells a unit
    • Conditions
      • (sold unit) equal to [Your Unit]
    • Actions
      • Set UNIT = (sold unit)
      • Wait 5.00 seconds
      • Unit - Make UNIT jump around


You would need to add a condition check if you want this for only 1 player, or instead of using a variable you could add the (sold unit) to a unit group (like GFreak45 suggested), and then after the wait, do actions for every unit in that unit group and then remove the unit from the unit group. Example:

Trigger:
  • Events
    • Unit - A unit sells a unit
    • Conditions
      • (sold unit) equal to [Your Unit]
    • Actions
      • Unit group - Add (sold unit) to UNITS
      • Wait 5.00 seconds
      • Unit group - Pick every unit in UNITS and do Actions
        • Loop - Actions
          • Unit - Make (picked unit) jump around
          • Unit group - Remove (picked unit) from UNITS
 

XeRo13g

New Member
To my understanding that would work just fine if the event runs at the same time for all players.
If a second player trigger the event after x seconds though, the sequence of actions for each player should be different (since the first is x seconds ahead).

Am I missing something?
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • tom_mai78101 tom_mai78101:
    Make sure you keep checking out my news..
    +2
  • Jesus4Lyf Jesus4Lyf:
    Man, I made this account 15 years ago? Wild. :)
  • Ghan Ghan:
    Seeing J4L is definitely a blast from the past.
  • Jesus4Lyf Jesus4Lyf:
    Oh hey Ghan! Long time. :)
    +1
  • jonas jonas:
    J4L! What has happened in your life
  • Jesus4Lyf Jesus4Lyf:
    Hmm, how to summarize... Moved to the USA and got married. Became a professional software engineer and solution lead. Learning Godot for game dev. :)
  • jonas jonas:
    So you are pursuing game dev as a hobby? What industry is your dayjob in?
  • jonas jonas:
    FAANG?
  • Jesus4Lyf Jesus4Lyf:
    Not quite FAANG, less pay for a less hours/stress. Yeah, game dev as a hobby.
  • jonas jonas:
    makes sense. Do we have a hobby game dev subforum to showcase some work?
  • Blackveiled Blackveiled:
    Happy Thursday
    +1
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    TGIF!
  • The Helper The Helper:
    hey tom_mai please do not archive anymore news
  • Ghan Ghan:
    AMD Ryzen 7000 next week :D
    +1
  • The Helper The Helper:
    noice!
  • tom_mai78101 tom_mai78101:
    "hey tom_mai please do not archive anymore news" ----> Got it. What should we do with the "News Archive" subforum?
  • The Helper The Helper:
    I think leave it for real old news that cannot be sorted the reason we had it in the first place was a server issue that we do not have anymore. I don't want to get rid of the archive just not put anything in it for now until we figure it out more
  • The Helper The Helper:
    The side chat has nothing on the discord. it is not possible but the biggest thing on my wish list right now is a sidechat channel on the disord that hooks up to this...
  • Ghan Ghan:
    I've been selected for the Diablo IV beta.
    +1
  • Ghan Ghan:
    Woo!
    +1
  • The Helper The Helper:
    that is so cool
  • V-SNES V-SNES:
    Eh just noticed the new discord section on the side. Looks great!
    +1
  • Blackveiled Blackveiled:
    :( feels bad I can't ever get selected for any beta I sign up for. It's annoying as heck.
    +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