prontera,162,190,4 script SampleInstance BG 469,{// Important Variables.@instance$="Instance BG";// Battleground Name.@npcname$="[^FF0000Queue^000000]";// NPC Name.@requiredmembers=2;// Required Members
mes .@npcname$;// Checks if character's current party ID is in an instanceif(instance_id()){
mes "You are already participating on an instance, please make sure to leave the party before queueing.";
close;}// Checks if character is in a partyif(getcharid(1)==0){
mes "You are currently not in a party.";
close;}// Checks if you are the party leaderif(!getcharid(1)|| getcharid(3)!= getpartyleader(getcharid(1),1)){.@targetID= getpartyleader(getcharid(1),1);
mes "Please inform ^FF0000"+rid2name(.@targetID)+"^000000 to queue for the battleground.";
close;}// Checks if NPCMatch is full AND participating the matchif($NPCMatch ==2&&($PartyA == getcharid(1)|| $PartyB == getcharid(1))){
mes "Your match is in progress...";
close;}// Checks if you have less than or more than the amount of members required
getpartymember getcharid(1),0;
getpartymember getcharid(1),1;
getpartymember getcharid(1),2;.@count=[email protected];if(.@count>.@requiredmembers){
mes "You have exceeded the limit of "+.@requiredmembers+" to queue.";
close;}elseif(.@count<.@requiredmembers){
mes "You do not have enough members to queue.";
close;}// If every checks are good, do this.@count=[email protected];
copyarray .@name$[0],[email protected]$[0],[email protected];
copyarray .@cid[0],[email protected][0],[email protected];// list the party member names
mes "Here is the list of participating members:";
mes "^efefff_^000000";for(.@i=0;.@i<.@count;.@i++)
mes (.@i+1)+". ^0000FF"+.@name$[.@i]+"^000000 "+.@cid[.@i];
next;switch(select("Queue for Battleground:Information:Reset Variables:Teleport")){case1:
mes .@npcname$;// Party B Instance Creationif($PartyA ==1){.@instance_id= instance_create(.@instance$,1,.@cid[0]);// Check to see if instance creation failed.if(.@instance_id<0){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;}// Proceed to instance_create
mes "In queue for battleground...";
$PartyB =1;// Occupy the Party B spot globally
$NPCMatch =2;// Makes $NPCMatch = 1, needs one more to queue.
$PartyB1 =.@cid[0];// Makes $PartyB1 the Party Member 1's charID
$PartyB2 =.@cid[1];// Makes $PartyB2 the Party Member 2's charID
$InstanceIDB = instance_id();
close2;
announce "[Queue]: You found a match!",bc_self,"0x00ff99";// Need to find out how to send announce to people in certain character IDs
addtimer 5000, strnpcinfo(3)+"::On5secs";
end;On5secs:// Teleport the people in queue to the designated map
warp $MapName$,7,50,$PartyA1;
warp $MapName$,7,50,$PartyA2;
warp $MapName$,92,50,$PartyB1;
warp $MapName$,92,50,$PartyB2;//donpcevent instance_npcname("BattlegroundEvent")+"::OnInstanceInit";
end;}// Party A Instance Creation.@instance_id= instance_create(.@instance$,1,.@cid[0]);// Check to see if instance creation failed.if(.@instance_id<0){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;}// Proceed to instance_create
mes "In queue for battleground...";
$PartyA =1;// Occupy the Party A spot globally
$NPCMatch =1;// Makes $NPCMatch = 1, needs one more to queue.
$PartyA1 =.@cid[0];// Makes $PartyA1 the Party Member 1's charID
$PartyA2 =.@cid[1];// Makes $PartyA2 the Party Member 2's charID
$InstanceIDA = instance_id();
$MapName$ = instance_mapname("arena", instance_id());
close;case2:// Shows the scripter if variables are working as intended
mes .@npcname$;
mes "$NPCMatch = "+$NPCMatch;
mes "$PartyA = "+$PartyA;
mes "$PartyB = "+$PartyB;
mes "$PartyA1 = "+$PartyA1;
mes "$PartyA2 = "+$PartyA2;
mes "$PartyB1 = "+$PartyB1;
mes "$PartyB2 = "+$PartyB2;
mes "$InstanceIDA = "+$InstanceIDA;
mes "$InstanceIDB = "+$InstanceIDB;
mes "My instance_id() = "+instance_id();
mes "$MapName$ = "+$MapName$;
close;case3:// Resets the global variables
mes .@npcname$;
$NPCMatch =0;
$PartyA =0;
$PartyB =0;
$PartyA1 =0;
$PartyA2 =0;
$PartyB1 =0;
$PartyB2 =0;
instance_destroy instance_id();
$InstanceIDA =0;
$InstanceIDB =0;
$MapName$ =0;//party_destroy(getcharid(1)); // Disbands the party.
mes "$NPCMatch = "+$NPCMatch;
mes "$PartyA = "+$PartyA;
mes "$PartyB = "+$PartyB;
mes "$PartyA1 = "+$PartyA1;
mes "$PartyA2 = "+$PartyA2;
mes "$PartyB1 = "+$PartyB1;
mes "$PartyB2 = "+$PartyB2;
mes "$InstanceIDA = "+$InstanceIDA;
mes "$InstanceIDB = "+$InstanceIDB;
mes "My instance_id() = "+instance_id();
mes "$MapName$ = "+$MapName$;
close;case4:// Force teleport the players in queue.
warp $MapName$,7,50,$PartyA1;
warp $MapName$,7,50,$PartyA2;
warp $MapName$,92,50,$PartyB1;
warp $MapName$,92,50,$PartyB2;
close;}}
So I have this idea of making an instanced PVP, or what you call a battleground lol! The problem that I am facing is this new rewritten function of
What it does is it teleports 150001 to the instance in coordinate of 7,50. So that one works, but if I switch the second formula into this:
instance_enter([email protected]$,92,50,$Party2_Char1,$InstanceID_A); // Given that Party2_Char1 is 150002, and when it made an instance, it's instance_id() becomes 2 *since 1 is already taken by Party1.
What it should do is to teleport 150002 to Instance ID 1, but it's not letting it teleport to that certain instance. How can I make this happen?
Edit:
Attempt #2:
So maybe I thought I could read more about instance_create, and found out that this is the function: instance_create("<instance name>"{,<instance mode>{,<owner id>}});
[Error]: instance_create: party 1 not found for instance 'Babylon Arena'.
so my main question is, how do I attach $PartyB to $PartyA's instanceID so that I can teleport PartyB to PartyA's dungeon map
prontera,156,192,4 script ArenaPVP469,{// Important Variables.@instance$="Babylon Arena";// Battleground Name.@npcname$="[^FF0000Queue for Babylon Arena^000000]";// NPC Name.@requiredmembers=2;// Required Members
mes .@npcname$;// Checks if character's current party ID is in an instance//if (instance_id()) {// mes "You are already participating on an instance, please make sure to leave the party before queueing.";// close;//}// Checks if character is in a partyif(getcharid(1)==0){
mes "You are currently not in a party.";
close;}// Checks if you are the party leaderif(!getcharid(1)|| getcharid(3)!= getpartyleader(getcharid(1),1)){.@targetID= getpartyleader(getcharid(1),1);
mes "Please inform ^FF0000"+rid2name(.@targetID)+"^000000 to queue for the battleground.";
close;}// Checks if NPCMatch is full AND participating the matchif($NPCMatch ==2&&($PartyA == getcharid(1)|| $PartyB == getcharid(1))){
mes "Your match is in progress...";
close;}// Checks if you have less than or more than the amount of members required
getpartymember getcharid(1),0;
getpartymember getcharid(1),1;
getpartymember getcharid(1),2;.@count=[email protected];if(.@count>.@requiredmembers){
mes "You have exceeded the limit of "+.@requiredmembers+" to queue.";
close;}elseif(.@count<.@requiredmembers){
mes "You do not have enough members to queue.";
close;}// If every checks are good, do this.@count=[email protected];
copyarray .@name$[0],[email protected]$[0],[email protected];
copyarray .@cid[0],[email protected][0],[email protected];// list the party member names
mes "Here is the list of participating members:";
mes "^efefff_^000000";for(.@i=0;.@i<.@count;.@i++)
mes (.@i+1)+". ^0000FF"+.@name$[.@i]+"^000000 "+.@cid[.@i];
next;switch(select("Queue for Babylon Arena:Information:Reset Variables:Teleport")){case1:
mes .@npcname$;// Party B Instance Creationif($PartyA ==1){.@instance_id= instance_create(.@instance$);// Check to see if instance creation failed.if(.@instance_id<0){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;}// Proceed to instance_create
mes "In queue for battleground...";
$PartyB =1;// Occupy the Party B spot globally
$NPCMatch =2;// Makes $NPCMatch = 1, needs one more to queue.
$PartyB1 =.@cid[0];// Makes $PartyB1 the Party Member 1's charID
$PartyB2 =.@cid[1];// Makes $PartyB2 the Party Member 2's charID
$InstanceIDB = instance_id();
close2;//instance_enter([email protected]$,7,50,$PartyA1,$InstanceIDA);//instance_enter([email protected]$,7,50,$PartyA2,$InstanceIDA);//instance_enter([email protected]$,92,50,$PartyB1,$InstanceIDA);//instance_enter([email protected]$,92,50,$PartyB2,$InstanceIDA);
end;}// Party A Instance Creation.@instance_id= instance_create(.@instance$);// Check to see if instance creation failed.if(.@instance_id<0){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;}// Proceed to instance_create
mes "In queue for battleground...";
$PartyA =1;// Occupy the Party A spot globally
$NPCMatch =1;// Makes $NPCMatch = 1, needs one more to queue.
$PartyA1 =.@cid[0];// Makes $PartyA1 the Party Member 1's charID
$PartyA2 =.@cid[1];// Makes $PartyA2 the Party Member 2's charID
$InstanceIDA = instance_id();
close;case2:
mes .@npcname$;
mes "$NPCMatch = "+$NPCMatch;
mes "$PartyA = "+$PartyA;
mes "$PartyB = "+$PartyB;
mes "$PartyA1 = "+$PartyA1;
mes "$PartyA2 = "+$PartyA2;
mes "$PartyB1 = "+$PartyB1;
mes "$PartyB2 = "+$PartyB2;
mes "$InstanceIDA = "+$InstanceIDA;
mes "$InstanceIDB = "+$InstanceIDB;
mes "My instance_id() = "+instance_id();
close;case3:
mes .@npcname$;
$NPCMatch =0;
$PartyA =0;
$PartyB =0;
$PartyA1 =0;
$PartyA2 =0;
$PartyB1 =0;
$PartyB2 =0;
instance_destroy instance_id();
$InstanceIDA =0;
$InstanceIDB =0;//party_destroy(getcharid(1)); // Disbands the party.
mes "$NPCMatch = "+$NPCMatch;
mes "$PartyA = "+$PartyA;
mes "$PartyB = "+$PartyB;
mes "$PartyA1 = "+$PartyA1;
mes "$PartyA2 = "+$PartyA2;
mes "$PartyB1 = "+$PartyB1;
mes "$PartyB2 = "+$PartyB2;
mes "$InstanceIDA = "+$InstanceIDA;
mes "$InstanceIDB = "+$InstanceIDB;
mes "My instance_id() = "+instance_id();
close;case4:
instance_enter(.@instance$,7,50,$PartyA1,$InstanceIDA);
instance_enter(.@instance$,7,50,$PartyA2,$InstanceIDA);
instance_enter(.@instance$,92,50,$PartyB1,$InstanceIDA);
instance_enter(.@instance$,92,50,$PartyB2,$InstanceIDA);
close;}}
here is what my NPC Script sample technically is and it's very easy to read. Need help understanding instance_create and instance_enter
edit: i got it working thanks.
heres my solution and sample working BG for a 2v2
So I have this idea of making an instanced PVP, or what you call a battleground lol! The problem that I am facing is this new rewritten function of
instance_enter([email protected]$,7,50,$Party1_Char1,$InstanceID_A);
Sample Variable:
[email protected]$ = "Arena";
$Party1_Char1 = 150001;
$InstanceID_A = 1;
What it does is it teleports 150001 to the instance in coordinate of 7,50. So that one works, but if I switch the second formula into this:
instance_enter([email protected]$,92,50,$Party2_Char1,$InstanceID_A); // Given that Party2_Char1 is 150002, and when it made an instance, it's instance_id() becomes 2 *since 1 is already taken by Party1.
What it should do is to teleport 150002 to Instance ID 1, but it's not letting it teleport to that certain instance. How can I make this happen?
Edit:
Attempt #2:
So maybe I thought I could read more about instance_create, and found out that this is the function: instance_create("<instance name>"{,<instance mode>{,<owner id>}});
so I wrote this down and it still doesnt work
[email protected]_id = instance_create([email protected]$,2,$PartyA);
[Error]: instance_create: party 1 not found for instance 'Babylon Arena'.
so my main question is, how do I attach $PartyB to $PartyA's instanceID so that I can teleport PartyB to PartyA's dungeon map
here is what my NPC Script sample technically is and it's very easy to read. Need help understanding instance_create and instance_enter
Edited by MavisLink to comment
Share on other sites