• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!
  • ✅ The POLL for Hive's Texturing Contest #33 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!

Trigger question

Status
Not open for further replies.
Level 7
Joined
Feb 23, 2020
Messages
253
Hello, this item does not stack, like if you have 6 of these it should technically be 60% chance right?
Is there a way to make this work

  • Staff of the old Wizard Work
    • Events
      • Game - GDD_Event becomes Equal to 0.00
    • Conditions
      • ((Item carried by GDD_DamageSource of type Staff of the old Wizard) is owned) Equal to True
    • Actions
      • Set VariableSet StaffOfTheOldWizard_Point = (Position of GDD_DamageSource)
      • Set VariableSet StaffOfTheOldWizard_Attacked = GDD_DamagedUnit
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 100) Less than or equal to 10
        • Then - Actions
          • Unit - Create 1 Dummy Frost Nova Caster (Staff of the old Wizard) for (Owner of GDD_DamageSource) at StaffOfTheOldWizard_Point facing Default building facing degrees
          • Set VariableSet StaffOfTheOldWizard_Dummy = (Last created unit)
          • Unit - Add a 1.00 second Generic expiration timer to StaffOfTheOldWizard_Dummy
          • Unit - Add Frost Nova (Staff of the old Wizard) to StaffOfTheOldWizard_Dummy
          • Unit - Order StaffOfTheOldWizard_Dummy to Undead Lich - Frost Nova StaffOfTheOldWizard_Attacked
          • Custom script: call RemoveLocation(udg_StaffOfTheOldWizard_Point)
        • Else - Actions
 

Uncle

Warcraft Moderator
Level 67
Joined
Aug 10, 2018
Messages
6,905
So you need to count how many Staff of the old Wizards that your unit is carrying.

You can do this by looping over each Inventory slot, checking if that Slot has your item, and increasing an Integer that represents your "chance to proc" when it does:
  • Actions
    • Set VariableSet Chance = 0
    • For each (Integer A) from 1 to 6, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Item-type of (Item carried by GDD_DamageSource in slot (Integer A))) Equal to Staff of the old Wizard
          • Then - Actions
            • Set VariableSet Chance = (Chance + 10)
          • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Random integer number between 1 and 100) Less than or equal to Chance
      • Then - Actions
        • Set Variable WizardPoint = Position of GDD_DamageSource
        • -------- do dummy stuff --------
        • Custom script: call RemoveLocation (udg_WizardPoint)
      • Else - Actions
Also, you should remove your Point variable below the If Then Else. Otherwise, you're leaking the Point anytime the ability fails to go off. Edit: Or better yet just create/remove it only when the chance is successful.

And StaffOfTheOldWizard_Attacked seems like a useless variable. It's no different than GDD_DamagedUnit.
 
Last edited:
Level 24
Joined
Jun 26, 2020
Messages
1,861
@Uncle I was just going to comment on that, because the function "Item carried by unit of type" doesn't stack as stops with the first item of that type, and there is an mistake in your trigger:
  • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Staff of the old Wizard
Must be:
  • (Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Staff of the old Wizard
Also, you should remove your Point variable outside of the If Then Else. Otherwise, you're leaking the Point anytime the ability fails to go off.
Or better, he can put the part of he set the variable of the point inside the If Then Else.
 
Status
Not open for further replies.
Top