how to detect when a player gains wood

Discussion in 'World Editor Help' started by sunshinex3, Apr 9, 2019.

  1. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    is their an event player gain recourse?
     
  2. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,483 / 0 / -0
    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
     
  3. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    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
     
  4. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,483 / 0 / -0
    As a condition, yes. And just leave the event at greater 0. (Integer comparison - Player property)
     
  5. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    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: Apr 9, 2019
  6. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    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: Apr 10, 2019
  7. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,483 / 0 / -0
    "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
    
     
  8. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    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: Apr 11, 2019
  9. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    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.
     
  10. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,483 / 0 / -0
    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
    
     
  11. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,483 / 0 / -0
    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?
     
  12. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    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 )
     
  13. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    btw this doesnt work, for some reason im not able to add wisps to NEWispUnitgroup (not sure why, trying to figure it out)
     
  14. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,483 / 0 / -0
    "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.)
     
  15. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    "> 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.
     
  16. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    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)
     
  17. AceHart

    AceHart Your Friendly Neighborhood Admin

    Ratings:
    +1,483 / 0 / -0
    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))))
    
     
  18. sunshinex3

    sunshinex3 You can change this now in User CP.

    Ratings:
    +4 / 0 / -0
    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
     

Share This Page