how to detect when a player gains wood

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,494
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,494
"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,494
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,494
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,494
"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,494
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.
  • Varine Varine:
    I ordered like five blocks for 15 dollars. They're just little aluminum blocks with holes drilled into them
  • Varine Varine:
    They are pretty much disposable. I have shitty nozzles though, and I don't think these were designed for how hot I've run them
  • Varine Varine:
    I tried to extract it but the thing is pretty stuck. Idk what else I can use this for
  • Varine Varine:
    I'll throw it into my scrap stuff box, I'm sure can be used for something
  • Varine Varine:
    I have spare parts for like, everything BUT that block lol. Oh well, I'll print this shit next week I guess. Hopefully it fits
  • Varine Varine:
    I see that, despite your insistence to the contrary, we are becoming a recipe website
  • Varine Varine:
    Which is unique I guess.
  • The Helper The Helper:
    Actually I was just playing with having some kind of mention of the food forum and recipes on the main page to test and see if it would engage some of those people to post something. It is just weird to get so much traffic and no engagement
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top