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.
  • Varine Varine:
    I don't want to compete for that, yall can have it.
  • Varine Varine:
    @The Helper I'm trying. Once I am more prepared to be figuring out school I'll probably ask for your advice
  • Varine Varine:
    Right now I'm just trying to get through the pandemic and figure out how I'm going to pay for it, and figure out what I need to get a job at Best Buy instead of a kitchen somewhere.
  • thewrongvine thewrongvine:
    oy just catching up on the discussion above. @Varine yeah I usually alternate between claritin & zyrtec, depending on whatever my body decides to reject at the time lol
  • thewrongvine thewrongvine:
    the more I use it the less effective it gets over time as my body accustoms to it so I try to not use it every day
  • S songbird:
    Glad to see some interest in the IS3 NUON reprint. :)
    +1
  • The Helper The Helper:
    Thank you Carl for making that happen that just might be the spark we need.
  • Varine Varine:
    I'm confused and amazed that NUON and TWV's news postings are the things still active.
  • Varine Varine:
    Or Tom Mai, not TWV
  • Varine Varine:
    Whatever happened to Cheshire? Or Firecat, whatever his real name was?
  • Varine Varine:
    I've been using both claritin and fexofenadine or something like that recently alternately and that's been kinda working, I don't feel like my face is going to explode at least. Eyes are still itchy as fuck though
  • tom_mai78101 tom_mai78101:
    I dunno, haven't seen Firecat in a long while now.
  • tom_mai78101 tom_mai78101:
    By the way, we have new file attachment size limits now.
  • Varine Varine:
    Are they bigger?
  • tom_mai78101 tom_mai78101:
    Yeah, new max size limit is 64 MB, to accommodate NUON-Dome emulation.
  • Varine Varine:
    I don't think I ever ran into a file size problem before. What was it before?
  • Varine Varine:
    I've had file type issues before I think, but I haven't uploaded anything since like 2010.
  • The Helper The Helper:
    alot smaller than that basically barely anything and it would have been different then 2010 because of the forum upgrade
  • Varine Varine:
    lol I forgot this used to look different
  • Varine Varine:
    It's by far the brightest webpage I regularly visit, the first thing I usually do is try to figure out dark mode.
  • tom_mai78101 tom_mai78101:
    If you invert the colors, The Helper Forums looks amazing
  • tom_mai78101 tom_mai78101:
    It still has that blue theme at the top
  • Ghan Ghan:
    There's no particular hard limit to attachments. "Something reasonable" is preferred to "a size large enough to fill up the server disk"
  • B Badmanhop (Andy):
    I would be interested to.
  • tom_mai78101 tom_mai78101:
    Feel free to contribute to NUON.

    Staff online

    Members online

    Affiliates

    Hive Workshop
    Top