Welcome to the Builder Academy

Loved New OLC Craft System

More
23 Jun 2012 17:41 #215 by Vatiken
Replied by Vatiken on topic Re: New OLC Craft System

Vatiken wrote:

Code:
+ case 'L': + if (!strcmp(tag, "Froo")) craft->craft_fail_msg_room = strdup(line); + else if (!strcmp(tag, "Fslf")) craft->craft_msg_self = strdup(line); + break;
Should be "craft_fail_msg_self ="right?
Other than that, everything looks good. Nice work.


Should also be
Code:
case 'F':

tbaMUD developer/programmer

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

More
23 Jun 2012 17:47 - 23 Jun 2012 17:48 #216 by Halenbane
Replied by Halenbane on topic Re: New OLC Craft System
But case 'F' is already used right?

case 'F':
if (!strcmp(tag, "Flag")) craft->craft_flags = atoi(line);
break;
Last edit: 23 Jun 2012 17:48 by Halenbane.

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

More
23 Jun 2012 18:36 #217 by Vatiken
Replied by Vatiken on topic Re: New OLC Craft System
Code:
case 'F': if (!strcmp(tag, "Flag")) craft->craft_flags = atoi(line); break; case 'M': if (!strcmp(tag, "Mroo")) craft->craft_msg_room = strdup(line); else if (!strcmp(tag, "Mslf")) craft->craft_msg_self = strdup(line); break; + case 'L': + if (!strcmp(tag, "Froo")) craft->craft_fail_msg_room = strdup(line); + else if (!strcmp(tag, "Fslf")) craft->craft_msg_self = strdup(line); + break;

Yes, but you have yours under case 'L'. Which means, it will only hit that case of the switch if the first character is a capital L, which isn't applicable to "Froo" and "Fslf". So what you'd want to do is something like this:
Code:
case 'F': if (!strcmp(tag, "Flag")) craft->craft_flags = atoi(line); + else if (!strcmp(tag, "Froo")) craft->craft_fail_msg_room = strdup(line); + else if (!strcmp(tag, "Fslf")) craft->craft_fail_msg_self = strdup(line); break; case 'M': if (!strcmp(tag, "Mroo")) craft->craft_msg_room = strdup(line); else if (!strcmp(tag, "Mslf")) craft->craft_msg_self = strdup(line); break;

tbaMUD developer/programmer

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

More
23 Jun 2012 18:50 #218 by Halenbane
Replied by Halenbane on topic Re: New OLC Craft System
Correct you are sir. Thanks!

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

More
25 Jun 2012 23:17 #245 by Halenbane
Replied by Halenbane on topic Re: New OLC Craft System
I'm attempting to add a chance for a critical craft (another vnum is assigned in case they succeed in a big way) so they can have a chance at an upgraded version. This upgraded version would be another vnum entirely. I have modified the code quite a bit but I am having trouble deciding how to write the next piece.
Code:
skill = GET_SKILL(ch, CRAFT_SKILL(craft)) - (CRAFT_SKILL_LEVEL(craft) / 2); rand = rand_number(1, 100); crit = rand_number(90, 100); if (skill > rand) { if ((obj = read_object(CRAFT_OBJVNUM(craft), VIRTUAL)) == NULL) { send_to_char(ch, "You seem to have an issue with your crafting.\r\n"); mudlog(CMP, LVL_GOD, TRUE, "SYSERR: Event Craft called without created object."); return (0); } remove_components(ch, craft, TRUE); obj_to_char(obj, ch); if (!CRAFT_MSG_SELF(craft)) send_to_char(ch, "You have created %s.\r\n", obj->short_description); else act(CRAFT_MSG_SELF(craft), TRUE, ch, obj, 0, TO_CHAR); if (CRAFT_MSG_ROOM(craft)) act(CRAFT_MSG_ROOM(craft), TRUE, ch, obj, 0, TO_NOTVICT); } else if (skill > (rand / 2)) { act("You struggle in your attempt to craft, but you continue on.", TRUE, ch, 0, 0, TO_CHAR); act("$n struggles in $s attempt to craft.", TRUE, ch, 0, 0, TO_NOTVICT); return (CRAFT_TIMER(craft) * PASSES_PER_SEC); } else { remove_components(ch, craft, FALSE); act(CRAFT_FAIL_MSG_SELF(craft), TRUE, ch, 0, 0, TO_CHAR); act(CRAFT_FAIL_MSG_ROOM(craft), TRUE, ch, 0, 0, TO_NOTVICT);

I need to tell it - If crit > rand and only if rand > skill in the first place, then show craft_crit_msg_room etc and load the crit item instead of the normal one.

The problem I'm having is the way I was thinking of writing it, it would still cause a problem if you didn't set a crit item for that craft. So I don't want the mud freaking out if it crit is > random, and there is no object set for crit. If it crits, but there is no crit obj defined, then it should just go on to the normal item as usual.

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

More
26 Jun 2012 00:00 #246 by Liko
Replied by Liko on topic Re: New OLC Craft System

Halenbane wrote: I'm attempting to add a chance for a critical craft (another vnum is assigned in case they succeed in a big way) so they can have a chance at an upgraded version. This upgraded version would be another vnum entirely. I have modified the code quite a bit but I am having trouble deciding how to write the next piece.

Code:
skill = GET_SKILL(ch, CRAFT_SKILL(craft)) - (CRAFT_SKILL_LEVEL(craft) / 2); rand = rand_number(1, 100); crit = rand_number(90, 100); if (skill > rand) { if ((obj = read_object(CRAFT_OBJVNUM(craft), VIRTUAL)) == NULL) { send_to_char(ch, "You seem to have an issue with your crafting.\r\n"); mudlog(CMP, LVL_GOD, TRUE, "SYSERR: Event Craft called without created object."); return (0); } remove_components(ch, craft, TRUE); obj_to_char(obj, ch); if (!CRAFT_MSG_SELF(craft)) send_to_char(ch, "You have created %s.\r\n", obj->short_description); else act(CRAFT_MSG_SELF(craft), TRUE, ch, obj, 0, TO_CHAR); if (CRAFT_MSG_ROOM(craft)) act(CRAFT_MSG_ROOM(craft), TRUE, ch, obj, 0, TO_NOTVICT); } else if (skill > (rand / 2)) { act("You struggle in your attempt to craft, but you continue on.", TRUE, ch, 0, 0, TO_CHAR); act("$n struggles in $s attempt to craft.", TRUE, ch, 0, 0, TO_NOTVICT); return (CRAFT_TIMER(craft) * PASSES_PER_SEC); } else { remove_components(ch, craft, FALSE); act(CRAFT_FAIL_MSG_SELF(craft), TRUE, ch, 0, 0, TO_CHAR); act(CRAFT_FAIL_MSG_ROOM(craft), TRUE, ch, 0, 0, TO_NOTVICT);

I need to tell it - If crit > rand and only if rand > skill in the first place, then show craft_crit_msg_room etc and load the crit item instead of the normal one.

The problem I'm having is the way I was thinking of writing it, it would still cause a problem if you didn't set a crit item for that craft. So I don't want the mud freaking out if it crit is > random, and there is no object set for crit. If it crits, but there is no crit obj defined, then it should just go on to the normal item as usual.


If it was me, I would make it so craft edit lets you put a normal item that you make when you successfully craft and an item when you critically craft.

So it would go like this:

Player attempts to craft...
If player fails..send failure message
If player passes...roll your critical chance.
if player passes critical chance then load critical vnum
if player fails critical chance then load normal vnum.

I hope this makes sense.

Randian(0.0.0)
Owner/Developer

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

Time to create page: 0.203 seconds