• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Trigger is not working

Status
Not open for further replies.
Level 5
Joined
Jun 24, 2012
Messages
112
Sell Item Trigger Not Working 100%

OK so I made a "Sell Item System" that allows the player to sell their items. For some reason, 4 of the 16 items that can be sold, are not giving their gold value to the player and display a "0" for the floating text.

I have 2 triggers.
In the first one, I set all the variables relating to the items themselves.
In the second, I sell the item and give the player their gold based on which item was sold.

  • IS Data
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- --- --------
      • -------- Weapons --------
      • -------- --- --------
      • Set EquipableItemType[0] = Rainbow Rod
      • Set EquipableItemValue[0] = 250
      • Set EquipableItemType[1] = |cCF0041FFFlow Trident|r
      • Set EquipableItemValue[1] = 650
      • Set EquipableItemType[2] = |cCF1FBF00Mr. Freeze's Ice Cane|r
      • Set EquipableItemValue[2] = 1000
      • Set EquipableItemType[3] = |Cfffed312Diablo's Wrath|r
      • Set EquipableItemValue[3] = 1835
      • -------- --- --------
      • -------- Off-Hands --------
      • -------- --- --------
      • Set EquipableItemType[100] = Iron Raven Shield
      • Set EquipableItemValue[100] = 250
      • Set EquipableItemType[101] = |cCF0041FFLegionnaire's Shield|r
      • Set EquipableItemValue[101] = 700
      • Set EquipableItemType[102] = |Cfffed312Dracula's Bloodstone|r
      • Set EquipableItemValue[102] = 1500
      • Set EquipableItemType[103] = |Cfffed312Source of Darkness|r
      • Set EquipableItemValue[103] = 2225
      • -------- --- --------
      • -------- Armors --------
      • -------- --- --------
      • Set EquipableItemType[200] = Cow King's Leather
      • Set EquipableItemValue[200] = 175
      • Set EquipableItemType[201] = Rainbow Armor
      • Set EquipableItemValue[201] = 250
      • Set EquipableItemType[202] = |cCF0041FFPimp Suit|r
      • Set EquipableItemValue[202] = 1000
      • Set EquipableItemType[203] = |Cfffed312Hammadin's Robes|r
      • Set EquipableItemValue[203] = 1835
      • -------- --- --------
      • -------- Accessories --------
      • -------- --- --------
      • Set EquipableItemType[300] = Cursed Necklace
      • Set EquipableItemValue[300] = 150
      • Set EquipableItemType[301] = |cCF0041FFVoodoo Doll|r
      • Set EquipableItemValue[301] = 850
      • Set EquipableItemType[302] = |cCF0041FFVengeful Horn|r
      • Set EquipableItemValue[302] = 1000
      • Set EquipableItemType[303] = |Cfffed312Cloak of Shadows|r
      • Set EquipableItemValue[303] = 1350
      • -------- --- --------
      • -------- Frost Nova Data --------
      • -------- --- --------
      • Set AbilityDamageFactor[31] = 3.00
      • Set AbilityDamageSource[31] = Ice - Frost Nova
      • Set AbilityItemLinkValue[31] = 2
      • Set AbilityDamageType[31] = Cold
      • Custom script: call DestroyTrigger(GetTriggeringTrigger())
  • IS Merchant Sell
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Sell Items (Custom)
    • Actions
      • Set Item[0] = (Target item of ability being cast)
      • Set ItemType = (Item-type of Item[0])
      • For each (Integer A) from 0 to 400, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • EquipableItemType[(Integer A)] Equal to ItemType
            • Then - Actions
              • Set Unit[0] = (Triggering unit)
              • Set Player[0] = (Owner of Unit[0])
              • Set PlayerNumber[0] = (Player number of Player[0])
              • Set Point[0] = (Position of DeathLord[PlayerNumber[0]])
              • Set Point[1] = (Point[0] offset by (Random real number between 0.00 and 16.00) towards (Random angle) degrees)
              • Set PlayerGroup[0] = (Player group(Player[0]))
              • -------- Action! --------
              • Game - Display to (All players) the text: (Name of Item[0])
              • Game - Display to (All players) the text: (Name of (Item carried by DeathLord[PlayerNumber[0]] of type EquipableItemType[(Integer A)]))
              • Game - Display to (All players) the text: (Name of (Item carried by DeathLord[PlayerNumber[0]] of type ItemType))
              • Game - Display to (All players) the text: (String(EquipableItemValue[(Integer A)]))
              • Item - Remove (Item carried by DeathLord[PlayerNumber[0]] of type ItemType)
              • Item - Remove (Item carried by SpiritMerchant[PlayerNumber[0]] of type ItemType)
              • Player - Add EquipableItemValue[(Integer A)] to Player[0] Current gold
              • -------- Effects --------
              • Floating Text - Create floating text that reads (+ + (String(EquipableItemValue[(Integer A)]))) at Point[1] with Z offset 0.00, using font size 10.00, color (100.00%, 80.00%, 20.00%), and 0.00% transparency
              • Set FloatingText = (Last created floating text)
              • Floating Text - Change FloatingText: Disable permanence
              • Floating Text - Hide FloatingText for PlayingForce
              • Floating Text - Show FloatingText for PlayerGroup[0]
              • Floating Text - Set the velocity of FloatingText to 64.00 towards 90.00 degrees
              • Floating Text - Change the lifespan of FloatingText to 2.00 seconds
              • Floating Text - Change the fading age of FloatingText to 1.50 seconds
              • Custom script: call AddLocalSpecialEffectTarget(udg_Player[0], "UI\\Feedback\\GoldCredit\\GoldCredit.mdl", udg_DeathLord[udg_PlayerNumber[0]], "origin")
              • Special Effect - Destroy (Last created special effect)
              • Custom script: if GetLocalPlayer() == udg_Player[0] then
              • Sound - Play ReceiveGold <gen>
              • Custom script: endif
              • -------- Leaks --------
              • Custom script: call RemoveLocation(udg_Point[0])
              • Custom script: call RemoveLocation(udg_Point[1])
              • Custom script: call DestroyForce(udg_PlayerGroup[0])
              • Skip remaining actions
            • Else - Actions
Strangely enough, the second trigger works perfectly except for 4 specific items: Cow King's Leather, Rainbow Rod, Rainbow Armor, and Cursed Necklace.
Even more strange is that I used game messages to debug, and the messages display the correct value for these items, but the floating text is displaying incorrectly and no gold is refunded to the player.
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
· Avoid repetitive callings using variables. Reduce Parentheses as much as you can. My variable names are just examples for temporary variables.

  • IS Merchant Sell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sell Items
    • Actions
      • Set Unit = (Triggering Unit)
      • Set Player = (Triggering Player)
      • Set I = (Player number of Player)
      • Set B = (Item type of (Target item of ability being cast))
      • For each (Integer A) from 1 to 150, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • IS_ItemType[(Integer A)] Equal to B
            • Then - Actions
              • Set A = (Integer A)
              • Game - Display to (All players) the text: (String(A))
              • Game - Display to (All players) the text: (String(IS_ItemValue[A]))
              • Set IS_Force[0] = (Player group(Player))
              • Player - Add IS_ItemValue[A] to Player Current gold
              • Floating Text - Create floating text that reads (String(IS_ItemValue[A])) above HH_HeroUnit[I] with Z offset 0.00, using font size 10.00, color (100.00%, 80.00%, 20.00%), and 0.00% transparency
              • Set F = (last created floating text)
              • Floating Text - Hide F for (All players)
              • Floating Text - Show F for IS_Force[0]
              • Floating Text - Change F: Disable permanence
              • Floating Text - Set the velocity of F to 64.00 towards 90.00 degrees
              • Floating Text - Change the lifespan of F to 1.50 seconds
              • Floating Text - Change the fading age of F to 1.00 seconds
              • Item - Remove (Item carried by HH_HeroUnit[I] of type B)
              • Item - Remove (Item carried by HH_Witch[I] of type B)
              • Custom script: call DestroyForce(udg_IS_Force[0])
              • Custom script: set bj_forLoopAIndex = 500
            • Else - Actions
· End the loop increasing A, instead of using "exitwhen". Setting "bj_forLoopAIndex" to a value greather than the max one given in the loop setup (For each integer A from *minimum* to *maximum*) automatically stops the trigger.

· What do you mean when you say the Floating Text gets messed up? Whats exactly going wrong?
 
Status
Not open for further replies.
Top