HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

how can i make spells that may miss??

02-21-2004, 10:33 PM#1
xtacb
i want to make spells (targeting ones such as stormbolt) has a chance to miss the target , maybe like 80% accuracy of hitting the target

in the abilities i see no option to do this, is there a way to do this?
02-21-2004, 10:38 PM#2
linkmaster23
Well for Storm Bolt you could use a new technique I just came up with. Make an event A unit(generic) begins casting an ability. Then run a set interger variable math -random number between 1-100, then do a if/then/else checking to see if the number is bigger than 80, if it is, order the unit to STOP, thus canceling the ability. OR... Just remove all buffs of targeted unit.
02-21-2004, 10:41 PM#3
Shimrra
You have to use triggers. Say you wanted to make a spell with a fifty percent chance to instantly kill a target enemy unit, you would do this:
Code:
 [b]Event:[/b] Unit begins casting an ability
[b]Condition:[/b] Ability being cast is equal to Instant Kill
[b]Actions:[/b] Set Unit Variable equal to target of ability being cast
Set Integer Variable equal to a random number between 1 and 2
[b]If:[/b] Integer Variable is equal to two
[b]Then:[/b] Kill Unit Variable
[b]Else:[/b] Do nothing
02-21-2004, 10:46 PM#4
xtacb
how can i make it seem like it misses, like how it looks when someone misses a attack on a demon hunter or if someone is shooting uphill

i want to make a powerful spell that does alot of damage but to balance it i want to make it miss sometimes and i want it to look like it still is cast
02-21-2004, 10:58 PM#5
linkmaster23
The game display messages were for me to tell if the ability was even working.

:EDIT: You posting while I was repling, I will show the code you will need.

Floating Text - Create floating text that reads MISS! above (Target unit of ability being cast) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency


TADA!

Ok those were bad. Here is the CURRENT Version that I have that works, I have tested.

Missing Move
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Storm Bolt
Actions
Set Target = (Target unit of ability being cast)
Set Test = (Random integer number between 1 and 100)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Test Greater than or equal to 80
Then - Actions
Unit - Order (Casting unit) to Stop
Floating Text - Create floating text that reads MISS! above Target with Z offset 10.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Wait 0.50 seconds
Floating Text - Destroy (Last created floating text)
Else - Actions
Game - Display to (All players) the text: It hit

There!
02-21-2004, 11:23 PM#6
Pheonix-IV
actually i think he wants the actual projectile to fly to the unit but no damage be done, to do this make a dummy unit that has no collision, no shadow and no model (but can be selected) if it misses then spawn the dummy unit for the owner of the target unit at the location of the target unit, add the last created unit to a variable, order the casting unit to cast the spell on the variable for the last created unit.
02-22-2004, 12:26 AM#7
xtacb
ok i got the regular missing part to work but I cant get that dummy part to work, i made a custom unit from a footman and changed model file to 0.mdl , shadow to NONE, and pathing collision size to 0.00

Ability Miss
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Forked Lightning
Actions
Set target = (Target unit of ability being cast)
Set miss = (Random integer number between 1 and 100)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
miss Less than or equal to 80
Then - Actions
Unit - Order (Casting unit) to Stop
Unit - Create 1 projectile for (Owner of (Target unit of ability being cast)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Set fake = (Last created unit)
Unit - Order (Casting unit) to Neutral Naga Sea Witch - Forked Lightning fake
Unit - Remove (Last created unit) from the game
Floating Text - Create floating text that reads MISS! above target with Z offset 10.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Wait 0.50 seconds
Floating Text - Destroy (Last created floating text)
Else - Actions

when it misses theres no spell i see, what is the part i need to change?
02-22-2004, 12:29 AM#8
linkmaster23
Its equal to or greater than buddy ol' pal.
02-22-2004, 12:39 AM#9
ThyFlame
Actually its just greater than, since 0 is excluded. 21% chance to miss if its equal or greater than 80.
02-22-2004, 12:50 AM#10
xtacb
yea ok i did the greater or equal than part wrong but it turned out for the better at least for now because im testing the misses so i need it to miss more

so anyone know why its not casting when it misses? did i do any of the dummy projectile info wrong??
02-22-2004, 01:04 AM#11
ThyFlame
Unit - Order (Casting unit) to Stop
Unit - Create 1 projectile for (Owner of (Target unit of ability being cast)) at (Position of (Target unit of ability being cast)) facing Default building facing degrees
Set fake = (Last created unit)
Unit - Order (Casting unit) to Neutral Naga Sea Witch - Forked Lightning fake

Looks like you are trying to use the casting unit when you already stated the casting unit has stopped - no casting unit available.

Also, I don't seem to see you targeting the fake forked lightning at any units.
02-22-2004, 01:28 AM#12
xtacb
ok could someone help me and post the actions i need for the miss including how i should create and target the dummy

i was messing around with the actions and i think i made it even worse, my units would be attacking invisible units (more than one) when i only cast the spell once and the miss! text would stay on screen, also i still could not get the spell to show when it missed
02-22-2004, 02:11 AM#13
Pheonix-IV
Ability Miss
Events
Unit - A unit Begins casting an ability
Conditions
(Ability being cast) Equal to Forked Lightning
Actions
Set caster = (Casting unit)
Set target = (Target unit of ability being cast)
Set miss = (Random integer number between 1 and 100)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
miss Greater than 80
Then - Actions
Unit - Order caster to Stop
Unit - Create 1 projectile for (Owner of target) at (Position of target) facing Default building facing degrees
Set fake = (Last created unit)
Unit - Order caster to Neutral Naga Sea Witch - Forked Lightning fake
Wait - Wait 0.5 seconds
Unit - Remove fake from the game
Floating Text - Create floating text that reads MISS! above target with Z offset 10.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
Wait 0.50 seconds
Floating Text - Destroy (Last created floating text)
Else - Actions
02-22-2004, 02:35 AM#14
Pheonix-IV
you'd hafta be careful with that one tho, if the unit was victim of 2 spells at the same time it could cause some problems, also if the spell took longer than a second to reach the target it could cause some problems.
02-22-2004, 02:39 AM#15
Pheonix-IV
true, but you'd still get the multiple spell problem, i'm not saying yours isnt a viable method, but as with most triggers, when you simplfy it you get a few small bugs