Savage 2: A Tortured Soul Forum

Savage 2: A Tortured Soul Forum (http://forums.savage2.com/index.php)
-   Documentation (http://forums.savage2.com/forumdisplay.php?f=33)
-   -   AOE Spells via script (http://forums.savage2.com/showthread.php?t=29575)

Durwyn 05-04-2013 08:33 PM

AOE Spells via script
 
AOE Spells via script

AOE Spells like Spell_Eruption, so no "SnapCast" [You can't put a 'green' mark on your target]
don't trigger the "spellimpact" worldtrigger. At least, if used by players.

If you use the following script command:

CastSpell #index# Spell_Eruption, the "spellimpact" worldtrigger reacts.

Even more interesting, the spellimpact reacts for every target hit by the spell !
So if you use the spell on one enemy, every target within the defined TargetRadius value will trigger the worldtrigger.

Example with Spell_Eruption

In the "spellimpact" worldtrigger, you have to define how much HP the target loses.

----------------------------------------------
Spawn a fictive hitpoint (of YOUR team) at your target position. and cast the spell eruption on it. (chaplain.npc)

Quote:

Originally Posted by chaplain.npc
<?xml version="1.0" encoding="UTF-8"?>
<npc
type="Dummy"
scale="1.0"
width="1.0"
height="1.0"
maxhealth="50000"
speed="0"
minimapiconsize="0"
selectionradius="0"
>
</npc>

Quote:

Originally Posted by script
createvar int caster_team 2
SpawnEntityAtEntity #index_target# NPC_Critter definition human/units/chaplain/chaplain.npc team 2
set fake_hit #GetScriptParam(spawnedindex)#
set index_target #GetScriptParam(spawnedindex)#
CastSpell #index_target# Spell_Eruption

Add damage to the spell, and remove the fictive hitpoint.

Quote:

Originally Posted by spellimpact
@spell_eruption
if #EntityExists(|#fake_hit|#)# "RemoveEntity #fake_hit#"
if [caster_team == spell_team] "goto end"
DamageEntity #target_spell# 200
goto end

It will damage any target of team 1 in its radius. However, you can't stun the targets inside "spellimpact" worldtrigger because the game will crash (too many calls of Spellimpact probably).

So you have to modify the "TargetState" of Spell_Eruption and add "State_Stunned" with TargetStateDuration of "1750"

This works because:
Quote:

Set Spell_Eruption_TargetTeamAlly "false"
Set Spell_Eruption_TargetTeamEnemy "true"
So, Be sure these two settings are applied before trying your AOE.

rohezal 05-05-2013 09:53 AM

Thank you for sharing, this will make a lot of mini game coding more easy :)


All times are GMT. The time now is 04:04 AM.