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

[Trigger] Showing text on certain conditions

Status
Not open for further replies.
Level 15
Joined
Aug 18, 2007
Messages
1,390
Now, im making on my map, and wanted to add items that gave abillities aslong they stay in your inventory. It all works fine with the adding/removing spells, but then...

I only want players to be able to have one of theese Power Ups at once, if you buy a Power up, while allready having the other one, it should give an error message. Now, the problem is, that the text is shown when you buy anything else, or just buy the Power up, without having the other one. I can see the error is there, but i dont know how i can fix it, so the text only shows when you can't buy.
Thanks in advance.
Btw, heres my Trigger :

  • Events
    • Unit - Aquires an Item
  • Conditions
  • Actions
    • If (All conditions are true) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Item type of (Item bieng manipullated)) Equal to (Power Up: Blink)
        • (Hero manipullating Item) has (Item of Item-type (Power up: Windwalk) Equal to (False)
      • Then - Actions
        • Add (Blink to (Hero manipulating item)
      • Else - Actions
        • Game - Display to (all players) the Text (Blah blah .....)
    • If (All conditions are true) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Item type of (Item bieng manipullated)) Equal to (Power Up: Windwalk)
        • (Hero manipullating Item) has (Item of Item-type (Power up: Blink) Equal to (False)
      • Then - Actions
        • Add (Wind Walk to (Hero manipulating item)
      • Else - Actions
        • Game - Display to (all players) the Text (Blah blah BLAH.....)
 
Level 7
Joined
Jul 20, 2008
Messages
377
It says
  • (Hero manipullating Item) has (Item of Item-type (Power up: Windwalk) Equal to (False)
So actually you get the error message when you do have the other item. Set it 'Equal to True'.

What? That's what he WANTS. As for the trigger, I don't see why it's not working, unless you're buying the wrong item.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Wtf.
It should be false, yeah, but items are mixed up.
They are:
Blink -> Windwalk
Windwalk -> Blink
And should be:
Blink -> Blink
Windwalk -> Windwalk
And yeah the then actions are unnecessary ;)
 
Level 18
Joined
Aug 23, 2008
Messages
2,319
Sorry, misread that part '^^
Anyway, since there's no other problem noticeable in my opinion, I think the only thing in this trigger that could cause a problem is that same line.

Use a Item-Type Comparison instead of a Boolean Comparison. You'll get:
  • (Item-type of (Item being manipulated)) Equal to (Power up: Windwalk)
The reason this could be the solution is that the condition may be checked before the items goes into your inventory. With this Item-Type Comparison you can avoid that in case that's the problem.
 
Level 7
Joined
Jul 20, 2008
Messages
377
Oh, there's your problem then. In an if-statement, the else condition is true if the "if" conditions are false.

In propositional logic:

If X, do A
Else do B

If X is true, it will do A. But if X is false, and regardless of what other conditions there are, X is still false and so it does B.

So have it show the text message if and ONLY if the item being manipulated is already owned.
 
Level 15
Joined
Aug 18, 2007
Messages
1,390
Thanks (+rep) thought it was something like that, but im kinda tired, so i made you guys do the thinking xD

Edit, Worked, but i have 2 problems now:

1: This wont stop players from buying the same item twice!
2: This will check Blink first, meaning if i have wind walk, and buy blink, the Windwalk will be removed, instead of the Blink.
 
Status
Not open for further replies.
Top