Welcome to the Builder Academy

Question Customized Mob Movement

More
Yesterday 16:43 #10937 by zi
Replied by zi on topic Customized Mob Movement
Hey! I haven't been on these forums in a while, but added adverbs for the custom mob movement using the same technique so on my mud you'll see:

A Metroplex citizen walks casually in from the east.


HOW? I added an adverb subsection to medit:

>  medit 100
-- Mob Number:  [100]
1) Sex: male                  2) Keywords: Metroplex citizen
3) S-Desc: a Metroplex citizen
4) L-Desc:-
A Metroplex citizen gives you a polite nod as he passes you.

5) D-Desc:-
  Clothed in the skin-tight red and gold uniform of the Metroplex, the citizen
represents one of the best and brightest that humanity has to offer across an
infinite set of time lines.  The look of pure delight tells you he recognizes
this as a once-in-a-lifetime chance to impart, or ingest, the collective
knowledge gathered by adventurers.

6) Position  : Standing
7) Default  : Standing
8) Attack    : hit
R) Race      : Human
V) Move Text : walks
Y) Adverbs  : briskly confidently boldly casually resolutely
9) Stats Menu...
A) NPC Flags : ISNPC STAY-ZONE
B ) AFF Flags : NOBITS
S) Script    : Not Set.
W) Copy mob
X) Delete mob
Q) Quit

y
1) slowly                2) quickly             
3) briskly                4) clumsily             
5) gracefully            6) wearily             
7) noisily                8) silently             
9) awkwardly            10) confidently         
11) nervously            12) boldly               
13) cautiously            14) recklessly           
15) deliberately          16) eagerly             
17) reluctantly          18) smoothly             
19) haltingly            20) methodically         
21) mechanically          22) hesitantly           
23) hurriedly            24) calmly               
25) urgently              26) lazily               
27) formally              28) casually             
29) purposefully          30) drowsily             
31) energetically        32) menacingly           
33) innocently            34) ominously           
35) cheerfully            36) gloomily             
37) stoically            38) elegantly           
39) sluggishly            40) frantically         
41) lethargically        42) dutifully           
43) grumpily              44) gently               
45) impatiently          46) patiently           
47) restlessly            48) grimly               
49) proudly              50) subtly               
51) forcefully            52) timidly             
53) jovially              54) melancholically     
55) decisively            56) indifferently       
57) playfully            58) joyously             
59) angrily              60) merrily             
61) resolutely            62) tentatively         
63) fearfully            64) heedlessly           
65) idly                 
Current adverbs : briskly confidently boldly casually resolutely
Enter adverb number to toggle (0 to quit) :

errr, i dont think i should have 65... this should prob to up to 63 as it's a 64bit long long flag.. anyway, pulling from constants.c
Code:
const char *mob_movement_adverbs[] = {     "slowly",     "quickly",     "briskly",     "clumsily",     "gracefully",     "wearily",     "noisily",     "silently",     "awkwardly",     "confidently",     "nervously",     "boldly",     "cautiously",     "recklessly",     "deliberately",     "eagerly",     "reluctantly",     "smoothly",     "haltingly",     "methodically",     "mechanically",     "hesitantly",     "hurriedly",     "calmly",     "urgently",     "lazily",     "formally",     "casually",     "purposefully",     "drowsily",     "energetically",     "menacingly",
etc.

and in act.movement.c a 'lil helper function:
Code:
/* Pick one random adverb from the mob's assigned flags. */ static const char *random_mob_adverb(uint64_t flags) {   if (!flags)     return NULL;   int idxs[NUM_MOB_ADV], n = 0;   for (int i = 0; i < NUM_MOB_ADV && mob_movement_adverbs[i][0] != '\n'; ++i) {     if (flags & (1ULL << i)) {       idxs[n++] = i;     }   }   if (n == 0)     return NULL;

and in the most unnecessarily commented function in all of tbamud, do_simple_move, I build the message (for both leaving and arriving parts):
Code:
  /* Generate the leave message and display to others in the was_in room. */   if (IS_NPC(ch)) {     /* Mobs: use custom verb from medit (X Y Z style) + optional adverb. */     const char *adv = random_mob_adverb(GET_MOBADV(ch));     snprintf(leave_message, sizeof(leave_message),              "$n %s%s%s %s.",              mob_movement_text[(int)GET_MOBMOVE(ch)],              adv ? " " : "",              adv ? adv : "",              dirs[dir]);     act(leave_message, TRUE, ch, 0, 0, TO_ROOM);   } else if (!AFF_FLAGGED(ch, AFF_SNEAK)) {     if (AFF_FLAGGED(ch, AFF_FLYING)) {       /* flying PC */       snprintf(leave_message, sizeof(leave_message),                "$n hovers %s.", dirs[dir]);     } else {       /* grounded PC: verb depends on move % */       const char *adv = random_mob_adverb(GET_MOBADV(ch));       snprintf(leave_message, sizeof(leave_message),                "$n %s%s%s %s.",                movement_verb(ch),                adv ? " " : "",                adv ? adv : "",                dirs[dir]);     }     act(leave_message, TRUE, ch, 0, 0, TO_ROOM);   }

there's something else at play here, movement check of the pc and then changing walks to crawls/stumbles/whatever based on the % of their movement points.

Milholy crawls north.

5_000h 5_000n 5_000e>

Milholy crawls in from the north.

5_000h 5_000n 5_000e>
.refresh mil
You access your program library and successfully execute refresh.

5_000h 4_990n 5_000e>

Milholy shuffles north.

5_000h 4_990n 5_000e>
Milholy shuffles in from the north.


The poor PC was at 2% energy (movement) and used refresh to get her up to around 50%. I mean, critical to a mud's function? No. fun? Yes. well, adding color and making it your own is fun.

anyway - Verb is great, random adverb is icing.

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

Time to create page: 0.170 seconds