View Full Version : Potion Refill Need Help
zicron
08-16-2009, 09:48 PM
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.
cboy123
12-09-2009, 08:59 AM
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.
Adiktuz
12-09-2009, 12:48 PM
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?
Dr Super Good
12-09-2009, 12:53 PM
Then this trigger
This trigger will refill the bottle.
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.
Adiktuz
12-09-2009, 12:58 PM
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?
cboy123
12-10-2009, 09:41 AM
If I use Unit-Enters Region well for this reason
If a unit uses a rune inside the region, it won't refill and the unit needs to return to the region again.
Dr Super Good
12-10-2009, 11:54 AM
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.
cboy123
12-10-2009, 12:38 PM
Ohhh Now I understand
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.
Search Engine Optimization by
vBSEO 3.5.1 PL2