forums | blogs | polls | tutorials | downloads | rules | help

Orb in DS2

HardLess's picture

Hi, I'm trying to tansform the power "Energy Orb" from the combat magic powers into a spell.
The main issus is that when I transform it as a spell, my character cast it but nothing happen.
I was wondering, if somebody had an idea.

This is the code from the power.

[t:template,n:energyorb_power] { doc = "Energy Orbs";

specializes = base_power;
[attack]
{
skill_class = "Combat Magic";
}
[gui]
{
active_icon = b_gui_ig_m_i_rendingaura-up;
mini_icon = b_gui_ig_m_chiclet-buff-up;
}
[magic]
{
cast_range = 10;
cast_sub_animation = 2;
is_one_shot = true;
can_autocast = true;
requires_line_of_sight = false;
use_intel_level = false;
speed_bias = 1;
target_type_flags = tt_self;
usage_context_flags = uc_offensive;
state_name = energyorb;
require_state_check = true;
}
[power_energyorb]
{
charge_ffx = "ffx_energyorb_charge";
cast_ffx = "ffx_energyorb_cast";
cast_efct = "efct_energyorb_cast";
projectile_1_ffx = "ffx_energyorb_projectile_1";
projectile_2_ffx = "ffx_energyorb_projectile_2";
projectile_3_ffx = "ffx_energyorb_projectile_3";
description = "Energy Orb";
}
}

PS: I'm french so my english can be missunderstood.

Thanks a lot.

My tankviewer is not functioning so I cannot easily check, but when converting some of my spells I had to create new ffx & efct files because the attach point for the spells were not correct (bip01 etc.).

I've already got an energy orb spell working in DS2 Adepts

Being based off a power the damage levels appear somewhat fixed and don't scale according to int like normal spells. This version is also autocasted which is quite handy.

[t:template,n:spell_ds1_energyorb]//new effect based on a power. damage values?
{
	category_name = "magic";
	doc = "base spell heal";
	specializes = base_spell_combat;

	[common]
	{
		screen_name = "Orb of Energy";
		description = "A glowing orb of energy hovers above the caster's body, shooting bursts of energy at nearby enemies.\n";
		
	}
	[gui]
	{
		active_icon = b_gui_ig_i_ic_sp_207;
		inventory_icon = b_gui_ig_i_ic_sp_207_inv;
		item_level = 24;	
	}
	[magic]
	{
		apply_enchantments = false;
		attack_damage_modifier_max	= ((2.09 + 1.04 * #clamped_intel) * 1.1) * (1 + (#Increased_Combat_Damage * .01)) * (1 + (#Increased_Fire_Damage * .01));
		attack_damage_modifier_min	= ((2.09 + 1.04 * #clamped_intel) * 0.9) * (1 + (#Increased_Combat_Damage * .01)) * (1 + (#Increased_Fire_Damage * .01));
		cast_range = 8;
		cast_reload_delay = 10.0;
		cast_sub_animation = 4;
		effect_duration = 1200 * (0.5 + 0.5 * ((#magic - 34) * 0.033)) * (1.0 + (#Increased_Defensive_Enhancement_Duration * .01));
		is_one_shot = true;
		can_autocast = true;
		mana_cost = 0;
		mana_cost_modifier = ((1.12 * #clamped_intel) - 2.0) * ((100 - #Decreased_Mana_Cost) * .01);	// 25 % mana
		required_level = 24;
		max_intel = 500;
		max_level = 64;
		requires_line_of_sight = false;
		use_intel_level = true;
		speed_bias = 1;
		target_type_flags = tt_self | tt_conscious_enemy | tt_unconscious_enemy | tt_breakable;
		usage_context_flags = uc_defensive;
		state_name = energyorb;
		require_state_check = true;
		is_buff = true;
	}
	[power_energyorb]
	{
		charge_ffx			= "ffx_energyorb_charge";
		cast_ffx			= "ffx_energyorb_cast";
		cast_efct			= "efct_energyorb_cast";
		projectile_1_ffx	= "ffx_energyorb_projectile_1";
		projectile_2_ffx	= "ffx_energyorb_projectile_2";
		projectile_3_ffx	= "ffx_energyorb_projectile_3";
		description			= "Energy Orb";	
	}
}

Incidentally the reason your version isn't working is probably because it specializes off a power instead of base_combat_magic. I've got several powers such as gathered bolt and chain lightning working as spells by specializing them as spells instead of powers. Using some power specific ffx in spells also works on occasion.

hmm have u tried changing the usage context flags in the [magic] component from uc_defensive to uc_offensive? that shud get the dmg to display correctly in the spell mouseover. not sure why u have it as a defensive usage context spell.

also, the target type flags are not correct. it shud be tt_self only which is what the orb spells use in both dsloa and ds2. allowing enemies and breakables as the target types means the orb can be casted on (NOT fired at) enemies and breakables and u end up using the spell against urself.

i believe what the orb can shoot at is controlled via the spell's power_energyorb skrit.

and one last thing. u shud specify a valid damage type for the spell using the damage_type parameter in the [magic] component. if u do not, it will default to doing melee dmg by default as specified in rules.skrit.

this is the energy orb damage type bug in ds2. i caught this bug while making my spells improvements and bugfixes mod for ds2 and bw.

u can test this bug out by fighting decaying vulks in the broken world map which are resistant to melee. u notice energy orb does reduced dmg against the vulks despite the vulks NOT having any power dmg resistance and when they are hit by the energy blast, they flash with a white shield indicating they resisted dmg from the attack.

since u appear to want the energy orb to do fire dmg from what u set in the spell's attack dmg modifier. i recommend putting damage_type = dmt_fire; as the dmg type for the spell.

HardLess's picture

Thanks you.

I'm on my way to try this.

Just another issue about the "DungeonSiege2mods" from the toolkit, do you know how to modify a 'party'.

Like adding a second character, I'm using the command "party add name.ds2party" but nothing happen and the error is "This save does not exist".
Because I want to create myself two characters and get them in the same team.
Is this possible because I did it on Dungeon Siege 1 but nothing to do in DS2.
Any idea.

My second issue is to modify savegame... The savegame is in hexa and I don't really know how to deal with this.

Thanks you again.

Lady Femme wrote:
hmm have u tried changing the usage context flags in the [magic] component from uc_defensive to uc_offensive? that shud get the dmg to display correctly in the spell mouseover. not sure why u have it as a defensive usage context spell.

also, the target type flags are not correct. it shud be tt_self only which is what the orb spells use in both dsloa and ds2. allowing enemies and breakables as the target types means the orb can be casted on (NOT fired at) enemies and breakables and u end up using the spell against urself.

i believe what the orb can shoot at is controlled via the spell's power_energyorb skrit.

and one last thing. u shud specify a valid damage type for the spell using the damage_type parameter in the [magic] component. if u do not, it will default to doing melee dmg by default as specified in rules.skrit.

this is the energy orb damage type bug in ds2. i caught this bug while making my spells improvements and bugfixes mod for ds2 and bw.

u can test this bug out by fighting decaying vulks in the broken world map which are resistant to melee. u notice energy orb does reduced dmg against the vulks despite the vulks NOT having any power dmg resistance and when they are hit by the energy blast, they flash with a white shield indicating they resisted dmg from the attack.

since u appear to want the energy orb to do fire dmg from what u set in the spell's attack dmg modifier. i recommend putting damage_type = dmt_fire; as the dmg type for the spell.

Thanks for the tips, I'll look into it eventually but at the moment I'm very busy in testing DS2 Adepts.

It's been a while since I looked at the code (originally released as a test version with a whole heap of other spells about a year ago) but I remember I had a lot of problems getting it to even appear. I think using it as an offensive spell just didn't work but I can't be sure.

When the next DS2 Adepts alpha is released you're assured of having a lot of fun looking at all the new spells. Many of them have issues similar to this one. Some I got working (like the mage energy spell from Broken World) but they actually killed your party members rather than the monsters! I hope to have the next alpha ready by the end of this month.

I actually haven't heard of your s[ells improvement and bugfixes mod before, sounds very interesting.

HardLess's picture

code wrote:

[t:template,n:spell_ds1_energyorb]//new effect based on a power. damage values?

{
category_name = "magic";
doc = "base spell heal";
specializes = base_spell_nature;

[common]
{
screen_name = "Orb of Energy";
description = "A glowing orb of energy hovers above the caster's body, shooting bursts of energy at nearby enemies.\n";

}
[gui]
{
active_icon = b_gui_ig_i_ic_sp_207;
inventory_icon = b_gui_ig_i_ic_sp_207_inv;
item_level = 3;
}
[magic]
{
apply_enchantments = false;
attack_damage_modifier_max = ((2.09 + 1.04 * #clamped_intel) * 1.1) * (1 + (#Increased_Nature_Damage * .01)) * (1 + (#Increased_Ice_Damage * .01));
attack_damage_modifier_min = ((2.09 + 1.04 * #clamped_intel) * 0.9) * (1 + (#Increased_Nature_Damage * .01)) * (1 + (#Increased_Ice_Damage * .01));
cast_range = 8;
cast_reload_delay = 10.0;
cast_sub_animation = 4;
effect_duration = 1200 * (0.5 + 0.5 * ((#magic - 34) * 0.033)) * (1.0 + (#Increased_Defensive_Enhancement_Duration * .01));
is_one_shot = true;
can_autocast = true;
mana_cost = 0;
mana_cost_modifier = ((1.12 * #clamped_intel) - 2.0) * ((100 - #Decreased_Mana_Cost) * .01); // 25 % mana
required_level = 3;
max_intel = 500;
max_level = 64;
requires_line_of_sight = false;
use_intel_level = true;
speed_bias = 1;
damage_type = dmt_ice;
target_type_flags = tt_self;
usage_context_flags = uc_offensive;
state_name = energyorb;
require_state_check = true;
is_buff = true;
}
[power_energyorb]
{
charge_ffx = "ffx_energyorb_charge";
cast_ffx = "ffx_energyorb_cast";
cast_efct = "efct_energyorb_cast";
projectile_1_ffx = "ffx_energyorb_projectile_1";
projectile_2_ffx = "ffx_energyorb_projectile_2";
projectile_3_ffx = "ffx_energyorb_projectile_3";
description = "Energy Orb";
}
}

So offensive don't work, it makes the power to cast on enemies.

So when it's defensive, again i can cast the spell but nothing happen.
I was wondering if the issue is created because of the skirt of the energy orb.
Because the skirt is about "energy orb" as a power and not as a spell.
I'm trying to put the skirt of the orbs from DS1 in DS2 but I don't think that could work.

See you. I continue testing.

PhoeniX, iryan and Lady_Femme are all correct in what they have said, so wont repeat any of their words.

but here is my 2 cents anyways....
the reason it don't work is cause of efct_energyorb.gas, the power err spell is needing a power_level, to be honest u will need to recode the efct_energyorb_cast make property float power_level$ = 1.0 for a basic level 1 energy orb.... or could also recode power_energyorb.skrit
add property float power_level$; near top to it that way can have it with 1 - 3 in the spell code.

example spell_energyorb.skrit untested

//////////////////////////////////////////////////////////////////////////////
//
// File:		spell_energyorb.skrit
// Author(s):	Dark_Elf
//
// Copyright © 2013 Dark_Elf  All rights reserved.
//----------------------------------------------------------------------------
//////////////////////////////////////////////////////////////////////////////

property bool _server_only$	= false;
property string charge_ffx$			= ""					doc = "Charge Flick  name.";
property string cast_ffx$			= ""					doc = "Cast Flick name";
property string cast_efct$			= ""					doc = "Cast Effect name, bound in at flick launch with power level.";
property string projectile_1_ffx$	= ""					doc = "Projectile Flick name at power level 1";
property string projectile_2_ffx$	= ""					doc = "Projectile Flick name at power level 2";
property string projectile_3_ffx$	= ""					doc = "Projectile Flick name at power level 3";
property float  rate_of_fire$		= 1.5					doc = "Rate of fire of our turreted fire";
property string description$		= ""					doc = "Power decription and generic state string applied to actor, set in power component template for localization";
property float power_level$;= ""					doc = "power level of the orb";
property float power_duration$;= ""					doc = "duration of the orb";
property float dmg_min$; = ""					doc = "minimum damage of the orb";
property float dmg_max$; = ""					doc = "maximum damage of the orb";

owner = GoSkritComponent;

#include "k_inc_spl_utils"

Goid catalyst$;
bool is_active$ = false;
string telegraphefct$ = "efct_energyorb_telegraph";
string telegraphffx$ = "ffx_efct_emitter";
FFXID orb_effect$;
FFXID ffxchargingID$;

startup state Begin$
{
	transition->Cleanup$: OnTimer(3);
	transition->Cleanup$: OnGoHandleCCMessage(WE_KILLED);
	transition->Cleanup$: OnGoHandleMessage(WE_REQ_DELETE);

	event OnGoHandleMessage$( eWorldEvent e$, WorldMessage msg$ )
	{
		if( e$ == WE_REQ_ACTIVATE )
		{
			goid target$ = MakeGoid( msg$.GetData1() );

			if( ValidateTarget$( target$, description$ ) )
			{
				// Do damage
				Rules.DamageGoPower( "magic", catalyst$, owner.goid, target$, Math.RandomFloat(dmg_min$, dmg_max$) );
			}
			
			return;
		}
		else if( e$ == WE_REQ_CAST_CHARGE )		
		{
			report.reportf("orbs", "Charge trigger\n");
			if(!StringTool.IsEmpty(charge_ffx$))
			{
				catalyst$ = msg$.GetSendFrom();

				// Use single validate
				if(	ValidateTargetAndCaster$( catalyst$, catalyst$, description$, owner.goid) && ( Owner.go.Parent != NULL ) )
				{
					WorldFXMgr.CreateFlickFX( charge_ffx$, owner.goid, catalyst$, true, true );
				}	
			}
			return;
		}
		else if( e$ == WE_REQ_CAST )
		{
			report.reportf("orbs", "Cast trigger\n");
			if ( !GoDb.IsBeingWatchedBy( owner.Goid, catalyst$ ) )
			{	
				GoDb.StartWatching( owner.Goid, catalyst$ );
			}
			
			if(	ValidateTargetAndCaster$( catalyst$, catalyst$, description$, owner.goid) && ( Owner.go.Parent != NULL ))
			{
				// Add state name to target
				if( IsServerLocal )
				{
					catalyst$.Go.actor.SAddGenericState( owner.Go.Magic.StateName, description$, power_duration$, catalyst$, owner.goid, 1 );
				}
				if(!StringTool.IsEmpty(cast_ffx$))
				{
					string params$;
					StringTool.Assignf(params$, "ffx_efct_emitter?EmitterEffect=\"efct_rotating_orb?power_level=%f\"", power_level$);
					orb_effect$ = WorldFXMgr.CreateFlickFX( params$, owner.Goid, catalyst$, true, true );
				}

				string tempstring$;
				StringTool.Assignf( tempstring$, "%s?EmitterEffect=\"%s?chargetime=%f\"", telegraphffx$, telegraphefct$, 0.5 );
				ffxchargingID$ = WorldFXMgr.CreateFlickFX( tempstring$, owner.Goid, catalyst$, true, true );
				StringTool.Appendf( telegraphffx$, "?EmitterEffect=\"%s?chargetime=%f\"", telegraphefct$, rate_of_fire$ );
				this.CreateTimer( 1, 0.5 );
			}

			is_active$ = true;
			this.CreateTimer( 2, power_duration$ );
		}
	}

	trigger OnTimer$( 1 )
	{
		report.reportf("orbs", "timer 1\n");
		if( is_active$ )
		{
			report.reportf("orbs", "timer 1 --->is active\n");
			if (IsAlive(catalyst$.Go.GetLifeState()))
			{
				WorldFXMgr.FinishFlickFX( ffxchargingID$ );
				ffxchargingID$ = 0;

				go target$ = catalyst$.go.mind.GetClosestVisibleEnemy( true );

				if( target$ == NULL ) 
				{
					target$ = catalyst$.go.mind.GetClosestVisible( QT_BREAKABLE );
					if (target$ != NULL)
					{
						if (target$.IsActor())
						{
							// This is an NPC lets not target this guy
							target$ = NULL;
						}
					}
				}

				if(	(target$ != NULL) && ValidateTarget$( target$.goid, description$) )
				{
					if(!StringTool.IsEmpty(projectile_3_ffx$))
					{
						WorldFXMgr.CreateFlickFX( projectile_3_ffx$, owner.goid, catalyst$, target$.goid, false, true );
					}
				}	

				this.CreateTimer( 1, rate_of_fire$ );
				
				//Start charging the effect for the next attck
				ffxchargingID$ = WorldFXMgr.CreateFlickFX( telegraphffx$, owner.Goid, catalyst$, true, true );
			} 
			else
			{
				is_active$ = false;
				SetState Cleanup$;
			}

		}
	}

	trigger OnTimer$( 2 )
	{
		report.reportf("orbs", "timer 2\n");
		is_active$ = false;
		if (orb_effect$ != 0 )
		{
			WorldFXMgr.FinishFlickFX(orb_effect$);
			orb_effect$ = 0;
		}
		if (ffxchargingID$ != 0 )
		{
			WorldFXMgr.FinishFlickFX(ffxchargingID$);
			ffxchargingID$ = 0;
		}
		this.CreateTimer( 3, 3.0 );	// 3 second delay to let the last projectile do it's business.
	}
}

state Cleanup$
{
	event OnEnterState$
	{
		report.reportf("orbs", "test123\n");
		if( catalyst$.IsValid )
		{
			if( Godb.IsBeingWatchedBy( owner.goid, catalyst$ ) )
			{
				Godb.StopWatching( owner.goid, catalyst$ );
			}
		}

		if (orb_effect$ != 0 )
		{
			WorldFXMgr.FinishFlickFX(orb_effect$);
			orb_effect$ = 0;
		}
		if (ffxchargingID$ != 0 )
		{
			WorldFXMgr.FinishFlickFX(ffxchargingID$);
			ffxchargingID$ = 0;
		}
		if( IsServerLocal )
		{
			GoDb.SMarkForDeletion( owner.goid );
		}
	}
}

example spell code untested

[t:template,n:spell_ds1_energyorb]//new effect based on a power. damage values?
{
category_name = "magic";
doc = "base spell energyorb";
specializes = base_spell_nature;

[common]
{
screen_name = "Orb of Energy";
description = "A glowing orb of energy hovers above the caster's body, shooting bursts of energy at nearby enemies.\n";

}
[gui]
{
active_icon = b_gui_ig_i_ic_sp_207;
inventory_icon = b_gui_ig_i_ic_sp_207_inv;
item_level = 3; 
}
[magic]
{
apply_enchantments = false;
attack_damage_modifier_max = ((2.09 + 1.04 * #clamped_intel) * 1.1) * (1 + (#Increased_Nature_Damage * .01)) * (1 + (#Increased_Ice_Damage * .01));
attack_damage_modifier_min = ((2.09 + 1.04 * #clamped_intel) * 0.9) * (1 + (#Increased_Nature_Damage * .01)) * (1 + (#Increased_Ice_Damage * .01));
cast_range = 8;
cast_reload_delay = 10.0;
cast_sub_animation = 4;
effect_duration = 1200 * (0.5 + 0.5 * ((#magic - 34) * 0.033)) * (1.0 + (#Increased_Defensive_Enhancement_Duration * .01));
is_one_shot = true;
can_autocast = true;
mana_cost = 0;
mana_cost_modifier = ((1.12 * #clamped_intel) - 2.0) * ((100 - #Decreased_Mana_Cost) * .01); // 25 % mana
required_level = 3;
max_intel = 500;
max_level = 100;
requires_line_of_sight = false;
use_intel_level = true;
speed_bias = 1;
damage_type = dmt_ice;
target_type_flags = tt_self;
usage_context_flags = uc_offensive;
state_name = energyorb;
require_state_check = true;
is_buff = true;
}
[spell_energyorb]
{
charge_ffx = "ffx_energyorb_charge";
cast_ffx = "ffx_energyorb_cast";
cast_efct = "efct_energyorb_cast";
projectile_1_ffx = "ffx_energyorb_projectile_1";
projectile_2_ffx = "ffx_energyorb_projectile_2";
projectile_3_ffx = "ffx_energyorb_projectile_3";
description = "Energy Orb";
power_level = 1;
power_duration = 1200 * (0.5 + 0.5 * ((#magic - 34) * 0.033)) * (1.0 + (#Increased_Defensive_Enhancement_Duration * .01));				
dmg_min = ((2.09 + 1.04 * #clamped_intel) * 0.9) * (1 + (#Increased_Nature_Damage * .01)) * (1 + (#Increased_Ice_Damage * .01));
dmg_max = ((2.09 + 1.04 * #clamped_intel) * 1.1) * (1 + (#Increased_Nature_Damage * .01)) * (1 + (#Increased_Ice_Damage * .01));
}
}

i didnt know u cud use global # values as parameters/variables for passing into skrit. wonder if that actually works. if it does, it might open a lot of possibilities for highly scalable spells... :mrgreen:

HardLess wrote:

So offensive don't work, it makes the power to cast on enemies.

So when it's defensive, again i can cast the spell but nothing happen.
I was wondering if the issue is created because of the skirt of the energy orb.
Because the skirt is about "energy orb" as a power and not as a spell.
I'm trying to put the skirt of the orbs from DS1 in DS2 but I don't think that could work.

See you. I continue testing.

I don't think an offensive spell would work with tt_self. Have you tried the version I posted? It at least works and would give a good starting point to get working correctly.

HardLess's picture

So the skirt works but there is a problem that I correct on the spell.

code wrote:

[spell_energyorb]

{
charge_ffx = "ffx_energyorb_charge";
cast_ffx = "ffx_energyorb_cast";
cast_efct = "efct_energyorb_cast";
projectile_1_ffx = "ffx_energyorb_projectile_1";
projectile_2_ffx = "ffx_energyorb_projectile_2";
projectile_3_ffx = "ffx_energyorb_projectile_3";
description = "Energy Orb";
power_level = 1;
power_duration = 1200 + # clamped_intel;
dmg_min = 20 + #clamped_intel;
dmg_max = 30 + #clamped_intel;
}

The issus was about dmg_min and dmg_max. The skirt seems to read only the figures and a bracket is causing a error.

So now the spell works, but the orb is static and I'm trying to make it orbiting arround the character like skulls of the spell "Mana Strike".

Thanks for your help and if somebody have an idea how to modify savegame or at least how to import a party with the "Dungeon siege 2 mod" Of the toolkit, it's would be great.

So thanks again and I'll post a feedback about the orb's orbiting.

EDIT: The skulls of the Mana Stike spell don't orbit arround the character but it appears to be just an effect.

HardLess wrote:
So the skirt works but there is a problem that I correct on the spell.

code wrote:

[spell_energyorb]

{
charge_ffx = "ffx_energyorb_charge";
cast_ffx = "ffx_energyorb_cast";
cast_efct = "efct_energyorb_cast";
projectile_1_ffx = "ffx_energyorb_projectile_1";
projectile_2_ffx = "ffx_energyorb_projectile_2";
projectile_3_ffx = "ffx_energyorb_projectile_3";
description = "Energy Orb";
power_level = 1;
power_duration = 1200 + # clamped_intel;
dmg_min = 20 + #clamped_intel;
dmg_max = 30 + #clamped_intel;
}

The issus was about dmg_min and dmg_max. The skirt seems to read only the figures and a bracket is causing a error.

So now the spell works, but the orb is static and I'm trying to make it orbiting arround the character like skulls of the spell "Mana Strike".

Thanks for your help and if somebody have an idea how to modify savegame or at least how to import a party with the "Dungeon siege 2 mod" Of the toolkit, it's would be great.

So thanks again and I'll post a feedback about the orb's orbiting.

EDIT: The skulls of the Mana Stike spell don't orbit arround the character but it appears to be just an effect.

I took out some code from the skrit that needs to be put back in, namely the power_duration
dmg_min and dmg_max stuff.
you are correct about the brackets that was just some cut and paste code, and only the 1200, 20, and 30 should work as it needs a number.
as for the mana strike I have never seen that spell so cant say what u can do to make it work, but whatever effect it uses can replace charge_ffx if need be or even added to your effects if u edit them... have fun with your spell.