HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to make a spell that...

10-27-2004, 04:05 PM#1
Undifty
How do i make a spell that (for example) have a 20% chance to do chain lightning, 20% chance to do firebolt, 20% chance to do stormbolt and 40% chance to be ineffective? how do i do a spell like that?
10-27-2004, 04:49 PM#2
th15
Give the unit a dummy ability, have triggers that generate a random value and check that to determine what sort of spell is cast. Use dummy casters to do the actual spell casting.
10-27-2004, 04:52 PM#3
Dalten
Quote:
Originally Posted by Undifty
How do i make a spell that (for example) have a 20% chance to do chain lightning, 20% chance to do firebolt, 20% chance to do stormbolt and 40% chance to be ineffective? how do i do a spell like that?

You know how to set a certain variable, an integer called "Chance" for example, to a random number between 1 and 5 right?

What you'll have to do is also create a dummy, invisible unit(put " .mdl" in for the model file, WITH the quotes. Give this unit all the spells that have a chance of casting.

Then, when your hero casts the spell you're talking about. it should bea spell that does nothing, other than trigger this next trigger:

Event: a unit begins to cast an ability

Condition: ability being cast = your ability

Actions: Set Chance = random integer between 1 and 5

If chance = 1, then cast firebolt
If chance = 2 then cast chain lightning
if chance = 3 then cast storm bolt
if chance = 4 or chance = 5 then do nothing

Edit: to cast the firebolt, chainlightning, storm bolt etc, you'll need to create the dummy at the location of your hero, give it a small expiration timer so it dies automatically, make it explode on death to be sure it's cleared out of memory, and also issue an order targeting (target unit of ability being cast), using the order of whatever spell it is you want, like storm bolt, firebolt, chainlightning, etc.

Post how it goes...

Play around with it, if you're not familiar with trigger based spells this is probably a good one to start learning on.
10-27-2004, 04:52 PM#4
Undifty
Quote:
Originally Posted by th15
Give the unit a dummy ability, have triggers that generate a random value and check that to determine what sort of spell is cast. Use dummy casters to do the actual spell casting.

But if i want that the missile shall come from my hero?
10-27-2004, 04:56 PM#5
Dalten
Quote:
Originally Posted by Undifty
But if i want that the missile shall come from my hero?

If you have an invisible unit casting storm bolt at the location of your hero, it will appear that your hero threw it, because chances are whatever dummy spell you have will cause your hero to do a casting animation as well, so it looks almost perfect.
10-28-2004, 04:45 AM#6
logik
omg... its soooo basic

all you do is make the spell off of "new orb of lightning"

it allows a % chance to cast any targetable ability.
10-28-2004, 09:18 AM#7
th15
logik, as easy as it is to do that, it's even easier to actually read the original post. Orbs allow you to set a % chance to cast any one spell on attack and cannot be actively used, also, all orb effects overide each other so it'd get pretty damn messy (and waste 3 good command card slots).
10-28-2004, 09:24 AM#8
GreyArchon
Quote:
Originally Posted by logik
omg... its soooo basic

all you do is make the spell off of "new orb of lightning"

it allows a % chance to cast any targetable ability.


He wants a% chance to cast one of three possible spells. :god_help_us:
10-28-2004, 12:31 PM#9
Undifty
Well.... i am glad that you guys helped me
And the orb ability...... i would need that for another spell . Thanks! I will give you all a small credit in my map