Welcome to the Builder Academy

Question Animate dead question

More
26 Mar 2016 12:53 - 26 Mar 2016 13:59 #5691 by JTP
Animate dead question was created by JTP
Hi

Anyone who can tell me where in the code, i could have the animate_dead load a zombie that would suit the caster better then just a lvl 1 zombie. Doesnt make much sence to load a lvl 1, if the player is lvl 30..

Or have it level up from xp ?
And set a max amount for how many zombies the player can make ?
Last edit: 26 Mar 2016 13:59 by JTP.

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

More
26 Mar 2016 16:04 #5692 by thomas

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

More
26 Mar 2016 22:10 #5693 by JTP
Replied by JTP on topic Animate dead question
Dont quite see how there,

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

More
26 Mar 2016 22:21 #5694 by thomas
Replied by thomas on topic Animate dead question
Code:
#define MOB_ZOMBIE 11 /**< vnum for the zombie mob. */ void mag_summons(int level, struct char_data *ch, struct obj_data *obj, int spellnum, int savetype) { struct char_data *mob = NULL; struct obj_data *tobj, *next_obj; int pfail = 0, msg = 0, fmsg = 0, num = 1, handle_corpse = FALSE, i; mob_vnum mob_num; if (ch == NULL) return; switch (spellnum) { case SPELL_CLONE: msg = 10; fmsg = rand_number(2, 6); /* Random fail message. */ mob_num = MOB_CLONE; /* * We have designated the clone spell as the example for how to use the * mag_materials function. * In stock tbaMUD it checks to see if the character has item with * vnum 161 which is a set of sacrificial entrails. If we have the entrails * the spell will succeed, and if not, the spell will fail 102% of the time * (prevents random success... see below). * The object is extracted and the generic cast messages are displayed. */ if( !mag_materials(ch, OBJ_CLONE, NOTHING, NOTHING, TRUE, TRUE) ) pfail = 102; /* No materials, spell fails. */ else pfail = 0; /* We have the entrails, spell is successfully cast. */ break; case SPELL_ANIMATE_DEAD: if (obj == NULL || !IS_CORPSE(obj)) { act(mag_summon_fail_msgs[7], FALSE, ch, 0, 0, TO_CHAR); return; } handle_corpse = TRUE; msg = 11; fmsg = rand_number(2, 6); /* Random fail message. */ mob_num = MOB_ZOMBIE; pfail = 10; /* 10% failure, should vary in the future. */ break; default: return; } if (AFF_FLAGGED(ch, AFF_CHARM)) { send_to_char(ch, "You are too giddy to have any followers!\r\n"); return; } if (rand_number(0, 101) < pfail) { send_to_char(ch, "%s", mag_summon_fail_msgs[fmsg]); return; } for (i = 0; i < num; i++) { if (!(mob = read_mobile(mob_num, VIRTUAL))) { send_to_char(ch, "You don't quite remember how to make that creature.\r\n"); return; } char_to_room(mob, IN_ROOM(ch)); IS_CARRYING_W(mob) = 0; IS_CARRYING_N(mob) = 0; SET_BIT_AR(AFF_FLAGS(mob), AFF_CHARM); if (spellnum == SPELL_CLONE) { /* Don't mess up the prototype; use new string copies. */ mob->player.name = strdup(GET_NAME(ch)); mob->player.short_descr = strdup(GET_NAME(ch)); } act(mag_summon_msgs[msg], FALSE, ch, 0, mob, TO_ROOM); load_mtrigger(mob); add_follower(mob, ch); if (GROUP(ch) && GROUP_LEADER(GROUP(ch)) == ch) join_group(mob, GROUP(ch)); }

The code currently just loads the zombie mob (vnum 11). If you want to do other things, add levels and hit dice, etc. after the loading, or make a lot of different zombie mobs and choose one in the "case SPELL_ANIMATE_DEAD" section.

Your other question about letting them gain levels is somewhat more advanced. Mobs don't level up in TBA - they just gain exp ( github.com/tbamud/tbamud/blob/d245d0e6b2...ff/src/limits.c#L231 ). Changing this could mean quite some changes to the way mobs work.

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

More
22 Dec 2017 19:53 #7280 by JTP
Replied by JTP on topic Animate dead question
How do i limit animate dead, so you Can only make 1 for every 10 levels a player is ?

Standard you Can make as many as you want.

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

More
23 Dec 2017 04:18 #7281 by WhiskyTest
Replied by WhiskyTest on topic Animate dead question
First step, you'll need to know how many the player already has.

Normally these dastardly corpse-warriors are added into the group, so you could check all group members and tally up how many of these are NPCs and match the VNUM of the zombie mob.

Then in mag_summons(), in magic.c
Just after the check for AFF_CHARM, you would just check how many exist versus the player level divided by 10.
Check the range is between 1 and something higher with : MAX(1, level / 10)

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

Time to create page: 0.221 seconds