• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] Protection Field

Status
Not open for further replies.
Level 28
Joined
Feb 18, 2014
Messages
3,580
Can someone guide me on how to make this spell work :
I'd like to create a circle (field) arround the caster with a specified range that prevent enemy target from entering that field or casting spells over the units arround the field but it still can take damage and be destroyed.
The field model I'm using is this http://www.hiveworkshop.com/forums/...-colour-262815/?prev=search=field&d=list&r=20

Any help will be appreciated :)
 
Level 17
Joined
Mar 21, 2011
Messages
1,597
You can interrupt target orders by ordering the units to stop on cast. You just need to check if the target is inside the field.
For the other part: just check periodically if enemy units are in range, if so, push them back. if the timer window is small enough it looks like they are moving against a wall
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
For that damage part, do you want the field to kind of absorb all damage taken by units inside and not being targetable itself, or do you want the units inside being completely non-targetable, while the shield being a dummy that is targetable and can take damage itself?

I would suggest to use a damage detection system anyway so that you can prevent damage for example.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
the problem I see here is, that there can be enemies inside the field.
I wanted to suggest that you add locust to units inside the field (to remove, hide units then remove locust and unhide them again) ...
But then enemy units would be unable to attack each other as well, unless you push enemies out of the sphere upon casting.

For the shield itself, I would just use a flying unit that is set to the casters position by a timer. The same timer could be used to do what GIMLI_2 suggested
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
But then enemy units would be unable to attack each other as well, unless you push enemies out of the sphere upon casting.
Yes, that's the point, I want just from the moment the caster activate the shield the enemy units are pushed back which mean the field range begin from 0 to 300 range that give enough space inside the field for ally units.
Notice : Allies unit are not pushed back once the field reach them.
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
Yes, that's the point, I want just from the moment the caster activate the shield the enemy units are pushed back which mean the field range begin from 0 to 300 range that give enough space inside the field for ally units.
Notice : Allies unit are not pushed back once the field reach them.

The problem here would be that only units initially in range of the caster would be affected if you follow the idea below. To make it perfect you would need some dynamic indexing to register new allies entering the sphere while the spell is active, so u can handle all allies dynamically. PurgeAndFire made an excellent tutorial about this: Dynamic Index

Also, you have to decide how the units inside sphere would behave. Do you want them to be pushed by sphere, once the caster moves for example?

For the enemies, you just have to push back enemies (check whether the unis is owned by an ally of caster) upon casting using a timer, which starts at the point of casting, in the direction of (angle of these units towards caster - 180°) until they are 300.00 away. Give locust to all allies and/or caster, which will be removed after the spell is over and save these units or their handle Ids to a variable array. You should also check periodically, whether a unit in the allied untis array is out of range and set its position back inside the sphere (which would be a pushing effect). This would push back your allies if they target an enemy and want to leave the sphere.

For the periodic pushback of enemies:
a) use the above mentioned timer (as Gimmli suggested) to push back any enemies in range of 300,00 of the sphere
or b) create the sphere at map init and save it to a variable and also create a boolean which will be set to true upon casting. Then make a trigger with the event "unit comes in range of 300.00 your sphere variable". Set back this unit, if it is enemy of the sphere and if this boolean is set to true (which you have to set to false once the spell is over). Once the sphere dies, instantly revive it. If the sphere died or the spell is over, set the sphere to a save location on the map.

In all cases just reset everything once the time is over or the sphere dies. You can decide whether to create a new sphere everytime or to use the same one, which is instantly revived and moved away upon death.

this would be my thoughts about your spell concept...
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
Many thanks for the effort man, much appreciated :)
I'll be taking ur suggestions under consideration.
Also, you have to decide how the units inside sphere would behave. Do you want them to be pushed by sphere, once the caster moves for example?

Yup! That will be good. But the sphere doesn't move from his casting location, only the caster and his allies could move inside it without targeting enemy units outside the sphere.(Including casting spells outside as Curse ability, Slow ability or Auto-Cast ability...)
 
Level 10
Joined
May 21, 2006
Messages
323
I would conclude all enemies who come in range of the center of the point into a unit group and push them in an angle from their position and the center of the shield to the outside again excluding them again from the unit group.
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
Thanks guys :)

But nevermind what I've said about pushing, I had a better idea!

I'll make this spell based on Mana Shield Ability which means can be activated and disactivated, but it still a field tho which mean not protect only the caster. The point of this field is to contain allies units including the caster and prevent them from taking damage or negative spells in a certain distance. As for the pushing we can remove that since it will look weird how enemy target are pushed back while allies units ain't, so it's okay to have enemy target inside the field you can contain them BUT what if they are out number, that won't be in your advantage it's like you made a trap for yourself.

So, this idea should work :
  • I can make allies regenerate 4 health point per seconds. Those regenerated health points are given by the field which means as I said above (Mana shield), everytime a unit regenerate 4 points that drain 4 points of mana owned by the caster
  • Everytime the field is under attack, the damage aboserbed are taken by the current mana of the caster, if his mana get 0 the field will be destroyed.
  • To have more advantage for ally units inside the field I can make contained enemy units taking 4 damage per second

And that should work proprely.
 
Status
Not open for further replies.
Top