• 🏆 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!

[Trigger] Taunt not working...

Status
Not open for further replies.
Level 11
Joined
Feb 14, 2009
Messages
884
  • Crush
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Crush
    • Actions
      • Wait until (((Target unit of ability being cast) has buff Stunned (Pause)) Equal to False), checking every 0.10 seconds
      • Unit - Order (Target unit of ability being cast) to Attack (Casting unit)
I don't think I need to explain much here. Crush stuns the target, and the target is supposed to attack casting unit when the stun wears out. Sometimes, the target does attack the casting unit, but I reckon that's because of the built-in aggro system and not because of the trigger. Suggestions?
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Don't ask me why I created this trigger, but it works =) ( I set stunt to 6 seconds - run away with casting unit - but the stunned unit (after stunt) followed me over the map =D

  • TauntTrigger
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Crush
    • Actions
      • Set TempGroup = (Units within 450.00 of (Position of (Casting unit)) matching (((Matching unit) belongs to an enemy of (Owner of (Casting unit))) Equal to True))
      • Unit Group - Pick every unit in TempGroup and do (Actions)
        • Loop - Actions
          • Wait until (((Picked unit) has buff Crush ) Equal to False), checking every 0.10 seconds
          • Unit - Order (Picked unit) to Attack (Casting unit)
          • Custom script: call DestroyGroup(udg_TempGroup)
1) TempGroup is a variable (UnitGroup)
2) When you pick all units in range, make sure that the "picked range" and the "ability AOE range" are the same =)
 
Level 11
Joined
Feb 14, 2009
Messages
884
No, no, you don't understand. It's not an AoE taunt, it's a single targer taunt. Your target probably attacked you because you were the only unit hitting it at that time. The thing is that, if another unit is hitting my target, the target must change targets and attack my casting unit. Thanks for trying though :cool:
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

No No - of course I add 2 red footmen (for me) and 2 blue footmen (for computer enemy) and while they are fighting, I use this ability and it works ;)

And if its single taunt use:
  • TauntTrigger 2
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Crush(Single)
    • Actions
      • Set TempUnit = (Target unit of ability being cast)
      • Wait until ((TempUnit has buff Crush ) Equal to False), checking every 0.10 seconds
      • Unit - Order TempUnit to Attack (Casting unit)
 
Level 11
Joined
Feb 14, 2009
Messages
884
Yeah, but maybe it's what I mentioned above -the build-in aggro system. When I attack with a unit a lot of time and build loads of aggro and then Crush the unit, it still continues to smack the first one. I haven't tried saving my unit to a variable -thought it was pointless. I'll try what you're suggesting and I'll answer tomorrow. Now, it's time for bed :grin:
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Yeah ofc never use wait blabla - we all know it.

But I ask: Why not. I tested is 10 times - with 3 different heroes and units - casted the ability on the same target - on different targets - and it ALWAYS works.

Always if if use wait triggers in this or other cases, it works always. So its ok, use wait in this case :wsmile:

But do what you want :wscrolleyes:
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
It is not about the waits, which are BAD as everybody knows, it is the Event Response that isnt working right anymore after a Wait. (Triggering Unit works fine after a wait, but Dying Unit, Entering Unit, Target Unit of Ability being Cast, etc. dont work anymore)
So dont be a noob that is reluctant to learn efficient and bugless triggering, and take our advice. Either use local variables, a total JASS trigger, or an indexing System.
 
Level 11
Joined
Feb 14, 2009
Messages
884
So dont be a noob that is reluctant to learn efficient and bugless triggering, and take our advice.

Uhm, dude, do you honestly believe that I make mistakes on purpose? I do not know how to code in JASS, simply because my free time doesn't allow me to learn how. Of course, learning JASS is one of the first things in my to-do list. I used waits because I thought it was the only way to do what I wanted. I cannot possibly know every little trick of WE and GUI. That's why I asked and that's why I joined the Hive in the first place. Satisfied?
 
Level 11
Joined
Feb 14, 2009
Messages
884
  • Crush
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Crush
    • Actions
      • Set CrushUnit = (Target unit of ability being cast)
      • Set CrushCaster = (Triggering unit)
      • Wait until ((CrushUnit has buff Stunned (Pause)) Equal to False), checking every 0.10 seconds
      • Unit - Order CrushUnit to Attack CrushCaster
Now what? It should know which unit much attack which, but it still doesn't work. Any ideas on how I can make this work (not this particular trigger, but the spell itself).
 
Level 5
Joined
Mar 17, 2005
Messages
135
Is it like level based or something? Cause I don't see why you can't just do this

  • Actions
    • -------- Make the wait as long as the stun duration? --------
    • Wait 2.00 seconds
    • Unit - Order (Targeted unit) to Attack (Casting unit)
 
Level 11
Joined
Feb 14, 2009
Messages
884
Yes, it is level based. But I recently started learning JASS and I'll try to create in in JASS. Thank you all for trying :)
 
Level 11
Joined
Feb 14, 2009
Messages
884
JASS:
function Crush_Cond takes nothing returns boolean
    return GetSpellAbilityId() == 'A008'
endfunction

function Crush_Actions takes nothing returns nothing
    
    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit dummy  = CreateUnit(GetOwningPlayer(caster), 'H009', GetUnitX(target),GetUnitY(target),GetUnitFacing(target))
    local integer level = GetUnitAbilityLevel(caster,'A008')
    local real duration
    
    if level == 1 then
        set duration = 250
    elseif level == 2 then
        set duration = 500
    else
        set duration = 1000
    endif
    
    call SetUnitAbilityLevel(dummy,'Ahtb',level)
    call IssueTargetOrder(dummy,"thunderbolt",target)
    call TriggerSleepAction(duration)
    call IssueTargetOrder(target,"attack",caster)
    
    call RemoveUnit(dummy)
    set caster = null
    set target = null
          
endfunction

//===========================================================================
function InitTrig_Crush takes nothing returns nothing
    local trigger trgCrush = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( trgCrush, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddCondition( trgCrush, Condition( function Crush_Cond ) )
    call TriggerAddAction( trgCrush, function Crush_Actions )
    set trgCrush = null
endfunction

That's the JASS version (my very first JASS script ^^)
When my hero crushes a unit, a dummy is supposed to throw a Thunder Bolt at the target. Crush's damage and duration are set to 0. Still does not work :cry:. No dummy is spawned and the target doesn't attack my caster. I believe the mistake is painfully obvious to everybody knowing JASS, but I'm not one of them. Any help? :cute:

H009 is the dummy
A008 is the caster
Ahtb is the melee Thunder Bolt
 
Level 11
Joined
Feb 14, 2009
Messages
884
The dummy is based on Mountain King, invulnerable, locust and perma invi. Storm Bolt's mana cost has been edited to 0, on all 3 levels. Casting time 0, cooldown 0 etc etc... I don't use any dummy model (like the one with no model file).

Changed the script with the one following, and now it seems like the stun part is working, but the target stays stunned forever :)

JASS:
function Crush_Actions takes nothing returns nothing
    
    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit dummy  = CreateUnit(GetOwningPlayer(caster), 'H009', GetUnitX(target),GetUnitY(target),GetUnitFacing(target))
    local integer level = GetUnitAbilityLevel(caster,'A008')
    local real duration
    
    if level == 1 then
        set duration = 250
    elseif level == 2 then
        set duration = 500
    else
        set duration = 1000
    endif
    
    call SetHeroLevel(dummy,10,false)
    call SetUnitAbilityLevel(dummy,'Ahtb',level)
    call IssueTargetOrder(dummy,"thunderbolt",target)
    call TriggerSleepAction(duration)
    call IssueTargetOrder(target,"attack",caster)
    
    call RemoveUnit(dummy)
    set caster = null
    set target = null
          
endfunction
 
Level 11
Joined
Feb 14, 2009
Messages
884
I don't use WEU, I use JASScraft ^^

When you say 2 different triggers, what do you mean? Like a periodic event checking every 0.01 seconds? Meh, that would be highly inefficient, wouldn't it?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
In case you are still interested in all the "only triggering unit works with waits" - all the event response units are stored it global variables, meaning that each time a unit casts a spell, for example, "Casting Unit" will be overwritten with that unit.
Now think that your trigger is in the middle of waiting, and then yet another unit casts a spell - ops, the trigger will use the wrong unit when the wait finishes.

Triggering Unit is a special case, as it is a local to a trigger (which is a bit hard to understand if you don't know how Jass works), and not a normal global, and thus it doesn't get overwritten.
 
Level 11
Joined
Feb 14, 2009
Messages
884
I'm really new to JASS but the above script was written by me, I didn't CnP it from somewhere. What you're saying about another unit casting a spell can't be true, since I start attacking with a unit, crush it with another and the target stays stunned forever, with no other spells being cast.

EDIT: I can post the map if anybody is interested...
 
I think its better to use the event Unit-Starts the Effect of an Ability.. and posting the map might help a lot..

The units is stunned forever? maybe you set the stun duration of the thunderbolt ability in the object editor to 0.00... If you set the stun duration to 0.00 it will really be forever.. just put .01 if you dont want a long stun....
 
Level 11
Joined
Feb 14, 2009
Messages
884
The stun is supposed to last 0.25/0.5/1 second, and the values are adjusted properly. Here's the map...

EDIT: Oshi...! You were right, I had set the duration to 0.00. But not for the actual spell, but for the dummy spell used by the caster. Let's see if it works now...

EDIT 2: Good, not it's not stunned forever; it's stunned for 0.01. But the dummy still doesn't cast the real spell and the unit still doesn't attack me.
 

Attachments

  • Psixiko.w3x
    1.1 MB · Views: 43
Last edited:
Level 11
Joined
Feb 14, 2009
Messages
884
I don't know, I thing you need to nullify the variable even if you destroy the unit.
 
Level 8
Joined
Aug 21, 2009
Messages
333
In case it still isn't fixed (not that I don't trust naitsirk)... I think the problem is that the order is issued before the unit is even stunned. I think you said the stun was based on storm bolt; so this is the order:

storm bolt cast -> check for stun: NO STUN -> order unit to attack -> unit becomes stunned -> unit forgets attack orders

you should have it check for a stun, THEN check for the stun to be gone, then order the unit

example:
  • Crush
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Crush
  • Actions
    • Wait until (((Target unit of ability being cast) has buff Stunned (Pause)) Equal to True), checking every 0.10 seconds
    • Wait until (((Target unit of ability being cast) has buff Stunned (Pause)) Equal to False), checking every 0.10 seconds
    • Unit - Order (Target unit of ability being cast) to Attack (Casting unit)
you will probably want to translate this to JASS, but this is the GUI, single instanceable version of what you are trying to do.
 
I dont know how many times i have written this, but the reason that waits fuck things up is that it has great problems making precise intervalls. If you want 0.25 to really be 0.25, you should use a timer - but since timers cant pass local variables, it gets a tad more advanced for an inexperienced jasser.
I think that for the taunt, i would attatch a periodic timer to the target unit and order it to attack the target everytime it fires.

You are right on the unit variable though, you should always make a habit of nulling all variables except for reals and integers. You seem to have fixed those leaks pretty nice.

Though i would propably advice you to use something else than a hero for dummy unit, heroes contain a lot of information, and i dont think you need them for a simple dummy.

EDIT: I think you forgot to give the ability to the dummy!
I would totally prefer to add it as the dummy is created rather than in the object editor.
 
Level 11
Joined
Feb 14, 2009
Messages
884
JASS:
function Crush_Actions takes nothing returns nothing
    
    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit dummy  = CreateUnit(GetOwningPlayer(caster), 'h00B', GetUnitX(target),GetUnitY(target),GetUnitFacing(target))
    local integer level = GetUnitAbilityLevel(caster,'A008')
    local real duration
    
    if level == 1 then
        set duration = 2.50
    elseif level == 2 then
        set duration = 5.00
    else
        set duration = 10.00
    endif
    call SetUnitAbilityLevel(dummy,'AHtb',level)
    call IssueTargetOrder(dummy,"thunderbolt",target)
    call IssueTargetOrder(target,"attack",caster)
    
    call RemoveUnit(dummy)
    set caster = null
    set target = null
          
endfunction

@naitsirk
Thanks for trying, but it still doesn't work. The knight keeps attacking the monk.

@Baintastic
That's what I did in the beginning, doesn't work either (and I doubt it's MUI).

@Fingolfin
If I use structs, will I be able to do it?

@Anybody interested
So, instead of trying to fix this damn script, is there any possible way I can do what I want?
 
Level 10
Joined
Jan 24, 2009
Messages
606
JASS:
function Crush_Actions takes nothing returns nothing
    
    local unit caster = GetSpellAbilityUnit()
    local unit target = GetSpellTargetUnit()
    local unit dummy  = CreateUnit(GetOwningPlayer(caster), 'h00B', GetUnitX(target),GetUnitY(target),GetUnitFacing(target))
    local integer level = GetUnitAbilityLevel(caster,'A008')
    local real duration
    
    if level == 1 then
        set duration = 2.50
    elseif level == 2 then
        set duration = 5.00
    else
        set duration = 10.00
    endif
    call SetUnitAbilityLevel(dummy,'AHtb',level)
    call IssueTargetOrder(dummy,"thunderbolt",target)
    call IssueTargetOrder(target,"attack",caster)
    
    call RemoveUnit(dummy)
    set caster = null
    set target = null
          
endfunction

@naitsirk
Thanks for trying, but it still doesn't work. The knight keeps attacking the monk.

@Baintastic
That's what I did in the beginning, doesn't work either (and I doubt it's MUI).

@Fingolfin
If I use structs, will I be able to do it?

@Anybody interested
So, instead of trying to fix this damn script, is there any possible way I can do what I want?

Well There are many Possible Ways in GUI!:p I coud try Making it for you:) But not Today.... It's too late right now sry
 
Level 8
Joined
Aug 21, 2009
Messages
333
@Baintastic
That's what I did in the beginning, doesn't work either (and I doubt it's MUI).

My suggestion isn't the same as what you originally posted because mine checks to make sure that the unit has been stunned before it checks for the stun to be over.

Also, I said that it WASN'T MUI and that you'd have to make it MUI through JASS.

My simple GUI trigger was just for the sake of concept.
 
Level 11
Joined
Feb 14, 2009
Messages
884
Oh, and don't worry. I've credited you in my map :))
I've credit the most irrelevant people for the most ridiculous reasons, so I guess I should also credit a person that actually did something ^^
 
Status
Not open for further replies.
Top