I basically want it to read a random number between 1 - 10 which is defined as crit
If crit > rand, then spawn crit item, else spawn regular item unless rand > skill. Basically giving a 10% chance to crit.
I had it setup previously for crit to be 90-100 but because of the way it is written it seemed easier to make crit a lower number vs rand since its skill > rand for success.
crafts.c: In function 'event_craft':
crafts.c:549: warning: implicit declaration of function 'real_obj'
crafts.c:549: warning: implicit declaration of function 'CRAFT_CRIT_VNUM'
crafts.c:576: error: expected expression before 'else'
crafts.c:651: error: invalid storage class for function 'copy_requirement'
crafts.c:656: error: invalid storage class for function 'copy_craft'
crafts.c:707: error: invalid storage class for function 'craftedit_setup_new'
crafts.c:806: error: invalid storage class for function 'craftedit_disp_skill_menu'
crafts.c:823: error: invalid storage class for function 'craftedit_disp_req_flags'
crafts.c:841: error: invalid storage class for function 'craftedit_disp_craft_flags'
crafts.c:859: error: invalid storage class for function 'craftedit_requirement_menu'
crafts.c:881: error: invalid storage class for function 'craftedit_disp_menu'
crafts.c:1244: error: expected declaration or statement at end of input
Code:
skill = GET_SKILL(ch, CRAFT_SKILL(craft)) - (CRAFT_SKILL_LEVEL(craft) / 2);
rand = rand_number(1, 100);
crit = rand_number(1, 10);
if (rand < crit) {
if (real_obj(CRAFT_CRIT_VNUM(craft)) != NOTHING && rand > crit) { <--- LINE 549
remove_components(ch, craft, TRUE);
obj_to_char(obj, ch);
act(CRAFT_CRIT_MSG_SELF(craft), TRUE, ch, obj, 0, TO_CHAR);
act(CRAFT_CRIT_MSG_ROOM(craft), TRUE, ch, obj, 0, TO_NOTVICT);
} else {
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);