• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Trigger] Question about Custom Ability and Buff

Status
Not open for further replies.
Level 4
Joined
Sep 6, 2012
Messages
88
Hi guys !

I'm currently having a problem that I don't know why it doesn't work. The trigger is like this

  • Events
  • Unit - A unit Is issued an order targeting an object
  • Conditions
  • ((Triggering unit) has buff Holding Crystal ) Equal to False
  • (Unit-type of (Target unit of issued order)) Equal to Glyph Lv 1 Fire
  • (Issued order) Equal to (Order(smart))
  • Actions
  • Unit - Order (Target unit of issued order) to Follow (Triggering unit)
  • Unit - Add Holding Crystal to (Target unit of issued order)
  • Unit - Order (Target unit of issued order) to Night Elf Wisp - Restore (Triggering unit)
It should work like this:

-If a player right-click on a "Glyph Lv 1 Fire" unit, then the Glyph unit will follow the player unit.

-Then an ability called "Holding Crystal" is added to the Glyph unit and it casts on the player unit to mark that the player unit is the current owner of the Glyph, so next time this player right-click on the Glyph, the actions don't run again.

-Holding Crystal is an ability based on the Night Elf Wisp's Restore ability by the way, and it is attached to a buff with the same name, "Holding Crystal".

The problem I got was that the ability never seems to be casted, thus making the trigger runs again and again when the same player spams right-click on the Glyph, which causes several problems for my gameplay.

So that's my situation, can anyone help me figure out what's the problem with my trigger and how to fix it ? Thank you very much !
 
Level 4
Joined
Sep 6, 2012
Messages
88
Hi there,

What I want is when player right-click the Glyph, it follows or attaches itself to the player unit and cast a certain buff on the unit to avoid right-clicking spams from the same player.

I don't know about Lightning, I thought it was only a Special Effect ? Can you please explain further, thank you very much.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Moin moin =)

The question is: do you really need this ability? Because I think I have another way (not sure because I left GUI coding for some years):

  • Trigger1
    • Events
      • Unit - A unit Is issued an order targeting an object
    • Conditions
      • (Unit-type of (Target unit of issued order)) Equal to Wisp
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Custom value of (Target unit of issued order)) Not equal to (Player number of (Triggering player))
        • Then - Actions
          • Set Integer = (Integer + 1)
          • Game - Display to (All players) the text: (String(Integer))
          • Set UnitArray1[Integer] = (Triggering unit)
          • Set UnitArray2[Integer] = (Target unit of issued order)
          • Unit - Set the custom value of UnitArray2[Integer] to (Player number of (Triggering player))
        • Else - Actions
  • Trigger2
    • Events
      • Time - Every 0.03 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to Integer, do (Actions)
        • Loop - Actions
          • Custom script: call IssuePointOrder(udg_UnitArray2[bj_forLoopAIndex],"move",GetUnitX(udg_UnitArray1[bj_forLoopAIndex]),GetUnitY(udg_UnitArray1[bj_forLoopAIndex]))
Edit: You can delete the " Game - Display to (All players) the text: (String(Integer))" action, I just add this to check if it works.
 

Attachments

  • ComeMyLittleWisps.w3x
    16.7 KB · Views: 41
Level 33
Joined
Mar 27, 2008
Messages
8,035
What I want is when player right-click the Glyph, it follows or attaches itself to the player unit and cast a certain buff on the unit to avoid right-clicking spams from the same player.
How can you cast certain buff, and that buff will prevent the player from right-clicking ?
I don't recall any function that disable a Player from right-clicking, does it exist ?
 
Level 4
Joined
Sep 6, 2012
Messages
88
Hi Dr.Boom,

The Wisps were tackling me, haha, good defenders.

Anyway, the triggers you wrote looked functional to me. However, what does "Custom Value" mean ? I've never used it so I don't understand much about it. Also, is there any way to determine whether the Paladin is being followed by any Wisps or not ? I really need it.

Thank you very much for the effort ^^!

@defskull: Ah, no, you misunderstood me ! What I mean is that when the unit is under a certain buff, I want the actions in the trigger would not run again, that's why I tried to put an extra condition there

  • ((Triggering unit) has buff Holding Crystal ) Equal to False
So if the player right-click on a unit that's already following him, the follow order would not be given again.

I'm sorry for any confusion here !
 
Level 16
Joined
May 1, 2008
Messages
1,605
Well the custom value is an integer value that is used by the trigger editor only and I use this you check if the player already controlled the selected wisp.

But what you mean with "is there any way to determine ...."? (my English is not so good, maybe you can explain what you wanna do with the wisps after collecting them)
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
If you use CV, better use Unit Indexer ;p

But what you mean with "is there any way to determine ...."? (my English is not so good, maybe you can explain what you wanna do with the wisps after collecting them)
He wants to let the trigger to check whether the Paladin already has a "follower" (Wisp) or not.
Since (if) you're using Unit Indexer, you can save a Boolean or Integer to it and load it afterwards.
If it's True (hasWisp) OR if you use Integer (>1), then the Paladin has Wisp following it.
 
Level 4
Joined
Sep 6, 2012
Messages
88
Well the custom value is an integer value that is used by the trigger editor only and I use this you check if the player already controlled the selected wisp.

But what you mean with "is there any way to determine ...."? (my English is not so good, maybe you can explain what you wanna do with the wisps after collecting them)

So basically you are using Custom Value like a boolean variable, right ? Thanks a lot, I understand it now.

About the question, nevermind. You just answered it for me :D. Thank you ^^
 
Status
Not open for further replies.
Top