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

[Solved]*Item refund trigger not working

Status
Not open for further replies.
Level 7
Joined
May 15, 2009
Messages
169
  • Items From Shop
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • Set Item_Value = (Integer((Current life of (Sold Item))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Level of Player_Hero[(Player number of (Owner of (Buying unit)))]) Less than (Item level of (Sold Item))
        • Then - Actions
          • Player - Add Item_Value to (Owner of (Buying unit)) Current gold
          • Game - Display to (Player group((Owner of (Buying unit)))) the text: (You must be level + (Colors_Players[1] + (((String((Item level of (Sold Item)))) + Colors_Endtag) + ( or higher to use this + (Name of (Sold Item))))))
          • Hero - Drop (Sold Item) from (Buying unit)
          • Item - Remove (Sold Item)
        • Else - Actions
So, I made that up; and it isnt working. Well, everything is working except for the refund part. It will tell me all of the correct text, and it will drop the item and remove it from the game.

What it doesnt do though; is provide me with the gold. This seems to be exactly what all of the 400 posts on this topic suggest that I do. Either this or using units or item level (Which I cant use, because it decided if my hero is a high enough level to buy the item).

I am using an item that is used on pick up. Based on a tome; that way I can buy the item with a full inventory. Either way; I have the gold cost and life of the item set to the same values.

Is it impossible to do it this way? >< Am I gonna have to switch to using units to make my recipes?
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
It should work with tomes.

The only problem I might see is that the level of the hero has to be LOWER than the level of the item.
Usually it should be HIGHER.

Let's say the item level is 5, that means the hero must be level 5 or higher. In your trigger it must be lower than 5.
But that's the only weird thing that caught my eye.
 
Level 7
Joined
May 15, 2009
Messages
169
Yeah, I was messing around with everything while trying to figure it out; I've tried it both ways. Strange as it sounds, I've had problems in the past where sometimes triggers just wouldn't fire, so I remade them (copy/paste), identical to how they were before, and they would work. Not sure how/why; but I am gonna give it a shot.

Also, I set up the triggers to make recipes with purchased units; and it seems to be working fine; and it is the same thing except uses "sold unit" ect.
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
Strange, as I created a trigger identical to yours (in a test-map, with the tomes) where it worked perfectly.

About that silly GUI-bug: I've had it before as well.
A trigger just refused to do something, I posted the trigger here on hive and everyone said it worked, but it just wouldn't work for me (even if I disabled all other triggers).
It's just something that can happen, I have no clue why though.

In your case, I'd prefer using tomes, but if units work for you...

Btw: debugging the trigger didn't show anything unusual, right?

Edit: I tried digging up the trigger that failed for me, and a variable was the cause (whenever I used the variable, it just wouldn't do anything). Perhaps try removing the "Item_Value" variable?
 
Level 7
Joined
May 15, 2009
Messages
169
I had it without the variable at first; and it wasnt working. I didnt debug it; because everything was working except for the "value of item" be it in variable or "sold item" form.

I copy and pasted my working unit trigger, and changed "unit" back to "item" and everything seems to be working now.

Ive had this bug happen to me quite a few times, but before it was always in my old map, which has wayyyyyyy too much stuff in it. I figured it was just straining the system too much. This time though was in a map I just started work on last week.

Thanks for the feedbacks ^_^
 
Status
Not open for further replies.
Top