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

Potion Refill Need Help

Status
Not open for further replies.
Level 2
Joined
Aug 15, 2009
Messages
19
I just started to dealing the map editor recently and I am facing a problem to make an item which can refill itself when entering a region and in the same time it is not item slot specific.

example
When a unit enter a region and then it will refill the empty bottle to make it usable.(the filled bottle will take the slot position of the empty bottle and replace it)

Can someone please show me how to do so by using GUI trigger.

Thank.
 
Level 11
Joined
Aug 1, 2009
Messages
714
Try this...
Firstly you need to set some things

Firstly you need some bottle (Full Bottle, 2/3 Bottle, 1/3 Bottle, and Empty Bottle)
Next some triggerring.
This trigger will change the bottle when use.
  • Bottles
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Full Bottle 3/3
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Full Bottle 3/3)
          • Hero - Create Magical Bottle 2/3 and give it to (Hero manipulating item)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Magical Bottle 2/3
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Magical Bottle 2/3)
          • Hero - Create Magical Bottle 1/3 and give it to (Hero manipulating item)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Magical Bottle 1/3
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Magical Bottle 1/3)
          • Hero - Create Empty Bottle and give it to (Hero manipulating item)
        • Else - Actions
          • Do nothing
Then this trigger
This trigger will refill the bottle.
  • Bottle Refills
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Bottle Area 2 <gen> contains (Picked unit)) Equal to True
                  • (Bottle Area 1 <gen> contains (Picked unit)) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) has an item of type Magical Bottle 1/3) Equal to True
                  • ((Picked unit) has an item of type Magical Bottle 2/3) Equal to True
                  • ((Picked unit) has an item of type Empty Bottle) Equal to True
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) of type Magical Bottle 1/3)
              • Item - Remove (Item carried by (Picked unit) of type Magical Bottle 2/3)
              • Item - Remove (Item carried by (Picked unit) of type Empty Bottle)
              • Hero - Create Full Bottle 3/3 and give it to (Picked unit)
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\Polymorph\PolyMorphDoneGround.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Do nothing
I hope I'll helped.
 
Try this...
Firstly you need to set some things

Firstly you need some bottle (Full Bottle, 2/3 Bottle, 1/3 Bottle, and Empty Bottle)
Next some triggerring.
This trigger will change the bottle when use.
  • Bottles
    • Events
      • Unit - A unit Uses an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Full Bottle 3/3
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Full Bottle 3/3)
          • Hero - Create Magical Bottle 2/3 and give it to (Hero manipulating item)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Magical Bottle 2/3
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Magical Bottle 2/3)
          • Hero - Create Magical Bottle 1/3 and give it to (Hero manipulating item)
        • Else - Actions
          • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Magical Bottle 1/3
        • Then - Actions
          • Item - Remove (Item carried by (Hero manipulating item) of type Magical Bottle 1/3)
          • Hero - Create Empty Bottle and give it to (Hero manipulating item)
        • Else - Actions
          • Do nothing
Then this trigger
This trigger will refill the bottle.
  • Bottle Refills
    • Events
      • Time - Every 0.01 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Bottle Area 2 <gen> contains (Picked unit)) Equal to True
                  • (Bottle Area 1 <gen> contains (Picked unit)) Equal to True
              • Or - Any (Conditions) are true
                • Conditions
                  • ((Picked unit) has an item of type Magical Bottle 1/3) Equal to True
                  • ((Picked unit) has an item of type Magical Bottle 2/3) Equal to True
                  • ((Picked unit) has an item of type Empty Bottle) Equal to True
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) of type Magical Bottle 1/3)
              • Item - Remove (Item carried by (Picked unit) of type Magical Bottle 2/3)
              • Item - Remove (Item carried by (Picked unit) of type Empty Bottle)
              • Hero - Create Full Bottle 3/3 and give it to (Picked unit)
              • Special Effect - Create a special effect attached to the overhead of (Picked unit) using Abilities\Spells\Human\Polymorph\PolyMorphDoneGround.mdl
              • Special Effect - Destroy (Last created special effect)
            • Else - Actions
              • Do nothing
I hope I'll helped.

for the second trigger, instead of a periodic event why dont just make a
Unit - Enters Region event?
 
You forgot to mention it will also render the map unplayable in a few minutes due to leaks...
Also do nothing is stupid and pointless (its an empty function call). Never use Do Nothing.

The trigger for refilling should use the enter region event.

a unit group for every .01 seconds.... sigh.... maybe you can give him the new trigger?
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,200
cboy123, then your triggering is bad, as that does not even make sense as it would respond when the unit enters a region before he can use any items in it.

I am aware that using the potions in the region would be a problem then as they would not refil, but if nescescary an extra check can be added to the potion consumtion trigger to cover this and it is certainly better than running a expensive bit of code 100 times a second while leaking 100 groups of all units in the rect.
 
Status
Not open for further replies.
Top