HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

casting on selected unit

07-04-2006, 04:41 PM#1
Xios
my map contains ALOT of spells, and it is an rpg type, what i need is so whenever your hero casts a spell, i casts it on the selected unit.
i have no idea on how to do this, mabie it is possible on Jass?
07-04-2006, 04:43 PM#2
Alevice
So, the speell would be casted on himself (the hero must be selected in order to make him cast an spell), or you meant a target unit?

For the first, you can base your spell on frenzy.
07-04-2006, 04:52 PM#3
Xios
ah yeah, damn wc3 is nothing like WoW (of which i am an addict)
stuff on wc3 is just not possible.

he needs to cast from his spell book thing and cast it on the selected unit, although you have to select the hero to be able to cast so my idea doesnt work, unless you mess around with the UI or something.

it was mostly just so that you can cast repeatedly without clicking on the spell then moving over to the target again, i suppose hotkeys are gonna take a big part otherwise.
07-04-2006, 04:58 PM#4
Alevice
You could select both, and, through jass, cast the spell on the selected unit that is not the hero.
07-04-2006, 05:05 PM#5
Xios
i cant do jass
07-04-2006, 05:08 PM#6
Alevice
GUI triggers should suffice. I just meant that it has to be a custom spell.
07-04-2006, 05:17 PM#7
Mystic Prophet
You can use a spell book while still having the hero selected can't you?

Oh I see you dont want to keep having to open up the spellbook. Ya I'd go for easy to use hotkeys. like typing z to open up the spellbook and then the hotkey for the spell.
07-04-2006, 06:14 PM#8
PipeDream
You could make your abilities put the interface into a mode where selecting a unit casts a spell on that unit. Technically you could do it in GUI as it does not require a lot of complexity, but there is no point in doing things the hard way. Good time for you to figure JASS out.
Rough outline however you do it:
Base hero abilities on something untargeted
Create trigger for each base ability with event unit begins casting
Create trigger for real spells with event unit is selected

Actions for base ability: Set spell to cast for real spell trigger to appropriate ability.
Actions for real spell: Use a dummy to cast the spell. Disable self until event dummy finishes casting.
07-04-2006, 06:32 PM#9
harshateja
very hard if nearly impossible. THe problem with pipedream's solution is you can't cast an ability while selecting an enemy (neither can you select more than one group of units if it includes at least one enemy).

The only solution I can think of is share unit control and use the spellbook trick someone posted up here a while ago which automatically opens the spellbook when select another unit. THe main problem with this is trying to prevent other people from moving or controlling that unit without stopping its current action.

Well, another solution is using multiboard. If you do this right, it should be relatively foolprooof.
07-04-2006, 06:59 PM#10
shadow1500
Emulate selection, detect the selection of a target, then select the hero back and activate the hotkey for the spellbook. Create a SFX on the target to indicate that its selected.
07-04-2006, 09:56 PM#11
PipeDream
You misunderstand my intended interface. You cast an ability which sets you into a state where whenever you click on an enemy, it casts some spell. There's no interaction with hotkeys, spellbooks, or SelectUnit().

Shadow's way could work too. Use some sort of state to indicate go to spellbook mode on select. Perhaps a single spell of the sort I intend or double clicks.