How do I override CanCastInCombat from a custom script?

For any problems with Dawn of Light website or game server, please direct questions and problems here.

Moderator: Support Team

How do I override CanCastInCombat from a custom script?

Postby Kazo » Thu May 19, 2016 1:26 pm

I would like to override CanCastInCombat so that an additional class can cast a some spells in combat. From what I read researching this, it should be possible to override functions in the core with custom scripts, but I was never able to find an example of how to do it.
Kazo
DOL Novice
 
Posts: 52
Joined: Tue Jun 30, 2009 2:47 am

Re: How do I override CanCastInCombat from a custom script?

Postby Leodagan » Fri May 20, 2016 7:49 am

With Current Implementation of CanCastInCombat you don't have much choice...

Either you implement a subclass of the GamePlayer Class with the method CanCastInCombat() overridden with your own checks...

Or you need to override your SpellHandler method CheckBeginCast() to add specific checks for in Combat case (you may have to completely copy/paste the method from SpellHandler to edit this part only... depends on the Spell you're trying to implement...)

If you want to use cast in combat behavior easily on any spell type you'll have to create a new GamePlayer subclass and register it as a default class to handle in-game player...

You can't directly subclass base SpellHandler in GameServerScript and force other spells to rely on your implementation rather than core one because they are already hardcoded to subclass core SpellHandler on build time...

With GSS only you can create a new GamePlayer implementation or override Spell Types but only one by one...
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon


Return to “%s” Support

Who is online

Users browsing this forum: Bing [Bot] and 1 guest