Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ------------------------------------------
- // Testing Instance
- // ------------------------------------------
- // Made by: Sehrentos
- // ------------------------------------------
- // Date: 08-04-2015
- // ------------------------------------------
- // - 24 hours instance reset (todo)
- // - Kill monsters to spawn the boss
- // - Party shared loot
- //
- // Example how it works: https://youtu.be/iR4gO-TXJII
- //
- // Edit 'db/(pre-)re/instance_db.txt' to enable this custom instance.
- // 12,Testing instance,3600,prt_are01,149,121,prt_are01
- // ------------------------------------------
- prontera,155,163,4 script Instance Stone#1_test 406,{
- set .@party_id, getcharid(1);
- set .@party_name$, getpartyname(.@party_id);
- set .@instance_name$, "Testing instance";
- // Check party
- if (!instance_check_party(.@party_id,1)) {
- mes "["+strnpcinfo(1)+"]";
- mes "Make or join a party with more than 1 member and try again.";
- mes "Instance: ^0000ff"+.@instance_name$+"^000000";
- close;
- }
- // Create instance (party leader)
- if (getcharid(0) == getpartyleader(.@party_id,2)) {
- mes "["+strnpcinfo(1)+"]";
- mes "Confirmed the party has been made. Would you like to reserve entrance to the instance?";
- mes "Instance: ^0000ff"+.@instance_name$+"^000000";
- next;
- switch(select("Generate instance:Enter the instance:Cancel")) {
- case 1:
- // Check the instance timer(1 day)
- if (gettime(4) < test_timer) {//TODO -fix this
- mes "This instance has a 1 day expiration time (in server time).";
- mes "You still have to wait till tomorrow reset.";
- close;
- }
- mes "^0000ff"+.@instance_name$+"^000000 - Reserved";
- mes "Party Name: "+.@party_name$;
- mes "Party Leader: "+strcharinfo(0);
- mes "After making a reservation, you can enter the instance.";
- next;
- .@create = instance_create(.@instance_name$);
- if (.@create < 0) {
- mes "[Instance]";
- switch (.@create) {
- case -1: mes "ERROR: Invalid type."; break;
- case -2: mes "ERROR: Party not found."; break;
- case -3: mes "ERROR: Instance already exists."; break;
- case -4: mes "ERROR: No free instances."; break;
- }
- mes " ";
- mes "Instance creation ^FF0000failed^000000.";
- emotion e_omg;
- }
- close;
- case 2:
- callsub L_Enter,0,1;
- case 3:
- mes "["+strnpcinfo(1)+"]";
- mes "Instance ^0000ff"+.@instance_name$+"^000000 - Removed!";
- instance_destroy();
- close;
- }
- }
- // Party members
- mes "["+strnpcinfo(1)+"]";
- mes "^0000ff"+.@instance_name$+"^000000 - Reserved";
- switch(select("Enter the instance:Cancel")) {
- case 1:
- // Check the instance timer(1 day)
- if (gettime(4) < test_timer) {//TODO -fix this
- mes "This instance has a 1 day expiration time (in server time).";
- mes "You still have to wait till tomorrow reset.";
- close;
- }
- callsub L_Enter,1,1;
- case 2:
- break;
- }
- close;
- L_Enter:
- set test_timer, gettime(4); //Week day (0 for Sunday, 6 is Saturday)
- // Enter instance
- .@enter = instance_enter("Testing instance");
- if (.@enter != 0) {
- mes "["+strnpcinfo(1)+"]";
- switch (.@enter) {
- case 1: mes "ERROR: Party not found."; break;
- case 2: mes "ERROR: Party does not have an instance."; break;
- case 3: mes "ERROR: Unknown error."; break;
- }
- mes " ";
- mes "Instance entry ^FF0000failed^000000.";
- emotion e_omg;
- close;
- }
- if (getarg(0) == 0) close;
- else end;
- P_Enter:
- //TODO -test these
- //warpparty instance_mapname("prt_are01"), 149, 121, getcharid(1);
- if (getcharid(1)) {
- getpartymember(getcharid(1),2);
- set .@partymembercount, $@partymembercount;
- copyarray .@partymemberaid[0], $@partymemberaid[0], .@partymembercount;
- for (set .@i, 0; .@i < .@partymembercount; set .@i, .@i + 1) {
- // Attach party member
- if (attachrid(.@partymemberaid[.@i])) {
- // Check if player is logged in, not vending or chatting (AFK)
- if (isloggedin(getcharid(3),getcharid(0)) && !checkvending() && !checkchatting()) {
- // Enter instance
- instance_enter("Testing instance");
- }
- }
- }
- }
- end;
- }
- // Instance start event NPC
- // - Add job-sprite based sprite id in 'db/mob_avail.txt' with this.
- //============================================================
- prt_are01,150,150,4 script TestEvent#start 106,{
- end;
- mes "["+strnpcinfo(1)+"]";
- mes "Hello, do you wan't to start the event?";
- if (select("Start the event")) {
- donpcevent instance_npcname("TestTimer#1_1")+"::OnEnable";
- message strcharinfo(0),"Event start!";
- close2;
- disablenpc instance_npcname(strnpcinfo(0));
- end;
- }
- close;
- OnInit: // disable NPC on normal map
- disablenpc strnpcinfo(0);
- end;
- OnDisable:
- disablenpc instance_npcname(strnpcinfo(0)); //Disable it self.
- end;
- OnInstanceInit:
- enablenpc instance_npcname(strnpcinfo(0));
- waitingroom "Party - Waiting Room",(1 + 1),instance_npcname(strnpcinfo(0))+"::OnStart",1,0,10,99;
- end;
- OnStart:
- .@speed = 100;
- .@distance = distance(150,150,150,124);
- .@sleep = (.@distance * .@speed); //.@distance * .@time_per_square_in_miliseconds
- kickwaitingroomall instance_npcname(strnpcinfo(0));
- delwaitingroom instance_npcname(strnpcinfo(0));
- mapannounce instance_mapname("prt_are01"),"Event will start. Get ready!",bc_map,"0x7799ff";
- npcspeed .@speed;
- npcwalkto 150,124; //NPC will move to a new position(beware of the blocks in the way)
- sleep .@sleep;
- donpcevent instance_npcname("TestTimer#1_1")+"::OnEnable";
- donpcevent instance_npcname(strnpcinfo(0))+"::OnDisable"; //Disable it self.
- end;
- }
- // Set timers
- prt_are01,0,0,-1 script TestTimer#1_1 -1,{
- end;
- OnInit: // disable NPC on normal map
- disablenpc strnpcinfo(0);
- end;
- OnDisable:
- stopnpctimer;
- disablenpc instance_npcname(strnpcinfo(0)); //Disable it self.
- end;
- OnEnable:
- enablenpc instance_npcname(strnpcinfo(0));
- mapannounce instance_mapname("prt_are01"),"[Event] Starting in 5 seconds.",bc_map,"0x7DCBF0";
- initnpctimer;
- end;
- OnTimer1000:
- mapannounce instance_mapname("prt_are01"),"[Event] 5.",bc_map,"0x7DCBF0";
- end;
- OnTimer2000:
- mapannounce instance_mapname("prt_are01"),"[Event] 4.",bc_map,"0x7DCBF0";
- end;
- OnTimer3000:
- mapannounce instance_mapname("prt_are01"),"[Event] 3.",bc_map,"0x7DCBF0";
- end;
- OnTimer4000:
- mapannounce instance_mapname("prt_are01"),"[Event] 2.",bc_map,"0x7DCBF0";
- end;
- OnTimer5000:
- mapannounce instance_mapname("prt_are01"),"[Event] 1.",bc_map,"0x7DCBF0";
- end;
- OnTimer6000:
- mapannounce instance_mapname("prt_are01"),"[Event] Start!",bc_map,"0x7DCBF0";
- donpcevent instance_npcname("TestSummonMonsters#1_1")+"::OnEnable";
- donpcevent instance_npcname(strnpcinfo(0))+"::OnDisable"; //Disable it self.
- end;
- }
- // Summon normal monsters
- prt_are01,0,0,-1 script TestSummonMonsters#1_1 -1,{
- end;
- OnInit: // disable NPC on normal map
- disablenpc strnpcinfo(0);
- end;
- OnDisable:
- disablenpc instance_npcname(strnpcinfo(0)); //Disable it self.
- end;
- OnEnable:
- enablenpc instance_npcname(strnpcinfo(0));
- .@map$ = instance_mapname("prt_are01");
- .@label$ = instance_npcname(strnpcinfo(0))+"::OnMobDead";
- // Summons
- areamonster .@map$,131,168,144,155,"Marin",1242,5,.@label$; //top-left
- areamonster .@map$,155,167,168,155,"Metaling",1613,5,.@label$; //top-right
- areamonster .@map$,144,155,144,131,"Poporing",1031,5,.@label$; //bottom-left
- areamonster .@map$,155,144,168,131,"Drops",1113,5,.@label$; //bottom-right
- end;
- OnMobDead:
- if (mobcount(instance_mapname("prt_are01"), instance_npcname(strnpcinfo(0))+"::OnMobDead") < 1) {
- mapannounce instance_mapname("prt_are01"),"Boss incomming.....",bc_map,"0xFD3B02";
- donpcevent instance_npcname("TestSummonBoss#1_1")+"::OnEnable";
- donpcevent instance_npcname(strnpcinfo(0))+"::OnDisable"; //Disable it self.
- }
- end;
- }
- // Summon boss
- prt_are01,150,150,-1 script TestSummonBoss#1_1 -1,{
- end;
- OnInit: // disable NPC on normal map
- disablenpc strnpcinfo(0);
- end;
- OnEnable:
- enablenpc instance_npcname(strnpcinfo(0));
- .@map$ = instance_mapname("prt_are01");
- .@label$ = instance_npcname(strnpcinfo(0))+"::OnBossDead";
- specialeffect EF_SUI_EXPLOSION;
- // Summons
- monster .@map$,150,150,"The Boss",1090,1,.@label$; //1502, Pori Pori, Bring it on!
- end;
- OnDisable:
- disablenpc instance_npcname(strnpcinfo(0)); //Disable it self.
- end;
- OnBossDead:
- //specialeffect2 EF_MVP; //This effect will be triggered on the player who dealt the killing blow.
- mapannounce instance_mapname("prt_are01"),"Boss is dead!",bc_map,"0xFD3B02";
- killmonster instance_mapname("prt_are01"),instance_npcname(strnpcinfo(0))+"::OnBossDead"; //Clean up
- // Make party rewarding loop here and disable npc after it.
- if (getcharid(1)) {
- getpartymember(getcharid(1),2);
- set .@partymembercount, $@partymembercount;
- copyarray .@partymemberaid[0], $@partymemberaid[0], .@partymembercount;
- for (set .@i, 0; .@i < .@partymembercount; set .@i, .@i + 1) {
- // Attach party member
- if (attachrid(.@partymemberaid[.@i])) {
- // Check if player is logged in, not vending or chatting
- if (isloggedin(getcharid(3),getcharid(0)) && !checkvending() && !checkchatting()) {
- // Effects
- specialeffect2 EF_MVP;
- // Rewards:
- set #CASHPOINTS, #CASHPOINTS + 5;
- message strcharinfo(0), "+5 Cash Point!";
- // 50% change to get a Carrot! Yumy... For the Powaa!!
- if (rand(100) >= 50) {
- getitem 515,1;
- }
- }
- }
- }
- } else {
- // Solo reward...
- // This is a group event but hey, if party gets removed
- // And yeah you don't get the Carrot this time!
- specialeffect2 EF_MVP;
- set #CASHPOINTS, #CASHPOINTS + 5;
- message strcharinfo(0), "+5 Cash Point!";
- }
- // Enable portal npc at the center of the room.
- donpcevent instance_npcname("#TestPortalOut")+"::OnEnable";
- // Disable it self.
- donpcevent instance_npcname(strnpcinfo(0))+"::OnDisable";
- end;
- }
- // Warp portal out side
- prt_are01,150,150,0 script #TestPortalOut WARPNPC,2,2,{
- end;
- OnInit: // disable NPC on normal map
- disablenpc strnpcinfo(0);
- end;
- OnInstanceInit:
- disablenpc instance_npcname(strnpcinfo(0));
- end;
- OnEnable:
- mapannounce instance_mapname("prt_are01"),"[Portal] The portal to out side will be opening at the center of the room.",bc_map,"0x7799ff";
- initnpctimer;
- end;
- OnDisable:
- stopnpctimer;
- disablenpc instance_npcname(strnpcinfo(0));
- end;
- OnTimer10000:
- mapannounce instance_mapname("prt_are01"),"[Portal] The portal to out side is now open.",bc_map,"0x7799ff";
- enablenpc instance_npcname(strnpcinfo(0));
- stopnpctimer;
- end;
- OnTouch:
- //warp "Save", 0, 0;
- warp "prontera", 156, 167;
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement