Advertisement
Guest User

Bloody Branch Room

a guest
Nov 22nd, 2016
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Todo: Check if duplicated npc share the same timer or na.
  2.  
  3. // Note: Duplicated npc share the same Npc variable, so we have to build variable bind to npc duplicated name.
  4. // If we don't and keep using normal npc variable like .charName$, Tomb Npc will have the same message for every map because
  5. // they share the same .charName$ as they are duplicated from the same Npc.
  6.  
  7. /*
  8.  * get npc variable of a duplicate Npc
  9.  */
  10. function    script  getDup  {
  11.     .@varName$ = "."+strnpcinfo(NPC_NAME_HIDDEN)+"_"+getarg(0);
  12.     return getvariableofnpc(getd("."+strnpcinfo(NPC_NAME_HIDDEN)+"_"+getarg(0)), strnpcinfo(NPC_NAME));
  13. }
  14. /*
  15.  * set npc variable of a duplicate Npc
  16.  */
  17. function    script  setDup  {
  18.     .@strLen = getstrlen(getarg(0));
  19.     if(strpos(getarg(0),"$") != -1)
  20.         return set(getvariableofnpc(getd("."+strnpcinfo(NPC_NAME_HIDDEN)+"_"+getarg(0)), strnpcinfo(NPC_NAME)), getarg(1));
  21.  
  22.     return set(getvariableofnpc(getd("."+strnpcinfo(NPC_NAME_HIDDEN)+"_"+getarg(0)), strnpcinfo(NPC_NAME)), atoi(getarg(1)));
  23. }
  24.  
  25. -   script  SpawnPvE    FAKE_NPC,{
  26.         mes .npc$;
  27.         mes "Killed time: "+getDup("time$");
  28.         mes "Killer: "+getDup("charName$");
  29.     close;
  30.  
  31.  
  32.     OnInit:
  33.         // Init map
  34.         if(strnpcinfo(NPC_MAP) == "") end;
  35.        
  36.         // Set Npc Name
  37.         .npc$ = "[ Bloody Branch Tomb ]";
  38.  
  39.         // Hide the tomb
  40.         hideonnpc(strnpcinfo(NPC_NAME));
  41.  
  42.         monster(strnpcinfo(NPC_MAP),0,0,"--ja--",-3,1,strnpcinfo(NPC_NAME)+"::OnMonsterDead");
  43.     end;
  44.    
  45.     // When a player kills a monster
  46.     OnMonsterDead:
  47.         // Get character name & time for the tomb message.
  48.         setDup("charName$", strcharinfo(PC_NAME));
  49.         setDup("time$", gettimestr("%Hh%Mm%Ss", 10));
  50.  
  51.         // Retrieve position on the dead MvP
  52.         getmapxy(@map$, @mapX, @mapY, UNITTYPE_PC);
  53.  
  54.         // Move the tomb to the dead MvP
  55.         movenpc(strnpcinfo(NPC_NAME), @mapX, @mapY);
  56.  
  57.         // Show the tomb
  58.         hideoffnpc(strnpcinfo(NPC_NAME));
  59.  
  60.         // Init timer to spawn new MvP 1h later.
  61.         initnpctimer;
  62.     end;
  63.    
  64.     // Change to 360000 for 1hour timeout, I left 20000 for testing.
  65.     OnTimer20000:
  66.         announce "Timer ended",0;
  67.         // Stop & reset timer
  68.         stopnpctimer;
  69.         setnpctimer(0);
  70.  
  71.         // Hide tomb
  72.         hideonnpc(strnpcinfo(NPC_NAME));
  73.  
  74.         // Spawn new MvP
  75.         monster(strnpcinfo(NPC_MAP),0,0,"--ja--",-3,1,strnpcinfo(NPC_NAME)+"::OnMonsterDead");
  76.     end;
  77. }
  78.  
  79. pvp_n_3-1,0,0,0 duplicate(SpawnPvE) SpawnPvE#1  MOB_TOMB
  80. pvp_n_3-2,0,0,0 duplicate(SpawnPvE) SpawnPvE#2  MOB_TOMB
  81. pvp_n_3-3,0,0,0 duplicate(SpawnPvE) SpawnPvE#3  MOB_TOMB
  82. pvp_n_3-4,0,0,0 duplicate(SpawnPvE) SpawnPvE#4  MOB_TOMB
  83. pvp_n_3-5,0,0,0 duplicate(SpawnPvE) SpawnPvE#5  MOB_TOMB
  84.  
  85. prontera,160,180,4  script  Tombnega    MOB_TOMB,{
  86.     end;
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement