Go Back   Savage 2: A Tortured Soul Forum > Savage 2 Modding > Documentation


Documentation Post useful tutorials and other informative material.

Thread Tools Display Modes
Old 05-04-2013, 08:33 PM   #1

Join Date: Jul 2011
Location: Belgium
Posts: 264
Thanks: 47
Thanked 67 Times in 54 Posts
Default 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)

Originally Posted by chaplain.npc
<?xml version="1.0" encoding="UTF-8"?>
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.

Originally Posted by spellimpact
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:
Set Spell_Eruption_TargetTeamAlly "false"
Set Spell_Eruption_TargetTeamEnemy "true"
So, Be sure these two settings are applied before trying your AOE.
Operating System: Windows 7 x64
Graphic card : Geforce GT 540M
RAM : 8gb

Last edited by Durwyn; 05-04-2013 at 08:51 PM.
Durwyn is offline   Reply With Quote
The Following 4 Users Say Thank You to Durwyn For This Useful Post:
meankitty2 (05-04-2013), PetzI (01-14-2014), rohezal (05-05-2013), SonOfAthena (05-06-2013)
Old 05-05-2013, 09:53 AM   #2

rohezal's Avatar
Join Date: Mar 2008
Posts: 2,610
Thanks: 112
Thanked 136 Times in 106 Posts

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


I love VOIP
sing: "base, base, base, base, base, base, base"

Why only 15 year old girls? Since 4 Years, damn I'm doing something wrong...

One day I will find out who is responsible for the K2 scripting "language" and the modding "support". And then...

rohezal is offline   Reply With Quote

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

All times are GMT. The time now is 06:54 PM.