How to add spell effect for styles:

Discussions on various DOL development features

Moderator: Support Team

How to add spell effect for styles:

Postby Phoenix » Tue Nov 09, 2004 4:50 pm

Well i would like to add a spell effect with duration fro each styles:

We have some special effect for styles:

Stunned

Target is unable to attack or do movement.

Bleeding

target lost each interval some HP

Slowed

Target got a new maxpseed value during duration

I have scan the style processor and found an effect Taunt:


if (attackData.Style.SpecialType == Style.eSpecialType.Taunt
&& attackData.Target is GameNPC
&& attackData.Style.SpecialValue != 0)
{
// god knows about value, suppose it's same as end usage - 100% at 4.0spd
((GameNPC)attackData.Target).AddToAggroList(player, attackData.Style.SpecialValue*(int)player.AttackSpeed(weapon)/40);
}

is anyone can code the belleding effect base?based on dotspell(damamange over the time) and try to code the effect in the style processor?

If anyone can do that i will code stun/lowered one :)
User avatar
Phoenix
DOL Experienced
 
Posts: 188
Joined: Wed Feb 18, 2004 4:05 pm
Location: Belgium

Postby Phoenix » Tue Nov 09, 2004 7:41 pm

here is a code in the styleprocessor.cs i have add, all work but i have a problem:

[C# Error] StyleProcessor.cs(357): Cannot convert type 'int' to 'DOL.GS.GamePlayer'

In this line : ((GamePlayer)attackData.Target).DealDamage((GamePlayer)attackData.Damage) = true;

This style is a bleeding effect, i want to deal a value(unstyled damage) to the target for 5 seconds, then i want to mremove the bleeding effect.




if (attackData.Style.SpecialType == Style.eSpecialType.Bleeding
&& attackData.Style.SpecialValue != 0)
{

if (attackData.Target is GamePlayer)
{


((GamePlayer)attackData.Target).DealDamage((GamePlayer)attackData.Damage) = true;
long secondsleft = 5 - (GameTimer.CurrentTick )/10;
if (secondsleft == 0)
{
((GamePlayer)attackData.Target).DealDamage((GamePlayer)attackData.Damage) = false;
}
}
if (attackData.Target is GameNPC)
{


((GameNPC)attackData.Target).DealDamage((GamePlayer)attackData.Damage) = true;
long secondsleft = 5 - (GameTimer.CurrentTick )/10;
if (secondsleft == 0)
{
((GameNPC)attackData.Target).DealDamage((GamePlayer)attackData.Damage) =false;
}

// god knows about value, suppose it's same as end usage - 100% at 4.0spd
}

}


Is anyone can help me?
User avatar
Phoenix
DOL Experienced
 
Posts: 188
Joined: Wed Feb 18, 2004 4:05 pm
Location: Belgium

Postby Etaew » Tue Nov 09, 2004 9:35 pm

attackData.Damage might not need (GamePlayer) in front of it as it seems it is an int..
Retired DOL Enthusiast | Blog
User avatar
Etaew
Inactive Staff Member
 
Posts: 7602
Joined: Mon Oct 13, 2003 5:04 pm
Website: http://etaew.net
Location: England

Postby Etaew » Tue Nov 09, 2004 9:35 pm

fun a double post..
Last edited by Etaew on Tue Nov 09, 2004 9:58 pm, edited 1 time in total.
Retired DOL Enthusiast | Blog
User avatar
Etaew
Inactive Staff Member
 
Posts: 7602
Joined: Mon Oct 13, 2003 5:04 pm
Website: http://etaew.net
Location: England

Postby Phoenix » Wed Nov 10, 2004 12:34 am

Here is the two cs files required to test my little effect.
The problem is i don't know how to implement a timer to set duration of effect to a value.
Yes i know it seems to be easy but i am really stuck and i got headache.

Is any one can help me?

Search for stunned / bleeding / lowered in case you want to correct in styleprocess.cs
Attachments
bureau.zip
(6.55 KiB) Downloaded 28 times
User avatar
Phoenix
DOL Experienced
 
Posts: 188
Joined: Wed Feb 18, 2004 4:05 pm
Location: Belgium

Postby Blue » Wed Nov 10, 2004 9:26 am

Its wrong to hardcode special effects for styles. Its not the right way as it should be. The styleprocessor must be kept free of special effect executions.
ex DOL Lead Developer
Blue
Uthgard Admin
 
Posts: 961
Joined: Wed Jan 21, 2004 11:07 pm
ICQ: 63977313

Postby Gandulf » Thu Dec 09, 2004 4:24 pm

Anybody working on this?

The simplies way to do it will probably be to add a spellId to the style that gets executed if style is successfly used, and the specific style effects like bleeding etc are implemented as spells ....?

I just overlooked the code and don'T know if this is actually possible, but it seems reasonable for me.
User avatar
Gandulf
Inactive Staff Member
 
Posts: 183
Joined: Sun Nov 07, 2004 8:36 am
Location: austria

Postby Gandulf » Thu Dec 09, 2004 5:25 pm

Ok as prove of concept heres the code to actualy use a spell as styleeffect.
Code: Select all
public static void ExecuteStyleEffect(GamePlayer player, AttackData attackData, InventoryItem weapon)
{
// styleEffectId = attackData.Style.StyleEffectId
// styleEffectLine = attackData.Style.StyleEffectLine
int styleEffectId = 87;
String styleEffectLine = "Calefaction";

Spell styleSpell = null;
SpellLine styleLine = SkillBase.GetSpellLine(styleEffectLine);

IList spells = SkillBase.GetSpellList(styleLine.KeyName);
foreach (Spell spell in spells)
{
if (spell.ID == styleEffectId)
{
styleSpell = spell;
break;
}
}
ISpellHandler spellhandler = ScriptMgr.CreateSpellHandler(player, styleSpell, styleLine);
if (spellhandler != null)
{
// insta cast no queue and no callback
spellhandler.CastSpell();
}
}

Oh and don't forget to call ExecuteStyleEffect in ExecuteStyle if style is successful.
Code: Select all
string damageAmount = (attackData.StyleDamage > 0) ? " (+"+attackData.StyleDamage+")" : "";
player.Out.SendMessage("You perform your " + attackData.Style.Name + " perfectly!"+damageAmount, eChatType.CT_YouHit, eChatLoc.CL_SystemWindow);

// execute effect of style if present
if (attackData.Style.StyleEffectId>=0)
ExecuteStyleEffect(player,attackData,weapon);

Al that's needed to make them work should be define spellines for the styleeffects and also additional spells(syleeffects) since we can't use the existing one, they need power to cast which fighters don't have.
User avatar
Gandulf
Inactive Staff Member
 
Posts: 183
Joined: Sun Nov 07, 2004 8:36 am
Location: austria

Postby nor » Fri Dec 10, 2004 7:13 am

Code: Select all
ISpellHandler spellhandler = ScriptMgr.CreateSpellHandler(player, styleSpell, styleLine);
if (spellhandler != null)
{
// insta cast no queue and no callback
spellhandler.CastSpell();
}
}

StartSpell should be used here. It was done especially for thing that don't use power/endurance and don't print "you cast the spell" (like styles, poisons and procs).
nor
Inactive Staff Member
 
Posts: 1584
Joined: Wed Mar 03, 2004 3:56 am

Postby Blue » Fri Dec 10, 2004 10:38 am

We were not consequent in doing StartSpell. It often uses mana. I think it was not preventable. Perhaps we should change Mana property so that nothing is reduced on no-mana-having classes. Must think about.
ex DOL Lead Developer
Blue
Uthgard Admin
 
Posts: 961
Joined: Wed Jan 21, 2004 11:07 pm
ICQ: 63977313

Postby Gandulf » Fri Dec 10, 2004 11:10 am

Yea I already tested it with Startspell and some deal damage on target spell and it realy works fine, i tested it with a dealdamge on target spell and it real looks cool.


Another idea i had while running around and killing mobs with my magic style effected sword:

We could even implement additional effects on items not only styles.

All we would have to do is add an additional spellid to inventoryitem and check fpr this is an attack with the given item is done and then use the item.

This can be done for offensice items (weapons) or defensive items.

Think of a magic helmet that cast heal on player whenever player gets hit on head :)
User avatar
Gandulf
Inactive Staff Member
 
Posts: 183
Joined: Sun Nov 07, 2004 8:36 am
Location: austria

Postby deagol » Fri Dec 10, 2004 4:01 pm

I'm workin' on it actually... As I have some results I'll post it here.

<edit> :eek: I don't know what I've read :D I'm working not on style effects but on active and reactive proc of items </edit>
Last edited by deagol on Fri Dec 10, 2004 6:08 pm, edited 1 time in total.
User avatar
deagol
DOL Acolyte
 
Posts: 104
Joined: Thu Oct 14, 2004 12:10 am


Return to “%s” DOL Development Discussion

Who is online

Users browsing this forum: No registered users and 0 guests