Welcome to the Builder Academy

Question Current Event System

More
22 Jan 2013 08:54 #1390 by zusuk
Current Event System was created by zusuk
I've built a lot of my skill mechanics based on cooldowns using the event system, for example the paladin ability 'lay on hands.'

Something Ripley pointed out to me was that when you quit and come back in, all your char_events are cleared.

That being said, to avoid major cheese, it seems like I'm going to need to save events to characters.

Any advice on how to proceed with this before I begin the project? Has someone done this yet?

Website
www.luminariMUD.com

Main Game Port
luminariMUD.com:4100

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

More
23 Jan 2013 07:08 #1392 by Vatiken
Replied by Vatiken on topic Re: Current Event System
Should be easy enough to do as 99% of the event data consists of an EVENT ID, TIMER and VARIABLE. Probably could base a save/load function off the ones used for saving/loading skills.

tbaMUD developer/programmer

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

More
24 Jan 2013 00:22 #1393 by Kvasir
Replied by Kvasir on topic Re: Current Event System
Events I've used:
Points Regen (hit/mana/move from the old CircleFTP site)
Combat (basically putting the hit function into an event, weapons could attack at different speeds which was fun)
Lockpicking (an event that keeps attempting every couple of seconds until you give up or succeed)
Movement (I used this to create different movement speeds - it sort of just made the game appear laggy though!)

Events I want to implement:
Combat Afflictions (Freeze/Burn/Poison/Heal Over Time/Damage Over Time)
Crafting (Order items at forges and workshops which take time to create)
Mob AI (an extension of mob_activity that attempts to give the appearance of daily activities)

I have started working with the new Mud_Event system, which looks so much easier to understand by the way! - But I can't find the correct way to cancel an event.

Example:
A character has a 'Regenerate HP' event queued to increment HP in 30 seconds, I want to update the 30 seconds to a new number.
Either by canceling the event and creating a new one, or manipulating the current time before it triggers.

Does anyone know a tidy way to do this?

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

More
24 Jan 2013 11:19 #1394 by Ornir
Replied by Ornir on topic Re: Current Event System
Here you go - I have coded up a procedure to add to mud_event.c (with the corresponding prototype in mud_event.h) that will let you change the duration of an event by id. This only works on character events.

Please let me know if you find problems with this code or find a better way.

Thanks!
Code:
void change_event_duration(struct char_data * ch, event_id iId, long time) { struct event * pEvent; struct mud_event_data * pMudEvent; bool found = FALSE; if (ch->events->iSize == 0) return; simple_list(NULL); while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) { if (!pEvent->isMudEvent) continue; pMudEvent = (struct mud_event_data * ) pEvent->event_obj; if (pMudEvent->iId == iId) { found = TRUE; break; } } simple_list(NULL); if (found) { /* So we found the offending event, now build a new one, with the new time */ attach_mud_event(new_mud_event(iId, pMudEvent->pStruct, pMudEvent->sVariables), time); event_cancel(pEvent); } }

Luminari - a Pathfinder/D&D inspired adventure!
www.luminarimud.com
luminarimud.com 4100
The following user(s) said Thank You: Kvasir

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

More
24 Jan 2013 13:34 #1395 by Kvasir
Replied by Kvasir on topic Re: Current Event System
Nice thanks very much!
I've added it to my source and will try it out :)

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

Time to create page: 0.194 seconds