Welcome to the Builder Academy

Question Event Based Regeneration

More
21 May 2017 07:24 #6759 by WhiskyTest
Hello all

I've made a patch for event based point regeneration. It's based off Eric Green's original Circlemud one here:
www.circlemud.org/pub/CircleMUD/contrib/...s/utils/regen.README

What it does:
Changes Hitpoint, Mana and Move regeneration from happening once every 60 seconds to happening in real time.
For example if someone normally gains 60 hitpoints every tick, they will now receive 1 hitpoint every second.
This re-write makes use of Vatiken's Mud Events, which is awesome and you should definitely be using this all the time.

Once installed the key thing to remember is to use these new functions when making changes to hitpoints/mana/move:
alter_hit(ch, amount);
alter_move(ch, amount);
alter_mana(ch, amount);
"Amount" will be deducted from the characters points. For healing you send a negative amount.

Attachment EventRegeneration.zip not found

Attachments:

Please Log in or Create an account to join the conversation.

More
25 Nov 2017 23:48 - 26 Nov 2017 01:15 #7158 by WhiskyTest
Replied by WhiskyTest on topic Event Based Regeneration

Attachment event-regen_2017-11-26.zip not found

The originally submitted snippet has been crashing due to bugs which I am unable to figure out - for now.

So, I have attached a tested and working alternative, which is Eric Green's original snippet updated for use with tbaMUD (there was in fact very little to update!).

When I finally do figure out how to integrate this into mud_events I will update this post.
Attachments:
Last edit: 26 Nov 2017 01:15 by WhiskyTest. Reason: Added MSDP handling into patch file

Please Log in or Create an account to join the conversation.

More
14 Dec 2017 23:52 - 14 Dec 2017 23:52 #7252 by Sascha
Replied by Sascha on topic Event Based Regeneration
I have this in and running over at After the Breaking as of today. It compiled and seems to be working.

I did receive the following warning, though, in relation to the new regen.c file:

regen.c: In function 'points_event':
regen.c:90:8: warning: format not a string literal and no format arguments [-Wformat-security]
log(logbuf);


This is outside my wheelhouse, so if you have any feedback on that - or if I'm the first to report it and you plan to work on it - I'm all ears!

Will you stand against the coming Storm? After the Breaking: STORMRIDERS MUD - atbmud.dune.net port 4000
Last edit: 14 Dec 2017 23:52 by Sascha.

Please Log in or Create an account to join the conversation.

More
15 Dec 2017 01:41 #7253 by WhiskyTest
Replied by WhiskyTest on topic Event Based Regeneration
This is a warning that is telling you the compiler cannot see exactly what string is going to be printed with the log() function. If you make an error creating the string it could cause unexpected things to happen.
For example if it sent "strings are fun to %s" as a string, the %s needs a value and would crash.

My compiler doesn't warn me about this so I've not seen it before.

I think you can eliminate the warning by changing the lines to :
Code:
log( "SYSERR: Unknown points event type %d", type);
If that works you can remove the sprintf line, and the char log[100] won't be needed either.

Please Log in or Create an account to join the conversation.

More
19 Feb 2018 21:33 #7606 by cunning
Replied by cunning on topic Event Based Regeneration
Just wondering why you left this as a separate event, instead of incorporating it into dg_event.c and mud_event.c

When i did this a long long time ago, I went the same direction you did. It works great, but it would crash on specific free'ing of events. I do not remember what that was. I am going to look into this further. I am integrating it into JediMUD test port. It already has an advanced regen system in, and if i can get all 3 to gel. That would rock!

3 things are incorporate into mud_event/dg_event, JediMUD regen system, and the mobile regen system we have.

I really do like this.

Please Log in or Create an account to join the conversation.

More
23 Feb 2018 03:36 #7618 by WhiskyTest
Replied by WhiskyTest on topic Event Based Regeneration
I initially made one using the built-in events but it was unstable and would crash due to events not freeing correctly. I rewrote the one above for tbamud and it is well tested.

I will be revisiting incorporating this into mud events this year just to get everything streamlined. Feel free to try the first attachment which attempted this and see if you can find why it's crashing :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.267 seconds