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

Help with a potion spell

Status
Not open for further replies.
Level 8
Joined
Aug 3, 2008
Messages
257
So i'm making an rpg and in a book i have a spell called use potion, i need it to take 1 lumber away from the unit when you use the spell then use the spell otherwise do nothing

Uhm i've tried various things like...
  • Potion
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Use a Potion (Dummy)
          • ((Owner of (Casting unit)) Current lumber) Greater than or equal to 1
        • Then - Actions
          • Player - Set (Owner of (Casting unit)) Current lumber to (((Matching player) Current lumber) - 1)
          • Hero - Drop the item from slot 5 of (Matching unit)
          • Hero - Create Potion and give it to (Casting unit)
          • Hero - Order (Matching unit) to use (Last created item)
          • Hero - Give (Last dropped item) to (Matching unit)
        • Else - Actions
and other things but it just wont work any ideas?

basically whats wrong is it doesn't take 1 lumber, and it doesn't use the potion it creates, if anyone has a better solution please help?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
Make the potion a use on aquire item like a tome, so that it heals you as the hero gets it thus preventing the need to order the hero to use the item. Next make the event on spell effect, as beginnings and ends can cause bugs.

Next your actions make no sense, there is no matching unit, and no matching player so I have no clue what you were thinking when you used them. Replace all those matching units and players with actual players and not something which is returning null.

Matching unit is used in the condition of a selection of some kind, like adding units to a unit group. Matching player is used similarly but for forces.
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
You could just set its life instead of use items, and (Matching Player) won't work, cuz its not used in a player-group to match something. Use (Owner of (Triggering Unit)) on both places.

Heres an example:

  • Blah
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to <Ability>
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to 1
        • Then - Actions
          • Unit - Set life of (Triggering unit) to ((Life of (Triggering unit)) + 50.00)
          • Player - Add -1 to (Owner of (Triggering unit)) Current lumber
        • Else - Actions
          • Game - Display to (Player group((Owner of (Triggering unit)))) for 5.00 seconds the text: You don't have enou...
 
Status
Not open for further replies.
Top