The rule is that the player will pay a zeny per hour and when a player dies the timer should pause and resumes when the player enters the map again.
But the problem is after the player dies the timer won't attach to the player anymore and doesn't resume the time used by the player.
pvp_n_1-5,99,113,4 script Battleground Warper::bg_warper 416,{
if(@bg_session == 1) {
B_Session:
set @BGRemaintT,(getnpctimer(0)/1000);
if(@BGRemainT >= 60)
set @BGRemain$, (@BGRemainT / 60)+" minute/s^000000";
else
set @BGRemain$, @BGRemainT+" second/s^000000";
mes "[Gate Keeper]";
mes "Hello "+strcharinfo(0)+"!";
mes "You have a remaining time of ^008000"+@BGRemain$;
mes "What do you want?";
switch(select("Return to the Battlegrounds:I want to end my session:Where can I trade this points?")) {
case 1:
mes "[Gate Keeper]";
mes "As you wish.";
next;
startnpctimer "bg_warper",getcharid(0);
warp "bat_b02",87,89;
close;
case 2:
mes "[Gate Keeper]";
mes "As you wish.";
next;
set @bg_session,0;
stopnpctimer "bg_warper",getcharid(0);
detachnpctimer "bg_warper";
mes "[Gate Keeper]";
mes "You're session is closed.";
close;
case 3:
mes "[Gate Keeper]";
mes "You can trade you're Battlepoints on the Battleground shops.";
next;
}
goto B_Session;
}
mes "[Gate Keeper]";
mes "In the battleground there are tons of monsters you can defeat and earn ^008000Battleground Points^000000.";
mes "Which you can exchange for items at the ^0000FFBattleground Shop^000000";
next;
mes "[Gate Keeper]";
mes "A fee of 10k Zeny is charged per hour.";
mes "Would you like to enter the grounds?";
if(select("Yes:No") == 2) close;
next;
if(Zeny < 10000) {
mes "[Gate Keeper]";
mes "Please don't make me look stupid";
mes "I know how to count money.";
close;
}
mes "[Gate Keeper]";
mes "Just a little reminders:";
mes "I will Automatically deduct your zeny to extend your time.";
mes "If you want to stop your time just talk to me again.";
mes "Incase you got killed you're time will paused and will be resumed once you enter again.";
mes "^FF0000NOTE: If ever your character logged out you're time will be automatically terminated.^000000";
next;
set @bg_session, 1;
set @auto_extend, 1;
set Zeny,Zeny - 10000;
initnpctimer "bg_warper",getcharid(0);
warp "bat_b02",87,75;
close;
OnTimer10000:
dispbottom "First 10 seconds of your time has begun!";
end;
OnTimer20000:
dispbottom "Another 10 seconds have passed.";
end;
OnTimer30000:
set @BGRemaintT,(getnpctimer(0)/1000);
dispbottom " "+@BGRemainT;
end;
OnTimer3000000:
if(Zeny < 10000) dispbottom "You don't have enough zeny left.";
announce "You have 10 minutes remaining.",bc_self,0x008000;
end;
OnTimer3600000:
OnTimer3600001:
if(@auto_extend == 1) {
if(Zeny < 10000) {
dispbottom "You don't have enough zeny left. Warping you out.";
stopnpctimer "bg_warper",getcharid(0);
detachnpctimer "bg_warper";
warp "mellina",85,83;
end;
}
set Zeny,Zeny - 5000;
initnpctimer "bg_warper",getcharid(0);
announce "10k Zeny is deducted. I have extended your time",bc_self,0xC0C0C0;
end;
}
else {
stopnpctimer "bg_warper",getcharid(0);
detachnpctimer "bg_warper";
set @bg_session, 0;
announce "You're time is up!",bc_self;
warp "mellina",85,83;
end;
}
OnTimerQuit:
stopnpctimer "bg_warper",getcharid(0);
detachnpctimer "bg_warper";
set @bg_session, 0;
end;
OnPCKillEvent:
stopnpctimer "bg_warper",getcharid(0);
if(strcharinfo(3) == "bat_b02")
warp "pvp_n_1-5",99,107;
end;
}
Edited by Arcenciel Please use a codebox for long scripts.
Question
KaitoKid
I'm making a script that involves NPC timer.
The rule is that the player will pay a zeny per hour and when a player dies the timer should pause and resumes when the player enters the map again.
But the problem is after the player dies the timer won't attach to the player anymore and doesn't resume the time used by the player.
Edited by ArcencielPlease use a codebox for long scripts.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.