- 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.
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.
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())
-
Events
-
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
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
Events
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: