Help with rules

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

Moderator: Support Team

Help with rules

Postby Kataract » Wed Nov 04, 2015 12:58 am

Hey,

I am trying to create a custom event. (CTF Like)

My question is : I created a CTF Manager. This manager is herited from normal server rules and overrides IsAllowedToAttack, IsInSameRealm etc.
But, when I am in the region of the CTF the custom rules are not applied.

How can I do to load my manager and make him change the IsAllowedAttack only in this region ?
I did many tests but my manager is never working
Thanks in advance :)
Pour aller de l'avant, il faut prendre du recul
Car prendre du recul, c'est prendre de l'élan
Kataract
Server Representative
 
Posts: 116
Joined: Fri Jul 22, 2011 6:01 pm

Re: Help with rules

Postby HunabKu » Wed Nov 04, 2015 9:54 am

[ScriptLoadedEvent]
public static void ScriptLoaded(DOLEvent e, object sender, EventArgs args)
{
LoadThisManager();
}
"C'est l'ignorance qui apporte le chaos, pas la connaissance."
Scarlett Johansson dans "Lucy" de Luc Besson
-------------------------------------------------------------------------------
"Ignorance brings chaos, not knowledge."
Scarlett Johansson on "Lucy" by Luc Besson
User avatar
HunabKu
Developer
 
Posts: 1905
Joined: Sat Jun 18, 2011 4:48 am

Re: Help with rules

Postby Leodagan » Mon Nov 09, 2015 10:07 pm

I don't think you can attach specific "ServerRules" to a given Region...

For Storm RvR Implementation I'm pretty sure there is a new "Super Class" For GameServer Rules, that rely on specific Region Check Code to call the right Rules Methods...

Something like "CustomServerRules" Inheriting Normal Rules, and in methods like IsAllowedToAttack you check region ID or Region "Type" to retrieve the according "Rules Object", and then call the "sub rules" methods instead of Normal Rules ones...

I can confirm that Storm Implement Region object Subclass that have a "Rules" Member attached...

so you can easily make some check like
Code: Select all
public bool IsAllowedToAttack(attacker, defender) { if (attacker.Region is "MyCustomRegion") return (("MyCustomRegion")attacker.Region).Rules.IsAllowedToAttack(attacker, defender); return base.IsAllowedToAttack(attacker, defender); }
Edit :

You can also easily subclass DataObject to implement your own table of Region that can use new columns like a specific rules set...

All this can be implemented as Game Server Scripts just like Storm does ;)
User avatar
Leodagan
Developer
 
Posts: 1350
Joined: Tue May 01, 2012 9:30 am
Website: https://daoc.freyad.net
Location: Lyon

Re: Help with rules

Postby Kataract » Tue Nov 10, 2015 9:49 am

Hello :)

I found the way of how to have custom rule IsAllowedAttack.
I created new server rules herited from AbstractServerRules and bound to GSR_Test
Pour aller de l'avant, il faut prendre du recul
Car prendre du recul, c'est prendre de l'élan
Kataract
Server Representative
 
Posts: 116
Joined: Fri Jul 22, 2011 6:01 pm


Return to “%s” Support

Who is online

Users browsing this forum: No registered users and 1 guest