HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Casting a spell when an item is purchased

07-30-2006, 10:28 PM#1
Beannie
I have a Merchant who sells an item called Healing services. When you purchase this, i want him to cast healing spray at the given target. I cannot get this to work. I've also tryed just getting the unti to play the special effect animation at the target when you purchase, but that dosent work either. Can anyone help?
07-30-2006, 11:21 PM#2
Vexorian
what about showing up the trigger you are currently using. Cause it *should* work maybe there is a mistake in code
07-30-2006, 11:36 PM#3
Beannie
Im not sure how to post the actual trigger so heres what i have.

Events
Animation - Play Troll Witch Doctor 0005 <gen>'s (Name of Healing Spray) animation


Conditons
(Item-type of (Sold Item)) Equal to Healing Services

Actions
Animation - Play Troll Witch Doctor 0005 <gen>'s (Name of Healing Spray) animation



This is waht i have for the selling of the item and just cast teh animation of the spell
07-30-2006, 11:46 PM#4
The)TideHunter(
To put it into a trigger looking box, type:
Trigger Box:
[trigger]This is my Trigger code[/trigger]
Output:
Trigger:
This is my Trigger code

Your trigger (as copied)
Trigger:
Collapse Events
Animation - Play Troll Witch Doctor 0005 <gen>'s (Name of Healing Spray) animation
Collapse Conditions
(Item-type of (Sold Item)) Equal to Healing Services
Collapse Actions
Animation - Play Troll Witch Doctor 0005 <gen>'s (Name of Healing Spray) animation

I see your event is actually a action, i will fix that and show you a working action.

Trigger:
Use Potion
Collapse Events
Unit - A unit Sells an item (from shop)
Collapse Conditions
(Item-type of (Sold Item)) Equal to Healing Services
Collapse Actions
Hero - Order (Buying unit) to use (Sold Item) on (Buying unit)

BTW: Above your first Event, is your triggers name, right click that and click "Copy as Text", then that will be the guidline to the trigger box on Wc3c, so then you can just paste it inbetween
Code:
[trigger]Paste Here[/trigger]
07-30-2006, 11:51 PM#5
The)TideHunter(
Quote:
Originally Posted by The)TideHunter(
BTW: Above your first Event, is your triggers name, right click that and click "Copy as Text", then that will be the guidline to the trigger box on Wc3c, so then you can just paste it inbetween
Code:
[trigger]Paste Here[/trigger]

Anyways, if thats your event, heres the trigger:

Trigger:
Collapse Events
Unit - Troll Witch Doctor 0005 <gen> Sells an item (from shop)
Collapse Conditions
(Item-type of (Sold Item)) Equal to Tome of Experience
Collapse Actions
Hero - Order (Buying unit) to use (Sold Item) on (Buying unit)
07-31-2006, 12:01 AM#6
Beannie
Sorry i saw it, heres the actual trigger


Trigger:
Purchase Healing
Collapse Events
Unit - Troll Witch Doctor 0005 <gen> Sells an item (from shop)
Collapse Conditions
(Item-type of (Sold Item)) Equal to Healing Services
Collapse Actions
Animation - Play Troll Witch Doctor 0005 <gen>'s (Name of Healing Spray) animation

and all that trigger you gave me does is make the buying unit use the item being purchased. I want the Unit selling the item (My troll witch doctor) to cast healing spray, or just the healing spray animation at the buying unit.
07-31-2006, 12:05 AM#7
The)TideHunter(
By 'Healing Services', and your last thread, i thought you wanted the item to be used when it is purchased.
Healing spray is a AoE ability.
Firstly the shop must have the Healing Spray ability.
If it does, you can use this trigger:

Trigger:
Auto Healing Spray
Collapse Events
Unit - A unit Sells an item (from shop)
Collapse Conditions
(Item-type of (Sold Item)) Equal to Healing Services
Collapse Actions
Set Temp_Location = (Position of (Buying unit))
Unit - Order (Selling unit) to Neutral Alchemist - Healing Spray Temp_Location
Custom script: call RemoveLocation(udg_Temp_Location)

If the shop dosent have the ability, add it, like in this trigger:

Trigger:
Auto Healing Spray
Collapse Events
Unit - A unit Sells an item (from shop)
Collapse Conditions
(Item-type of (Sold Item)) Equal to Healing Services
Collapse Actions
Set Temp_Location = (Position of (Buying unit))
Unit - Add Healing Spray to (Selling unit)
Unit - Order (Selling unit) to Neutral Alchemist - Healing Spray Temp_Location
Custom script: call RemoveLocation(udg_Temp_Location)

BTW: You need a variable called "Temp_Location", and the variable type is "Point".
07-31-2006, 12:24 AM#8
Ice_Keese
And if you don't know what is that "Temp_Location" for, it's to prevent memory leaks...
07-31-2006, 12:26 AM#9
The)TideHunter(
Quote:
Originally Posted by Ice_Keese
And if you don't know what is that "Temp_Location" for, it's to prevent memory leaks...

Yeah =).
07-31-2006, 12:36 AM#10
Beannie
Alright i got it to work, but now i have two questions

1) When you add teh ability Healing wave, the spell is now usable by the unit next to the Merchant, so they can use the spell without buying the Item. How do i fix this?

2) Can you set it so custom spells are useable when you buy the item, or just preset skills in the game?

Trigger:
Purchase Healing
Collapse Events
Unit - A unit Sells an item (from shop)
Collapse Conditions
(Item-type of (Sold Item)) Equal to Healing Services
Collapse Actions
Set Temp_Location = (Position of (Buying unit))
Unit - Add Healing Spray to (Selling unit)
Unit - Order (Selling unit) to Neutral Alchemist - Healing Spray Temp_Location
Custom script: call RemoveLocation(udg_Temp_Location)

this is my trigger
07-31-2006, 08:47 AM#11
The)TideHunter(
To be honest, i wouldent make the shop cast it, but make it seem like it casts it with a dummy unit, then you can remove it.
This is what you could do:

Trigger:
Heal Spray
Collapse Events
Unit - A unit Sells an item (from shop)
Collapse Conditions
(Item-type of (Sold Item)) Equal to Healing Services
Collapse Actions
Set Temp_Location = (Position of (Buying unit))
Set Temp_Location2 = (Position of (Selling unit))
Unit - Create 1 Dummy Unit for (Owner of (Buying unit)) at Temp_Location2 facing Default building facing degrees
Unit - Add Healing Spray to (Last created unit)
Unit - Order (Last created unit) to Neutral Alchemist - Healing Spray Temp_Location
Unit - Add a 20.00 second Generic expiration timer to (Last created unit)
Custom script: call RemoveLocation(udg_Temp_Point)
Custom script: call RemoveLocation(udg_Temp_Point2)

Just make a dummy unit in the object editor, with like 10000 mana (abilities do cost mana) and give the unit the abilities: Invunerable and Locust ('Avul' and 'Aloc') This will make the dummy more like a dummy and not like a peasent or anything.
If you dont have Vexorians dummy model, you can just use "Zone indicator (Custom Campaign)" for the model of the dummy.