how to detect when a player gains wood

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,495
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.
Reaction score
7
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.
Reaction score
7
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.
Reaction score
7
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
Reaction score
1,495
"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.
Reaction score
7
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.
Reaction score
7
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
Reaction score
1,495
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
Reaction score
1,495
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.
Reaction score
7
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.
Reaction score
7
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
Reaction score
1,495
"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.
Reaction score
7
"> 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.
Reaction score
7
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
Reaction score
1,495
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.
Reaction score
7
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.
Reaction score
7
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
Reaction score
3
>> 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.
  • 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 The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/
  • The Helper The Helper:
    I think we need to add something to the bottom of the front page that shows the Headline News forum that has a link to go to the News Forum Index so people can see there is more news. Do you guys see what I am saying, lets say you read all the articles on the front page and you get to the end and it just ends, no kind of link for MOAR!
  • The Helper The Helper:
    Happy Wednesday!
    +1

      The Helper Discord

      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