Jump to content
  • 0
Lord Ganja

Autocreate party using waitingroom? HELP

Question

Hi. I need help with this scripts. I have an event script that is triggered by waitingroomevent..

But what I need is:
        1) autocreate a party when the waitingroom is full
        2) assign a new party leader when the party leader logged out or changed map
 
I also don't know what is party id. And how is it generated. Is it the same as party name but in integer? /hmm  /hmm
Explaining party id will be much appreciated. /thx
 
1)
prontera,150,175,0    script    testparty    521,{
npctalk "You're required to enter the waitingroom.";
end;

OnInit:
waitingroom "test",11,"testparty::OnFull",10;
end;

OnFull:
//THIS ONE WILL AUTOMATICALLY ASSIGN A LEADER BASED FROM THE PLAYERS INSIDE THE WAITINGROOM
party_create "MyParty",getcharid. . . . . .

//THIS ONE WILL ADD THE REMAINING PLAYERS INSIDE THE WAITINGROOM TO THE PARTY
party_addmember <I DONT KNOW WHAT IS PARTY ID>,<character id>;

end;
}
 
2)
OnPCLoadMapEvent:
getmapxy ([email protected]$, [email protected], [email protected], 0);
if( [email protected]$ != "event_map" && getcharid(0) == getpartyleader(<partyid>,2) ){

//THIS ONE WILL AUTO ASSIGN A NEW LEADER FROM THE PARTY
//IF IT FAILS, IT WILL LOOK FOR ANOTHER MEMBER TO TRANSFER THE LEADERSHIP
party_changeleader <partyid>,<character id>;

//THIS ONE WILL DELETE THE PREVIOUS LEADER THAT CHANGED MAP
party_delmember getcharid(0),<party id>;
end;
}

//THIS ONE DELETE THE MEMBER THAT CHANGED MAP
if( [email protected]$ != "event_map" && getpartyname(<party id>) == "MyParty"){
party_delmember getcharid(0),<party id>;
end;
}

OnPCLogoutEvent:
getmapxy ([email protected]$, [email protected], [email protected], 0);
if( [email protected]$ == "event_map" && getcharid(0) == getpartyleader(<partyid>,2) ){

//THIS ONE WILL AUTO ASSIGN A NEW LEADER FROM THE PARTY
//IF IT FAILS, IT WILL LOOK FOR ANOTHER MEMBER TO TRANSFER THE LEADERSHIP
party_changeleader <partyid>,<character id>;

//THIS ONE WILL DELETE THE PREVIOUS LEADER THAT LOGGEDOUT
party_delmember getcharid(0),<party id>;
end;
}

//THIS ONE DELETE THE MEMBER THAT LOGGEDOUT
if( [email protected]$ == "event_map" && getpartyname(<party id>) == "MyParty"){
party_delmember getcharid(0),<party id>;
end;
}


 
 
Link to comment
Share on other sites

12 answers to this question

Recommended Posts

 

Thanks skorm.

 

Anyway I tried it and it successfully created a party, but the last one to enter the waitingroom is not included in the party.

and when the party leader logout or changemap, it doesn't change the party leader.

even for party members, when they logout or changemap, it doesn't kick them from party.

 

prontera,150,175,0	script	testparty	521,{
npctalk "You're required to enter the waitingroom.";
end;

OnInit:
waitingroom "test",11,"testparty::OnFull",3;
end;

OnFull:
	getmapxy [email protected]$, [email protected], [email protected], 1;
	warpwaitingpc [email protected]$, [email protected], [email protected];
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		[email protected]_id = getcharid( 0, [email protected]$ );
		if ( getcharid( 1, [email protected]$ ) > 0 )
			party_delmember( [email protected]_id );
		sleep 100;
		if ( [email protected] == 0 ) {
			while( party_create( "party"+ rand(10000), [email protected]_id ) == -3 );
			[email protected] = 1;
		}
		else if ( [email protected]_create_id )
			party_addmember [email protected]_create_id, [email protected]_id;
	}
	end;
	
OnPCLogoutEvent:
	[email protected] = 1;
OnPCStatCalcEvent:
	if ( strcharinfo(3) == "prontera" && [email protected]
	||   strcharinfo(3) != "prontera" && [email protected]
	||   getcharid(1) == 0 ) end;
	[email protected]_id = getcharid(1);
	if ( getcharid(0) != getpartyleader( [email protected]_id, 2 ) )
		party_delmember();
	else {
		.i = 0;
		if ( instance_check_party([email protected]_id,2) == 0 )
			party_destroy([email protected]_id);
		else {
			addrid( 2, 0, [email protected]_id );
			if( !.i && [email protected]_id ) {
				.i = 1;
				party_changeleader getcharid(1), getcharid(0);
			} else if( [email protected]_id )
				party_delmember();
		}
	}
	end;
}

Remember to set where it says "prontera" to your map.

  • Upvote 1
Link to comment
Share on other sites

@party id:

 

Docs say:

 

[...] If successful, the command returns 1 and sets the global temporary variable
"[email protected]_create_id" to the ID of the party created. [...]

 

so the party_id you've to use is stored in [email protected]_create_id variable.

Link to comment
Share on other sites

@party id:

 

Docs say:

 

[...] If successful, the command returns 1 and sets the global temporary variable

"[email protected]_create_id" to the ID of the party created. [...]

 

so the party_id you've to use is stored in [email protected]_create_id variable.

can you give me an example of this?

Link to comment
Share on other sites

OnFull:
//THIS ONE WILL AUTOMATICALLY ASSIGN A LEADER BASED FROM THE PLAYERS INSIDE THE WAITINGROOM
party_create "MyParty",getcharid. . . . . .

//THIS ONE WILL ADD THE REMAINING PLAYERS INSIDE THE WAITINGROOM TO THE PARTY
party_addmember [email protected]_create_id,<character id>;

That's all o.o

The variable [email protected]_create_id will be set by party_create function. There is nothing else to do to get the party id.

Link to comment
Share on other sites

I get it now. sorry. lol anyway do you have any idea how to create a party using a waitingroom? all players inside the waitingroom will be in party when it is full.

Link to comment
Share on other sites

Try

prontera,150,175,0	script	testparty	521,{
npctalk "You're required to enter the waitingroom.";
end;

OnInit:
waitingroom "test",11,"testparty::OnFull",0;
end;

OnFull:
	getmapxy [email protected]$, [email protected], [email protected],1;
	warpwaitingpc [email protected]$,[email protected],[email protected];
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		[email protected]_id = getcharid( 0,[email protected]$ );
		if ( getcharid( 1,[email protected]$ ) > 0 )
			party_delmember( [email protected]_id );
		if ( [email protected] == 0 ) {
			while( party_create( "party_"+ rand(10000), [email protected]_id ) == -3 );
			[email protected] = 1;
		}
		else if ( [email protected]_create_id && party_addmember( [email protected]_create_id,[email protected]_id ) < 1 ) {
			npctalk "An error occur.";
			end;
		}
	}
	end;
OnPCStatCalcEvent:
OnPCLogoutEvent:
	if ( strcharinfo(3) != "alberta" || getcharid(1) == 0 ) end;
	[email protected]_id = getcharid(1);
	if ( getcharid(0) != getpartyleader( [email protected]_id,2) )
		party_delmember();
	else {
		if ( instance_check_party([email protected]_id,2) == 0 )
			party_destroy([email protected]_id);
		else {
			getpartymember [email protected]_id,1;
			getpartymember [email protected]_id,2;
			for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
				if ( isloggedin( [email protected][[email protected]],[email protected][[email protected]] ) && [email protected][[email protected]] != getcharid(0) ) {
					party_changeleader [email protected]_id,[email protected][.[email protected]];
					party_delmember [email protected][[email protected]],[email protected]_id;
					break;
				}
			}
		}
	}
	end;
}
Link to comment
Share on other sites

 

Try

prontera,150,175,0	script	testparty	521,{
npctalk "You're required to enter the waitingroom.";
end;

OnInit:
waitingroom "test",11,"testparty::OnFull",0;
end;

OnFull:
	getmapxy [email protected]$, [email protected], [email protected],1;
	warpwaitingpc [email protected]$,[email protected],[email protected];
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		[email protected]r_id = getcharid( 0,[email protected]$ );
		if ( getcharid( 1,[email protected]$ ) > 0 )
			party_delmember( [email protected]_id );
		if ( [email protected] == 0 ) {
			while( party_create( "party_"+ rand(10000), [email protected]_id ) == -3 );
			[email protected] = 1;
		}
		else if ( [email protected]_create_id && party_addmember( [email protected]_create_id,[email protected]_id ) < 1 ) {
			npctalk "An error occur.";
			end;
		}
	}
	end;
OnPCStatCalcEvent:
OnPCLogoutEvent:
	if ( strcharinfo(3) != "alberta" || getcharid(1) == 0 ) end;
	[email protected]_id = getcharid(1);
	if ( getcharid(0) != getpartyleader( [email protected]_id,2) )
		party_delmember();
	else {
		if ( instance_check_party([email protected]_id,2) == 0 )
			party_destroy([email protected]_id);
		else {
			getpartymember [email protected]_id,1;
			getpartymember [email protected]_id,2;
			for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
				if ( isloggedin( [email protected][[email protected]],[email protected][[email protected]] ) && [email protected][[email protected]] != getcharid(0) ) {
					party_changeleader [email protected]_id,[email protected][[email protected]];
					party_delmember [email protected][[email protected]],[email protected]_id;
					break;
				}
			}
		}
	}
	end;
}

 

Thanks Capuche! 

anyway, I tried your script, it creates a party but only the partyleader is in the party. the other player inside the waitingroom were not added in the party..

and when a player(which is already in a party) entered the waitingroom, after OnFull is triggered the player only leaves his current party, and not added in the new party.

Link to comment
Share on other sites

prontera,150,175,0	script	testparty	521,{
npctalk "You're required to enter the waitingroom.";
end;

OnInit:
waitingroom "test",11,"testparty::OnFull",10;
end;

OnFull:
	getmapxy [email protected]$, [email protected], [email protected],1;
	warpwaitingpc [email protected]$,[email protected],[email protected];
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		[email protected]_id = getcharid( 0,[email protected]$ );
		if ( getcharid( 1,[email protected]$ ) > 0 )
			party_delmember( [email protected]_id );
		sleep 50;
		if ( [email protected] == 0 ) {
			while( party_create( "party"+ rand(10000), 1 ) == -3 );
			[email protected] = 1;
		}
		else if ( [email protected]_create_id ) {
			party_addmember [email protected]_create_id,[email protected]_id;
			// npctalk "An error occur.";
			end;
		}
	}
	end;
OnPCStatCalcEvent:
OnPCLogoutEvent:
	if ( strcharinfo(3) != "alberta" || getcharid(1) == 0 ) end;
	[email protected]_id = getcharid(1);
	if ( getcharid(0) != getpartyleader( [email protected]_id,2) )
		party_delmember();
	else {
		if ( instance_check_party([email protected]_id,2) == 0 )
			party_destroy([email protected]_id);
		else {
			getpartymember [email protected]_id,1;
			getpartymember [email protected]_id,2;
			for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
				if ( isloggedin( [email protected][[email protected]],[email protected][[email protected]] ) && [email protected][[email protected]] != getcharid(0) ) {
					party_changeleader [email protected]_id,[email protected][[email protected]];
					party_delmember [email protected][[email protected]],[email protected]_id;
					break;
				}
			}
		}
	}
	end;
}

just need a sleep in the script

Link to comment
Share on other sites

prontera,150,175,0	script	testparty	521,{
npctalk "You're required to enter the waitingroom.";
end;

OnInit:
waitingroom "test",11,"testparty::OnFull",10;
end;

OnFull:
	getmapxy [email protected]$, [email protected], [email protected],1;
	warpwaitingpc [email protected]$,[email protected],[email protected];
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		[email protected]_id = getcharid( 0,[email protected]$ );
		if ( getcharid( 1,[email protected]$ ) > 0 )
			party_delmember( [email protected]_id );
		sleep 50;
		if ( [email protected] == 0 ) {
			while( party_create( "party"+ rand(10000), 1 ) == -3 );
			[email protected] = 1;
		}
		else if ( [email protected]_create_id ) {
			party_addmember [email protected]_create_id,[email protected]_id;
			// npctalk "An error occur.";
			end;
		}
	}
	end;
OnPCStatCalcEvent:
OnPCLogoutEvent:
	if ( strcharinfo(3) != "alberta" || getcharid(1) == 0 ) end;
	[email protected]_id = getcharid(1);
	if ( getcharid(0) != getpartyleader( [email protected]_id,2) )
		party_delmember();
	else {
		if ( instance_check_party([email protected]_id,2) == 0 )
			party_destroy([email protected]_id);
		else {
			getpartymember [email protected]_id,1;
			getpartymember [email protected]_id,2;
			for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
				if ( isloggedin( [email protected][[email protected]],[email protected][[email protected]] ) && [email protected][[email protected]] != getcharid(0) ) {
					party_changeleader [email protected]_id,[email protected][[email protected]];
					party_delmember [email protected][[email protected]],[email protected]_id;
					break;
				}
			}
		}
	}
	end;
}

just need a sleep in the script

 

 

Hi Capuche. Sorry for the late response.. anyway I tried this one but i got this:

[Debug]: Source (NPC): testparty at prontera (150,175)

and it doesn't create any party. and does this script autoremake party when there's already an existing party name?  Thanks Capuche!

Link to comment
Share on other sites

 

Hi Capuche. Sorry for the late response.. anyway I tried this one but i got this:

[Debug]: Source (NPC): testparty at prontera (150,175)

and it doesn't create any party. and does this script autoremake party when there's already an existing party name?  Thanks Capuche!

 

 

Replace:

while( party_create( "party"+ rand(10000), 1 ) == -3 );

With:

while( party_create( "party"+ rand(10000), [email protected]_id ) == -3 );

About your other question; yes it does.

Link to comment
Share on other sites

 

 

Hi Capuche. Sorry for the late response.. anyway I tried this one but i got this:

[Debug]: Source (NPC): testparty at prontera (150,175)

and it doesn't create any party. and does this script autoremake party when there's already an existing party name?  Thanks Capuche!

 

 

Replace:

while( party_create( "party"+ rand(10000), 1 ) == -3 );

With:

while( party_create( "party"+ rand(10000), [email protected]_id ) == -3 );

About your other question; yes it does.

 

Thanks skorm.

 

Anyway I tried it and it successfully created a party, but the last one to enter the waitingroom is not included in the party.

and when the party leader logout or changemap, it doesn't change the party leader.

even for party members, when they logout or changemap, it doesn't kick them from party.

Link to comment
Share on other sites

 

 

Thanks skorm.

 

Anyway I tried it and it successfully created a party, but the last one to enter the waitingroom is not included in the party.

and when the party leader logout or changemap, it doesn't change the party leader.

even for party members, when they logout or changemap, it doesn't kick them from party.

 

prontera,150,175,0	script	testparty	521,{
npctalk "You're required to enter the waitingroom.";
end;

OnInit:
waitingroom "test",11,"testparty::OnFull",3;
end;

OnFull:
	getmapxy [email protected]$, [email protected], [email protected], 1;
	warpwaitingpc [email protected]$, [email protected], [email protected];
	for ( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ) {
		[email protected]$ = rid2name([email protected][[email protected]]);
		[email protected]_id = getcharid( 0, [email protected]$ );
		if ( getcharid( 1, [email protected]$ ) > 0 )
			party_delmember( [email protected]_id );
		sleep 100;
		if ( [email protected] == 0 ) {
			while( party_create( "party"+ rand(10000), [email protected]_id ) == -3 );
			[email protected] = 1;
		}
		else if ( [email protected]_create_id )
			party_addmember [email protected]_create_id, [email protected]_id;
	}
	end;
	
OnPCLogoutEvent:
	[email protected] = 1;
OnPCStatCalcEvent:
	if ( strcharinfo(3) == "prontera" && [email protected]
	||   strcharinfo(3) != "prontera" && [email protected]
	||   getcharid(1) == 0 ) end;
	[email protected]_id = getcharid(1);
	if ( getcharid(0) != getpartyleader( [email protected]_id, 2 ) )
		party_delmember();
	else {
		.i = 0;
		if ( instance_check_party([email protected]_id,2) == 0 )
			party_destroy([email protected]_id);
		else {
			addrid( 2, 0, [email protected]_id );
			if( !.i && [email protected]_id ) {
				.i = 1;
				party_changeleader getcharid(1), getcharid(0);
			} else if( [email protected]_id )
				party_delmember();
		}
	}
	end;
}

Remember to set where it says "prontera" to your map.

 

 

Thanks Skorm! This is working perfectly! :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.