• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[Solved] It doesn't work

Status
Not open for further replies.
Level 9
Joined
Feb 20, 2014
Messages
409
Hi everyone.
First I added lumber,silver and stone ressources in my map
Here is how I did it :

  • Evénements
    • Unit - A unit Acquiert un objet
  • Conditions
    • (Triggering unit) Equal to Myhero
    • (Item-type of (Item carried by Myhero of type stone)) equal to stone
  • Actions
    • Objet - Remove (Item carried by Myhero of type stone)
    • Set stone = (stone + 1)
    • Multitable - Set the text for (Last created multiboard) item in column 2, row 2 to (String(stone))
    • Texte flottant - Create floating text that reads +1 stone at (Position of (Triggering unit)) with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
    • Wait 0.50 seconds
    • Texte flottant - Destroy (Last created floating text)
Then I wanted to make some item only buyable with these new ressources,and this is where the problem comes ,here an armor which cost 2 silver:
  • Events
    • Unit - Forgeron 0012 <gen> Sell an item (from shop)
  • Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • Si - Conditions
        • (Item-type of (Sold Item)) Equal to Armor
        • silver higher or equal to 2
      • Alors - Actions
        • Set silver = (silver - 2)
        • Multitable - Set the text for (Last created multiboard) item in column 2, row 3 to (String(silver))
      • Sinon - Actions
        • Objet - Remove (Sold Item)
Where is the problem please?
 
Last edited:
Level 13
Joined
Jan 2, 2016
Messages
973
It's hard to read your triggers when they aren't in english xP
Perhaps you have put the wrong event?
One of the events is when you are selling to the shop, and the other is when you are buying from a shop. Yet I can't tell which one are you using as "Vendre un objet (du magasin)" means nothing to me.
 
Level 15
Joined
Sep 29, 2008
Messages
363
Ok, I think you have more triggers like this one, one for any kind of item or resource.
while there's not trigger condition these triggers always will be fired, that means if you have another trigger with your current event. (Unit - Forgeron 0012 <gen> Sell an item (from shop)) it will fire both triggers. I think your trigger is working well but you have another trigger with same event for diferent items or resources. fast fix is moving your if conditions to trigger conditions.
 
Level 9
Joined
Feb 20, 2014
Messages
409
It works thank you :) Last question now :
If I haven't enough ressources the item is removed.
But when an item is removed from your inventory you keep the bonus that it gaves you.
For example a sword with +5 dammage : if I have not enough materials and I click on it to buy it,it is removed that's well but the +5 dammage is still there. How to avoid this "glitch"
 
Status
Not open for further replies.
Top