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

simple poison checking, something's gone wrong

Status
Not open for further replies.
Level 10
Joined
Mar 17, 2012
Messages
579
Hello everyone! It seems to me that I'm starting to be missing something.
I have a passive spell that has to poison any unit he attacks or casts a spell upon.
Here're some triggers:

  • Poisoned Weapon init
    • Events
    • Unit - A unit Is attacked
    • Conditions
    • And - All (Conditions) are true
    • Conditions
    • (Level of Poisoned Weapon for (Attacking unit)) Greater than 0
    • (Poisoned_Weapon_Target[Player_Number_Int] is A structure) Not equal to True
    • Actions
    • Set Player_Number_Int = (Player number of (Owner of (Triggering unit)))
    • Set Poisoned_Weapon_Owner[Player_Number_Int] = (Attacking unit)
    • Set Poisoned_Weapon_Target[Player_Number_Int] = (Triggering unit)
    • Set Poisoned_Weapon_Point[Player_Number_Int] = (Position of Poisoned_Weapon_Owner[Player_Number_Int])
    • Set Poisoned_Weapon_Damage[Player_Number_Int] = (((Real((Level of Poisoned Weapon for Poisoned_Weapon_Owner[Player_Number_Int]))) x 2.00) + 4.00)
    • Unit - Create 1 Regular Dummy for (Owner of Poisoned_Weapon_Owner[Player_Number_Int]) at Poisoned_Weapon_Point[Player_Number_Int] facing Default building facing degrees
    • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
    • Unit - Add Poisoned Weapon dummy to (Last created unit)
    • Unit - Set level of Poisoned Weapon dummy for (Last created unit) to (Level of Poisoned Weapon for Poisoned_Weapon_Owner[Player_Number_Int])
    • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike Poisoned_Weapon_Target[Player_Number_Int]
    • Custom script: call RemoveLocation(udg_Poisoned_Weapon_Point[udg_Player_Number_Int])
  • Poisoned Weapon loop
    • Events
    • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
    • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
    • Set Poisoned_Weapon_Group[(Integer A)] = (Units owned by (Player((Integer A))) matching (((Matching unit) has buff Poisoned Weapon ) Equal to True))
    • Unit Group - Pick every unit in Poisoned_Weapon_Group[(Integer A)] and do (Actions)
    • Loop - Actions
    • Unit - Cause Poisoned_Weapon_Owner[(Integer A)] to damage Poisoned_Weapon_Target[(Integer A)], dealing (Poisoned_Weapon_Damage[Player_Number_Int] / 2.00) damage of attack type Chaos and damage type Poison
    • Custom script: call DestroyGroup(udg_Poisoned_Weapon_Group[GetForLoopIndexA()])
  • Penetrating Hit
    • Events
    • Unit - A unit Starts the effect of an ability
    • Conditions
    • (Ability being cast) Equal to Penetrating Hit
    • Actions
    • Set Player_Number_Int = (Player number of (Owner of (Target unit of ability being cast)))
    • Set Penetrating_Hit_Caster[Player_Number_Int] = (Triggering unit)
    • Set Penetrating_Hit_Target[Player_Number_Int] = (Target unit of ability being cast)
    • Set Penetrating_Hit_Damage[Player_Number_Int] = ((Real((Strength of Penetrating_Hit_Caster[Player_Number_Int] (Include bonuses)))) x (((Real((Level of Penetrating Hit for Penetrating_Hit_Caster[Player_Number_Int]))) x 0.15) + 1.35))
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • And - All (Conditions) are true
    • Conditions
    • (Level of Poisoned Weapon for Penetrating_Hit_Caster[Player_Number_Int]) Greater than 0
    • (Penetrating_Hit_Target[Player_Number_Int] is A structure) Not equal to True
    • Then - Actions
    • Set Penetrating_Hit_Point[Player_Number_Int] = (Position of Penetrating_Hit_Target[Player_Number_Int])
    • Unit - Create 1 Regular Dummy for (Owner of Penetrating_Hit_Caster[Player_Number_Int]) at Penetrating_Hit_Point[Player_Number_Int] facing Default building facing degrees
    • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
    • Unit - Add Poisoned Weapon dummy to (Last created unit)
    • Unit - Set level of Poisoned Weapon dummy for (Last created unit) to (Level of Poisoned Weapon for Penetrating_Hit_Caster[Player_Number_Int])
    • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike Penetrating_Hit_Target[Player_Number_Int]
    • Custom script: call RemoveLocation(udg_Penetrating_Hit_Point[udg_Player_Number_Int])
    • Else - Actions
    • Unit - Cause Penetrating_Hit_Caster[Player_Number_Int] to damage Penetrating_Hit_Target[Player_Number_Int], dealing Penetrating_Hit_Damage[Player_Number_Int] damage of attack type Pierce and damage type Normal
I've got to say that 1st and 3rd triggers are working, the 2-nd one isn't! :([/hidden][/hidden]
 
Last edited:

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
It certainly works.
  • Start Quests
    • Events
      • Player - Player 1 (Red) Selects a unit
    • Conditions
      • ((Triggering unit) is in quest_givers) Equal to True
    • Actions
      • Custom script: set udg_quest = LoadQuestHandle(udg_quest_hash, GetHandleId(GetTriggerUnit()), 1)
      • Custom script: set udg_quest_mark[1] = LoadEffectHandle(udg_quest_hash, GetHandleId(GetTriggerUnit()), 2)
      • Custom script: set udg_quest_name = LoadStr(udg_quest_hash, GetHandleId(GetTriggerUnit()), 3)
      • Special Effect - Destroy quest_mark[1]
      • Quest - Enable quest
      • Unit Group - Remove (Triggering unit) from quest_givers
      • Unit Group - Add (Triggering unit) to quest_turn_ins
      • Quest - Flash the quest dialog button
      • Set message = (New quest "[yellow] + (quest_name + [/yellow]"))
      • Custom script: set udg_message = ConvertString(udg_message)
      • Game - Display to Player Group - Player 1 (Red) for 5.00 seconds the text: message
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to quest_giver
          • wolf_quest_in_progress Equal to 1
        • Then - Actions
          • Set wolf_quest_in_progress = 2
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to quest_giver
          • wolf_quest_in_progress Equal to 3
        • Then - Actions
          • Set den_quest_in_progress = 2
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to quest_giver
          • den_quest_in_progress Equal to 4
        • Then - Actions
          • Game - Display to (All players) the text: (String(den_quest_in_progress))
          • Game - Display to (All players) the text: d
          • Set pack_quest_in_progress = 2
          • Unit - Create 1 Swordsman for Player 6 (Orange) at (Center of unit spawn 1 <gen>) facing 180.00 degrees
          • Unit Group - Add (Last created unit) to assist_group
          • Unit - Create 1 Archer for Player 6 (Orange) at (Center of unit spawn 2 <gen>) facing 180.00 degrees
          • Unit Group - Add (Last created unit) to assist_group
          • Unit - Create 1 Archer for Player 6 (Orange) at (Center of unit spawn 3 <gen>) facing 180.00 degrees
          • Unit Group - Add (Last created unit) to assist_group
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering unit) Equal to quest_giver
          • riddle_progress Equal to 1
        • Then - Actions
          • Unit - Create 1 Circle of Power for Player 1 (Red) at (Center of Region 019 <gen>) facing Default building facing degrees
          • Special Effect - Create a special effect at (Center of Region 019 <gen>) using light.mdl
          • Set riddle_progress = 2
        • Else - Actions
 
Level 10
Joined
Mar 17, 2012
Messages
579
It certainly works.

1. Attack initiation
  • Poisoned Weapon init
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • And - All (Conditions) are true
        • Conditions
          • (Level of Poisoned Weapon for (Attacking unit)) Greater than 0
          • (Poisoned_Weapon_Target[Player_Number_Int] is A structure) Not equal to True
    • Actions
      • Set Player_Number_Int = (Player number of (Owner of (Triggering unit)))
      • Set Poisoned_Weapon_Owner[Player_Number_Int] = (Attacking unit)
      • Set Poisoned_Weapon_Target[Player_Number_Int] = (Triggering unit)
      • Set Poisoned_Weapon_Point[Player_Number_Int] = (Position of Poisoned_Weapon_Owner[Player_Number_Int])
      • Set Poisoned_Weapon_Damage[Player_Number_Int] = (((Real((Level of Poisoned Weapon for Poisoned_Weapon_Owner[Player_Number_Int]))) x 2.00) + 4.00)
      • Unit - Create 1 Regular Dummy for (Owner of Poisoned_Weapon_Owner[Player_Number_Int]) at Poisoned_Weapon_Point[Player_Number_Int] facing Default building facing degrees
      • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
      • Unit - Add Poisoned Weapon dummy to (Last created unit)
      • Unit - Set level of Poisoned Weapon dummy for (Last created unit) to (Level of Poisoned Weapon for Poisoned_Weapon_Owner[Player_Number_Int])
      • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike Poisoned_Weapon_Target[Player_Number_Int]
      • Custom script: call RemoveLocation(udg_Poisoned_Weapon_Point[udg_Player_Number_Int])
2. Loop (not working)
  • Poisoned Weapon loop
    • Events
      • Time - Every 0.50 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 12, do (Actions)
        • Loop - Actions
          • Set Poisoned_Weapon_Group[(Integer A)] = (Units owned by (Player((Integer A))) matching (((Matching unit) has buff Poisoned Weapon ) Equal to True))
          • Unit Group - Pick every unit in Poisoned_Weapon_Group[(Integer A)] and do (Actions)
            • Loop - Actions
              • Unit - Cause Poisoned_Weapon_Owner[(Integer A)] to damage Poisoned_Weapon_Target[(Integer A)], dealing (Poisoned_Weapon_Damage[Player_Number_Int] / 2.00) damage of attack type Chaos and damage type Poison
          • Custom script: call DestroyGroup(udg_Poisoned_Weapon_Group[GetForLoopIndexA()])
3. Spell initiation
  • Penetrating Hit
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Penetrating Hit
    • Actions
      • Set Player_Number_Int = (Player number of (Owner of (Target unit of ability being cast)))
      • Set Penetrating_Hit_Caster[Player_Number_Int] = (Triggering unit)
      • Set Penetrating_Hit_Target[Player_Number_Int] = (Target unit of ability being cast)
      • Set Penetrating_Hit_Damage[Player_Number_Int] = ((Real((Strength of Penetrating_Hit_Caster[Player_Number_Int] (Include bonuses)))) x (((Real((Level of Penetrating Hit for Penetrating_Hit_Caster[Player_Number_Int]))) x 0.15) + 1.35))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Level of Poisoned Weapon for Penetrating_Hit_Caster[Player_Number_Int]) Greater than 0
              • (Penetrating_Hit_Target[Player_Number_Int] is A structure) Not equal to True
        • Then - Actions
          • Set Penetrating_Hit_Point[Player_Number_Int] = (Position of Penetrating_Hit_Target[Player_Number_Int])
          • Unit - Create 1 Regular Dummy for (Owner of Penetrating_Hit_Caster[Player_Number_Int]) at Penetrating_Hit_Point[Player_Number_Int] facing Default building facing degrees
          • Unit - Add a 0.20 second Generic expiration timer to (Last created unit)
          • Unit - Add Poisoned Weapon dummy to (Last created unit)
          • Unit - Set level of Poisoned Weapon dummy for (Last created unit) to (Level of Poisoned Weapon for Penetrating_Hit_Caster[Player_Number_Int])
          • Unit - Order (Last created unit) to Night Elf Warden - Shadow Strike Penetrating_Hit_Target[Player_Number_Int]
          • Custom script: call RemoveLocation(udg_Penetrating_Hit_Point[udg_Player_Number_Int])
        • Else - Actions
      • Unit - Cause Penetrating_Hit_Caster[Player_Number_Int] to damage Penetrating_Hit_Target[Player_Number_Int], dealing Penetrating_Hit_Damage[Player_Number_Int] damage of attack type Pierce and damage type Normal
Here you go :)
 
Level 10
Joined
Mar 17, 2012
Messages
579
shouldn't you damage picked unit rather than that variable?

You mean basic attack? Yes, sure. Other players also can damage this unit that has buff

I'm not sure that I understood your question correctly, but I'll try to explain what that trigger should do:
When a hero attacks or casts a spell upon any enemy unit, that unit recieves buff Poisoned Weapon (triggers 1 and 3 are managing it perfectly).
Every unit that has buff Poisoned Weapon should recieve some periodic damage which is set in the 1-st trigger as Poisoned_Weapon_Damage[Player_Number_Int]

But it's weird that it's not working actually, because triggers look fine to me...:ogre_icwydt:

More news: now it started to cause lags while somebody is under the effect of this poison :vw_wtf: I removed the loop trigger and it keeps lagging harder and harder with each attack...
 
Last edited:
Status
Not open for further replies.
Top