Advertisement
Guest User

Untitled

a guest
Apr 17th, 2011
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.76 KB | None | 0 0
  1. oid world_speak_npcs(void *world_void)
  2.  
  3. {
  4.  
  5. World *world = static_cast<World *>(world_void);
  6.  
  7.  
  8.  
  9. UTIL_PTR_VECTOR_FOREACH(world->maps, Map, map)
  10.  
  11. {
  12.  
  13. UTIL_PTR_VECTOR_FOREACH(map->npcs, NPC, npc)
  14.  
  15. {
  16.  
  17.   int rand = util::rand(35, 100);
  18.  
  19.   if(rand > 1 && rand < 3) //1% chance say first message
  20.  
  21.   {
  22.  
  23.       npc->Msg(static_cast<std::string>(world->npcsay_config[util::to_string(npc->id) + ".1"]));
  24.  
  25.   }
  26.  
  27.   else if(rand > 30 && rand < 32) //1% chance change message
  28.  
  29.   {
  30.  
  31.       npc->Msg(static_cast<std::string>(world->npcsay_config[util::to_string(npc->id) + ".2"]));
  32.  
  33.   }
  34.  
  35.   else if(rand > 70 && rand < 72) // 1% chance say 3rd
  36.  
  37.   {
  38.  
  39.       npc->Msg(static_cast<std::string>(world->npcsay_config[util::to_string(npc->id) + ".3"]));
  40.  
  41.   }
  42.  
  43. }
  44.  
  45. }
  46.  
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement