how to detect when a player gains wood

AceHart

Your Friendly Neighborhood Admin
Sort of...

Under "Player", "Properties", you can find things like
"Player - Player 1 (Red)'s Total lumber gathered becomes Greater than 0.00", and some related variations
 

sunshinex3

You can change this now in User CP.
right i was wondering is their an arithmetic that i could do maybe using a variable? like player 1 current wood= currentwoodvariable then
Player - Player 1 (Red)'s Total lumber gathered becomes Greater than Currentwoodvariable
 

sunshinex3

You can change this now in User CP.
Figured it out, here it is, i will have to do it for each player though
Player - Player 1 (Red)'s Current lumber becomes Greater than (Real((Player 1 (Red) Current gold)))

now every time a player gains wood i can trigger give them gold
gold
 
Last edited:

sunshinex3

You can change this now in User CP.
i dont know how to get the floating text to work in this case, it would target wisps gathering wood... but i dont know how select those specific wisps yet

Trigger:
  • MalfurianWildLands
    • Events
      • Player - Player 1 (Red)'s Current lumber becomes Greater than (Real((Player 1 (Red) Current lumber)))
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Casting unit)) Equal to Wisp
          • (Ability being cast) Not equal to Detonate
    • Actions
      • Player - Add 3 to Player 1 (Red) Current gold
      • Set TempPointFloatingText = (Position of (Casting unit))
      • Set TempFloatingText = (Last created floating text)
      • Floating Text - Create floating text that reads +3 at TempPointFloatingText with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
      • Floating Text - Change (Last created floating text): Disable permanence
      • Custom script: call RemoveLocation (udg_TempPointFloatingText)
 
Last edited:

AceHart

Your Friendly Neighborhood Admin
"Player lumber becomes" does not have a casting unit

You could try to catch the actual Wisp doing... things:
Code:
Wisp
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Unit-type of (Triggering unit)) Equal to Wisp
        (Ability being cast) Equal to Harvest (Gold and Lumber)
    Actions
    ...something with "Triggering unit" and "Owner of (Triggering unit)" or so
 

sunshinex3

You can change this now in User CP.
hrm yea if harvest can be caught like that, maybe wisp starts the effect of ability harvest add to unit group and then set the text to appear on each unit in unit group... i try that
 
Last edited:

sunshinex3

You can change this now in User CP.
that doesn't work to well, is their a way to detect wisps using havest?

i tried useing wisp is ordered to wispharvest add to unit group
and then pick every unit in unit group and floating text
but i couldent get add unit to unit group to work.
 

AceHart

Your Friendly Neighborhood Admin
Yes, it's not as obvious as it should or could be.
Actually, you can not detect "Gather". But you can "Harvest".

With "Harvest" though, your Wisp won't look as cool anymore, as it will circle in front of the tree rather than around... but it will allow a trigger like:
Code:
Wisp
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        (Unit-type of (Triggering unit)) Equal to Wisp
        (Issued order) Equal to (Order(resumeharvesting))
    Actions
        Player - Add ... to (Owner of (Triggering unit)) Current gold
Notes:
- Your Wisp also needs "Return Lumber", otherwise it will start to look for a building to return the lumber to
- Additionally, this will eventually kill the tree. So either change them to have 9999999 health, or use a tree-regrow trigger (or both, just in case)

And something to remove the lumber:
Code:
Lumber
    Events
        Player - Player 1 (Red)'s Current lumber becomes Greater than 0.00
        Player - Player 2 (Blue)'s Current lumber becomes Greater than 0.00
        Player - Player 3 (Teal)'s Current lumber becomes Greater than 0.00
    Conditions
    Actions
        Player - Set (Triggering player) Current lumber to 0
 

AceHart

Your Friendly Neighborhood Admin
With all of that said... we're now 10 posts deep and still do not know what you are trying to do here.
Perhaps, if we knew it, there'd be a "better" (or so) way of doing it?
 

sunshinex3

You can change this now in User CP.
right, im going to have a malfurion legendary hero, his ultimate will be an ability(passive like an upgrade) that will allow all wisps that are gathering wood to also gather gold.

Trigger:
  • WispUnitgroup
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(wispharvest))
          • (Unit-type of (Ordered unit)) Equal to Wisp
    • Actions
      • Unit Group - Add (Ordered unit) to NEWispUnitGroup


Trigger:
  • MalfurianWildLandsCallStart
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Summon Natures' Warriors (NE Malfurion)
    • Actions
      • Trigger - Turn on MalfurianWildLands <gen>


Trigger:
  • MalfurianWildLands
    • Events
      • Player - Player 1 (Red)'s Current lumber becomes Greater than (Real((Player 1 (Red) Current lumber)))
    • Conditions
    • Actions
      • Player - Add 3 to Player 1 (Red) Current gold
      • Unit Group - Pick every unit in NEWispUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set TempPointFloatingText = (Position of (Picked unit))
              • Floating Text - Create floating text that reads +3 at TempPointFloatingText with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
              • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
              • Floating Text - Change (Last created floating text): Disable permanence
              • Custom script: call RemoveLocation (udg_TempPointFloatingText)
            • Else - Actions
              • Do nothing


this is what i have so far just for player red so far(the last trigger doesn't run automatically )
 

sunshinex3

You can change this now in User CP.
right, im going to have a malfurion legendary hero, his ultimate will be an ability(passive like an upgrade) that will allow all wisps that are gathering wood to also gather gold.

Trigger:
  • WispUnitgroup
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Issued order) Equal to (Order(wispharvest))
          • (Unit-type of (Ordered unit)) Equal to Wisp
    • Actions
      • Unit Group - Add (Ordered unit) to NEWispUnitGroup


Trigger:
  • MalfurianWildLandsCallStart
    • Events
      • Unit - A unit Learns a skill
    • Conditions
      • (Learned Hero Skill) Equal to Summon Natures' Warriors (NE Malfurion)
    • Actions
      • Trigger - Turn on MalfurianWildLands <gen>


Trigger:
  • MalfurianWildLands
    • Events
      • Player - Player 1 (Red)'s Current lumber becomes Greater than (Real((Player 1 (Red) Current lumber)))
    • Conditions
    • Actions
      • Player - Add 3 to Player 1 (Red) Current gold
      • Unit Group - Pick every unit in NEWispUnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set TempPointFloatingText = (Position of (Picked unit))
              • Floating Text - Create floating text that reads +3 at TempPointFloatingText with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
              • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
              • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
              • Floating Text - Change (Last created floating text): Disable permanence
              • Custom script: call RemoveLocation (udg_TempPointFloatingText)
            • Else - Actions
              • Do nothing


this is what i have so far just for player red so far(the last trigger doesn't run automatically )
btw this doesnt work, for some reason im not able to add wisps to NEWispUnitgroup (not sure why, trying to figure it out)
 

AceHart

Your Friendly Neighborhood Admin
"Order(wispharvest)" does not exist.
The order refers to "text - order string", not the ability's name.
And then there are some orders you do not see in the editor, like the "resumeharvesting" from post #10.


> Player - Player 1 (Red)'s Current lumber becomes Greater than (Real((Player 1 (Red) Current lumber)))

How could that happen?

There is no need to have this unit group. Just do all the actions when the order is detected.
(Actually, having that group also assumes that the triggers happen in the expected order, first the group trigger, then the lumber trigger, which is not guaranteed.)
 

sunshinex3

You can change this now in User CP.
"> Player - Player 1 (Red)'s Current lumber becomes Greater than (Real((Player 1 (Red) Current lumber)))

How could that happen?"

its for sure a glich but it work, this gives me +3 gold every time i gain any wood.

and i wanna display that text on the wisp harvesting the wood, wich is why i thought i needed the unitgroup.
 

sunshinex3

You can change this now in User CP.
alright i can try and do that, this is what have so far but its not working, i think the order-string are wrong

Trigger:
  • WispMessage1
    • Events
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Unit-type of (Ordered unit)) Equal to Wisp
          • Or - Any (Conditions) are true
            • Conditions
              • (Issued order) Not equal to (Order(move))
              • (Issued order) Not equal to (Order(stop))
              • (Issued order) Not equal to (Order(patrol))
              • (Issued order) Not equal to (Order(Detonate))
    • Actions
      • Set TempPointFloatingText = (Position of (Picked unit))
      • Floating Text - Create floating text that reads +3 at TempPointFloatingText with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
      • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
      • Floating Text - Change (Last created floating text): Disable permanence
      • Custom script: call RemoveLocation (udg_TempPointFloatingText)
 

AceHart

Your Friendly Neighborhood Admin
Code:
    Conditions
        And - All (Conditions) are true
            Conditions
                (Unit-type of (Ordered unit)) Equal to Wisp
                Or - Any (Conditions) are true
                    Conditions
                        (Issued order) Not equal to (Order(move))
                        (Issued order) Not equal to (Order(stop))
                        (Issued order) Not equal to (Order(patrol))
                        (Issued order) Not equal to (Order(Detonate))
The "and" is not needed.
And the "or" actually should be an "and", otherwise this will be true for any order that generates an event.


You do not have a "picked unit" for the position.


> ... have so far but it's not working

It doesn't? This should float some text in the center of the map for pretty much any order given to your wisp.


As for, what is the actual order - how about asking the game to tell you?
Code:
Order None
    Events
        Unit - A unit Is issued an order with no target
    Conditions
        (Owner of (Triggering unit)) Equal to Player 1 (Red)
    Actions
        Game - Display to (All players) the text: (None:  + (String((Issued order))))
Code:
Order Object
    Events
        Unit - A unit Is issued an order targeting an object
    Conditions
        (Owner of (Triggering unit)) Equal to Player 1 (Red)
    Actions
        Game - Display to (All players) the text: (Object:  + (String((Issued order))))
Code:
Order Point
    Events
        Unit - A unit Is issued an order targeting a point
    Conditions
        (Owner of (Triggering unit)) Equal to Player 1 (Red)
    Actions
        Game - Display to (All players) the text: (Point:  + (String((Issued order))))
 

sunshinex3

You can change this now in User CP.
this is what i get when i look at issued order harvest wisp


function Trig_wispharvest_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetSpellAbilityUnit()) == 'ewsp' ) ) then
return false
endif
return true
endfunction

function Trig_wispharvest_Actions takes nothing returns nothing
call IssueTargetDestructableOrder( GetEnumUnit(), "harvest", GetOrderTargetDestructable() )
endfunction

//===========================================================================
function InitTrig_wispharvest takes nothing returns nothing
set gg_trg_wispharvest = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_wispharvest, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_wispharvest, Condition( function Trig_wispharvest_Conditions ) )
call TriggerAddAction( gg_trg_wispharvest, function Trig_wispharvest_Actions )
endfunction

it says wispharvest so i assume
 

sunshinex3

You can change this now in User CP.
this is what i get when i look at issued order harvest wisp


function Trig_wispharvest_Conditions takes nothing returns boolean
if ( not ( GetUnitTypeId(GetSpellAbilityUnit()) == 'ewsp' ) ) then
return false
endif
return true
endfunction

function Trig_wispharvest_Actions takes nothing returns nothing
call IssueTargetDestructableOrder( GetEnumUnit(), "harvest", GetOrderTargetDestructable() )
endfunction

//===========================================================================
function InitTrig_wispharvest takes nothing returns nothing
set gg_trg_wispharvest = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_wispharvest, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_wispharvest, Condition( function Trig_wispharvest_Conditions ) )
call TriggerAddAction( gg_trg_wispharvest, function Trig_wispharvest_Actions )
endfunction

it says wispharvest so i assume that is the customText order id for when a wisp harvests

but it doesn't work

what i want to do is detect if a wisp harvests wood so i can put some floating text near that wisp, at the time he harvests.
 
Last edited:

3ICE

Cool Member
>> Player - Player 1 (Red)'s Current lumber becomes Greater than (Real((Player 1 (Red) Current lumber)))
>How could that happen?"
its for sure a glich but it work, this gives me +3 gold every time i gain any wood.
Events are registered at map initialization, therefore you're erroneously thinking that (Player 1 (Red) Current lumber) will magically update every time. It doesn't - that line of code just means 450 or however much wood you started the game with. Not dynamic. Static. Should really just use 0 as AceHart originally suggested. Otherwise your trigger will stop working as soon as you fall below your initial lumber amount that you started the game with.
 
Last edited:
General chit-chat
Help Users
  • No one is chatting at the moment.
  • tom_mai78101 tom_mai78101:
    I have a GIF though
  • tom_mai78101 tom_mai78101:
    In the GIF, I've configured it so the lower the "Main Value" is, the better. I had to compress it pretty far down though.
  • tom_mai78101 tom_mai78101:
    And this is the thread with the video that shows the wall clip. https://tasvideos.org/Forum/Topics/23453
    +2
  • tom_mai78101 tom_mai78101:
    Hmm, about the Headline News, I noticed threads are being moved into the subforum (Health News, Environmental News, etc.). When that happens, the TH Forum Home page loses the articles, and instead would show old articles posted 1 or 2 weeks ago.
  • tom_mai78101 tom_mai78101:
    What do we do with the Home page?
  • Ghan Ghan:
    I added those forums to the filter for that widget.
  • tom_mai78101 tom_mai78101:
    Oh nice. They're back. Thanks.
  • tom_mai78101 tom_mai78101:
    Now I think it makes more sense for me to put news in their own subforums, without worry.
  • The Helper The Helper:
    Awesome Ghan thanks! I was purposely not moving the first 15 news articles in Headline news to the different subforums but I guess I don't have to do that now?
  • tom_mai78101 tom_mai78101:
    Question: Is there a way to remove thread redirects? It creates a copy of the moved thread and takes up space, and I am leaning towards wanting to remove them in the Headline News. But if they have an expiration date, I guess I'm fine with it.
  • The Helper The Helper:
    If you move a thread please leave a permanent redirect. You can delete any redirects after 6 months. The redirects are left to help Search Engines find the moved content.
  • tom_mai78101 tom_mai78101:
    What if you move the permanent redirect, not the thread?
  • The Helper The Helper:
    I think that works but I have not messed with it. You can delete redirects though if you have to that will not delete the original thread
  • The Helper The Helper:
    if a redirect ends up in the same forum as the post it goes to though I think the redirect drops or fails or something but they are not bugged out and when you are working on an indirect the original post is safe.
  • The Helper The Helper:
    Happy Early Friday :)
    +1
  • V-SNES V-SNES:
    Happy Friday :)
  • tom_mai78101 tom_mai78101:
    Fun Friday for me
  • tom_mai78101 tom_mai78101:
    Happy Fun Friday to all.
    +2
  • The Helper The Helper:
    Happy Sunday everyone!!!
  • V-SNES V-SNES:
    Happy Sunday!!!
    +1
  • jonas jonas:
    Happy monday :p
  • jonas jonas:
    Everyone hates mondays?
    +1
  • The Helper The Helper:
    Happy Tuesday!
  • jonas jonas:
    Happy belated tuesday

    Members online

    No members online now.

    Affiliates

    Hive Workshop NUON Dome World Editor Tutorials

    Network Sponsors

    Apex Steel Pipe - Buys and sells Steel Pipe.
    Top