Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Todo: Check if duplicated npc share the same timer or na.
- // Note: Duplicated npc share the same Npc variable, so we have to build variable bind to npc duplicated name.
- // If we don't and keep using normal npc variable like .charName$, Tomb Npc will have the same message for every map because
- // they share the same .charName$ as they are duplicated from the same Npc.
- /*
- * get npc variable of a duplicate Npc
- */
- function script getDup {
- .@varName$ = "."+strnpcinfo(NPC_NAME_HIDDEN)+"_"+getarg(0);
- return getvariableofnpc(getd("."+strnpcinfo(NPC_NAME_HIDDEN)+"_"+getarg(0)), strnpcinfo(NPC_NAME));
- }
- /*
- * set npc variable of a duplicate Npc
- */
- function script setDup {
- .@strLen = getstrlen(getarg(0));
- if(strpos(getarg(0),"$") != -1)
- return set(getvariableofnpc(getd("."+strnpcinfo(NPC_NAME_HIDDEN)+"_"+getarg(0)), strnpcinfo(NPC_NAME)), getarg(1));
- return set(getvariableofnpc(getd("."+strnpcinfo(NPC_NAME_HIDDEN)+"_"+getarg(0)), strnpcinfo(NPC_NAME)), atoi(getarg(1)));
- }
- - script SpawnPvE FAKE_NPC,{
- mes .npc$;
- mes "Killed time: "+getDup("time$");
- mes "Killer: "+getDup("charName$");
- close;
- OnInit:
- // Init map
- if(strnpcinfo(NPC_MAP) == "") end;
- // Set Npc Name
- .npc$ = "[ Bloody Branch Tomb ]";
- // Hide the tomb
- hideonnpc(strnpcinfo(NPC_NAME));
- monster(strnpcinfo(NPC_MAP),0,0,"--ja--",-3,1,strnpcinfo(NPC_NAME)+"::OnMonsterDead");
- end;
- // When a player kills a monster
- OnMonsterDead:
- // Get character name & time for the tomb message.
- setDup("charName$", strcharinfo(PC_NAME));
- setDup("time$", gettimestr("%Hh%Mm%Ss", 10));
- // Retrieve position on the dead MvP
- getmapxy(@map$, @mapX, @mapY, UNITTYPE_PC);
- // Move the tomb to the dead MvP
- movenpc(strnpcinfo(NPC_NAME), @mapX, @mapY);
- // Show the tomb
- hideoffnpc(strnpcinfo(NPC_NAME));
- // Init timer to spawn new MvP 1h later.
- initnpctimer;
- end;
- // Change to 360000 for 1hour timeout, I left 20000 for testing.
- OnTimer20000:
- announce "Timer ended",0;
- // Stop & reset timer
- stopnpctimer;
- setnpctimer(0);
- // Hide tomb
- hideonnpc(strnpcinfo(NPC_NAME));
- // Spawn new MvP
- monster(strnpcinfo(NPC_MAP),0,0,"--ja--",-3,1,strnpcinfo(NPC_NAME)+"::OnMonsterDead");
- end;
- }
- pvp_n_3-1,0,0,0 duplicate(SpawnPvE) SpawnPvE#1 MOB_TOMB
- pvp_n_3-2,0,0,0 duplicate(SpawnPvE) SpawnPvE#2 MOB_TOMB
- pvp_n_3-3,0,0,0 duplicate(SpawnPvE) SpawnPvE#3 MOB_TOMB
- pvp_n_3-4,0,0,0 duplicate(SpawnPvE) SpawnPvE#4 MOB_TOMB
- pvp_n_3-5,0,0,0 duplicate(SpawnPvE) SpawnPvE#5 MOB_TOMB
- prontera,160,180,4 script Tombnega MOB_TOMB,{
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement