• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Weird Damage Function bug

Status
Not open for further replies.
Level 3
Joined
Dec 22, 2009
Messages
39
I got this weird bug on damage function (Unit - Damage Target)
It doesn't deal any damage on idle units. If a unit is just standing

[trigger=Smite]Smite
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Paladin - Smite
Actions
Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Spells and damage type Magic
Unit - Cause (Target unit of ability being cast) to damage (Triggering unit), dealing 100.00 damage of attack type Spells and damage type Magic
[/trigger]

I first noticed it one of my abilities then i made up the code above to test if it is really not working.

If i cast that ability on an idle unit (eg. peasant who do not auto attack), no damage will be dealt to the caster and to the target regardless of the code.

Then if I attack that unit before casting the spell, the damage will go through, until it stops fleeing and becomes idle again.

I tried it on normal units (non-worker type like footman) and still it does not deal any damage unless an attack is successfully made.

I also tried disabling my damage detection system but there was no difference.

The question is... why is this happening? :vw_wtf:
 

Bribe

Code Moderator
Level 50
Joined
Sep 26, 2009
Messages
9,464
Add another action which displays a text message when the Paladin casts smite. That way, you can see if the trigger is running at all.

Some abilities have a channel-time and the "starts effect" event doesn't fire if the Paladin interrupts the channel. Also, some channels never fire the "starts effect" trigger, like Blizzard/Rain of Fire.
 
Level 3
Joined
Dec 22, 2009
Messages
39
Well, I had originally put a special effect function at the end of the trigger and it displays just fine. i was wondering why it only works after I hit it with a basic attack.

EDIT: I did what you suggested and have the target and caster's unit names to display. They did fantastic. Also, i tried making another trigger with the event Player skips cinematic event.
I had a preplaced unit damage a unit stored in a global variable (because i store my heroes on global array with the player number) using Unit - Damage Target . My hero died, meaning it dealt damage.

EDIT2: Well how do you like that, I stored the units in a variable before using Unit - Damage Target and using the variables instead. What happened to Triggering Unit and Target Unit of Ability Being Cast?

EDIT3: I was wrong, it still doesnt do any damage. It dealt damage earlier because I mistakenly pressed ESC before using the ability, therefore triggering the other test trigger i made, making that particular unit deal damage to the hero and thus allowing it to take damage from the ability (because its not idle anymore it dealt damage because of me pressing ESC beforehand)
 
Last edited:
Level 5
Joined
Jan 17, 2014
Messages
131
I tried it and it works fine. Here is my trigger + attached test map.

  • Spell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to "Your Spell"
    • Actions
      • Unit - Cause (Triggering unit) to damage (Target unit of ability being cast), dealing 100.00 damage of attack type Chaos and damage type Universal
      • Unit - Cause (Target unit of ability being cast) to damage (Triggering unit), dealing 100.00 damage of attack type Chaos and damage type Universal
 

Attachments

  • Test Map for aadritch.w3x
    12 KB · Views: 69
Level 3
Joined
Dec 22, 2009
Messages
39
I tried it and it works fine. Here is my trigger + attached test map.

Thats why I said it was weird because I also made another trigger.

I am using [thread=231846]this[/thread].

I think i got what causes the problem but i still dont know why.
I have a custom function which is basically a stun function ( im lazy ) and so if i put it above the damage function, it will not work but if i put the damage function way above, both functions will work together.

But still, whyyyyy :goblin_cry:

EDIT: here's the lazy custom stun function...

[jass=My Jass]function Stun25 takes unit s, unit t, integer l returns nothing

//locals
local location e = GetUnitLoc(t)

call CreateNUnitsAtLocFacingLocBJ( 1, 'u000', GetOwningPlayer(s), e, e )
call UnitAddAbilityBJ( 'A011', GetLastCreatedUnit() )
call SetUnitAbilityLevelSwapped( 'A011', GetLastCreatedUnit(), ( l ) )
call IssueTargetOrderBJ( GetLastCreatedUnit(), "thunderbolt", t )
call UnitApplyTimedLifeBJ( 2.00, 'BTLF', GetLastCreatedUnit() )

//clean
set e = null

endfunction[/code]

Now, actually, all i need to do is put this function at the last line but now the question i must ask is, why does calling this function first make following functions fail to execute properly (like Unit - Damage Target and Special Effect - Create Special Effect)
 
Status
Not open for further replies.
Top