Jump to content
  • 0

npc Warper need party to warp that maps


Yusry

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  57
  • Reputation:   0
  • Joined:  12/13/16
  • Last Seen:  

anyone can help me how

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  1138
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

try this

credits to kurofly

morocc,155,99,4	script	party_dungeon_warper	96,{
	set .@nom$ , "["+strnpcinfo(0)+"]";
	mes .@nom$;
	mes "Hello there, I'm in charge of managing the entrance to "+.dungeon_name$+".";
	next;
	mes .@nom$;
	mes "I can only give access to a party of ^0000ff"+.min_party_size+" players or more^000000.";
	mes "Only the ^0000ffparty leader^000000 can ask for the entrance access.";
	mes "";
	mes "^ff0000It costs "+.amount+" "+getitemname(.item)+" to reserve an access.^000000";
	next;
	mes .@nom$;
	if (.Dungeon) { //someone is in the dungeon
		mes "A group of "+.PlayerCount+" players has currently access to the dungeon";
		mes .AlivePlayerCount+" of them are still alive";
		mes "^0000ff"+.WaitingCount+"^000000 group(s) are waiting for the entrance access.";
	}
	else mes "No one is currently in the dungeon.";
	mes "";
	mes "What do you want to do?";
	getpartymember getcharid(1),1 ; getpartymember getcharid(1),2;
	for ( set .@i , 0 ; .@i < $@partymembercount ; set .@i , .@i + 1 )
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
			set .@count_online , .@count_online + 1;
	set .@DungeonReserved , 0;
	
	for (set .@i , 0 ; .@i < getarraysize(.PartyIDs) ; set .@i , .@i + 1)
		if (getcharid(1) == .PartyIDs[.@i])
			set .@DungeonReserved , 1;
	switch(select("Enter the dungeon:Reserve access:Leave")) { next ; mes .@nom$;

	case 1:
	if (!.@DungeonReserved) { //the dugeon isn't reserved yet
		mes "You didn't reserve access yet.";
		mes "Please reserve access before entering the dungeon.";
		close;
	}
	else if (.PartyIDs[0] != getcharid(1)) { //dungeon reserved but in the waiting room
		mes "You are in the waiting list sir, you cannot enter the dungeon yet.";
		mes "Your position in the waiting list : ^0000ff"+callsub(S_Position,getcharid(1))+"^000000.";
		mes "You will be informed when you can enter the dungeon.";
		close;
	}
	else if (@dungeon == 1) { //player already died in the dungeon
		mes "You already died in the dungeon and so cannot enter it again.";
		close;
	}
	else if (@warped == 1) { //player warped out of the dungeon
		mes "You warped out of the dungeon and so cannot enter it again.";
		close;
	}
	set @warped , 1;
	set .PlayerCount , .@count_online;
	set .EnteredPlayers , .EnteredPlayers + 1 ; set .AlivePlayerCount , .AlivePlayerCount + 1;
	warp .warpzone$,.warpx,.warpy;
	end;
	
	case 2:
	if (.@DungeonReserved) { //has already reserved access
		mes "You already reserved access to the dungeon.";
		mes "Your position in the waiting list : ^0000ff"+callsub (S_Position,getcharid(1))+"^000000.";
		if (callsub (S_Position,getcharid(1))) mes "You will be informed when you can enter the dungeon.";
		close;
	}
	else if (.@count_online < .min_party_size) { //not enough players online or not in a party
		mes "You need a party of "+.min_party_size+" players online to reserve the dungeon.";
		close;
	}
	else if (getpartyleader(getcharid(1),1) != getcharid(3)) { //not party leader
		mes "Only the party leader can reserve access to the dungeon.";
		close;
	}
	else if (getarraysize(.PartyIDs)) { //people already waiting
		setarray .PartyIDs[getarraysize(.PartyIDs)] , getcharid(1);
		mes "You successfully reserved the entrance.";
		mes "Your position in the waiting list : ^0000ff"+callsub (S_Position,getcharid(1))+"^000000.";
		mes "You will be informed when you can enter the dungeon.";
		close;
	}
	if (countitem(.item) < .amount) {
		mes "You don't have "+.amount+" "+getitemname(.item)+".";
		mes "^ff0000It costs "+.amount+" "+getitemname(.item)+" to reserve an access.^000000";
		close;
	}
	delitem .item,.amount;
	set .Dungeon , 1;
	setarray .PartyIDs[0] , getcharid(1);
	mes "^ff0000You can now enter the dungeon.^000000";
	mes "If none of the party members enter the dungeon before "+.delay+" minutes, the dungeon will be automatically closed.";
	initnpctimer ; set .TimeDelay , 0;
	getpartymember getcharid(1), 1;
	getpartymember getcharid(1), 2;
	for ( set .@i , 0 ; .@i < $@partymembercount ; set .@i , .@i + 1 ) {
		if (attachrid($@partymemberaid[.@i])) { set @dungeon , 0 ; set @warped , 0; }
	}
	end;
	
	case 3:
	end;
	}

OnTimer300000:
	set .TimeDelay , 1;
	if (.AlivePlayerCount == 0) callsub S_NextParty;
	end;

S_Position:
	for (set .@i , 0 ; .@i < getarraysize(.PartyIDs) ; set .@i , .@i + 1) if (.PartyIDs[.@i] == getarg(0)) set .@j , .@i;
	return .@j;

S_CheckCount:
	debugmes "checkcount";
	if (.AlivePlayerCount == 0 || (.Delay && .AlivePlayerCount == .EnteredPlayers)) callsub S_NextParty;
	return;

S_NextParty:
	addrid(2,0,.PartyIDs[0]);
	announce "Everyone is dead, you lost access to the dungeon.";
	deletearray .PartyIDs[0],1;
	if (.PartyIDs[0]) {
		detachrid ; addrid(2,0,.PartyIDs[0]);
		announce "Your party can now enter the dungeon.",bc_self;
		announce "Please enter it before a "+.delay+" minutes delay, else you will loose access.",bc_self;
		initnpctimer;
		set .TimeDelay , 0;
	}
	end;
	
OnPCDieEvent:
	getmapxy(.@map$,.@x,.@y,0);
	if (.@map$ == .warpzone$) { set @dungeon , 1 ; set .AlivePlayerCount , .AlivePlayerCount - 1 ; warp .exitzone$,.exitx,.exity ; callsub S_CheckCount; }
	end;
	
OnPCLogoutEvent: //if player logs out in the dungeon, he's counted as dead
	getmapxy(.@map$,.@x,.@y,0);
	if (.@map$ == .warpzone$) { set @dungeon = 1 ; set .AlivePlayerCount , .AlivePlayerCount - 1 ; callsub S_CheckCount; }
	end;

OnPCLoginEvent: //if player logs in in the dungeon, he's warped out of it
	getmapxy(.@map$,.@x,.@y,0);
	if (.@map$ == .warpzone$) warp .exitzone$,.exitx,.exity;
	end;
	
OnInit:
//===============================set this up==========================================
	set .dungeon_name$ , "the Fire dungeon";
	set .item , 671; //item required (gold coin)
	set .amount , 1; //amount required
	set .min_party_size , 1; //minimum amount of players needed to enter the dungeon
	set .delay , 5; //delay after wich dungeon is closed if all the players in it are dead (in minutes)
	set .warpzone$ , "mus_arena01" ; .warpx = 62 ; .warpy = 48; //entrance warp coordinates
	set .exitzone$ , "mus_arena03" ; .exitx = 116 ; .exity = 193; //exit coordinates
//=============================end of user setup======================================
	mapwarp .warpzone$,.exitzone$,.exitx,.exity;
	set .Dungeon , 0 ; set .PlayerCount , 0 ; set .AlivePlayerCount , 0 ; set .WaitingCount , 0;
	setarray .PartyIDs[0],0;
} 

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  57
  • Reputation:   0
  • Joined:  12/13/16
  • Last Seen:  

1 hour ago, Cyro said:

try this

credits to kurofly


morocc,155,99,4	script	party_dungeon_warper	96,{
	set .@nom$ , "["+strnpcinfo(0)+"]";
	mes .@nom$;
	mes "Hello there, I'm in charge of managing the entrance to "+.dungeon_name$+".";
	next;
	mes .@nom$;
	mes "I can only give access to a party of ^0000ff"+.min_party_size+" players or more^000000.";
	mes "Only the ^0000ffparty leader^000000 can ask for the entrance access.";
	mes "";
	mes "^ff0000It costs "+.amount+" "+getitemname(.item)+" to reserve an access.^000000";
	next;
	mes .@nom$;
	if (.Dungeon) { //someone is in the dungeon
		mes "A group of "+.PlayerCount+" players has currently access to the dungeon";
		mes .AlivePlayerCount+" of them are still alive";
		mes "^0000ff"+.WaitingCount+"^000000 group(s) are waiting for the entrance access.";
	}
	else mes "No one is currently in the dungeon.";
	mes "";
	mes "What do you want to do?";
	getpartymember getcharid(1),1 ; getpartymember getcharid(1),2;
	for ( set .@i , 0 ; .@i < $@partymembercount ; set .@i , .@i + 1 )
		if ( isloggedin( $@partymemberaid[.@i], $@partymembercid[.@i] ) )
			set .@count_online , .@count_online + 1;
	set .@DungeonReserved , 0;
	
	for (set .@i , 0 ; .@i < getarraysize(.PartyIDs) ; set .@i , .@i + 1)
		if (getcharid(1) == .PartyIDs[.@i])
			set .@DungeonReserved , 1;
	switch(select("Enter the dungeon:Reserve access:Leave")) { next ; mes .@nom$;

	case 1:
	if (!.@DungeonReserved) { //the dugeon isn't reserved yet
		mes "You didn't reserve access yet.";
		mes "Please reserve access before entering the dungeon.";
		close;
	}
	else if (.PartyIDs[0] != getcharid(1)) { //dungeon reserved but in the waiting room
		mes "You are in the waiting list sir, you cannot enter the dungeon yet.";
		mes "Your position in the waiting list : ^0000ff"+callsub(S_Position,getcharid(1))+"^000000.";
		mes "You will be informed when you can enter the dungeon.";
		close;
	}
	else if (@dungeon == 1) { //player already died in the dungeon
		mes "You already died in the dungeon and so cannot enter it again.";
		close;
	}
	else if (@warped == 1) { //player warped out of the dungeon
		mes "You warped out of the dungeon and so cannot enter it again.";
		close;
	}
	set @warped , 1;
	set .PlayerCount , .@count_online;
	set .EnteredPlayers , .EnteredPlayers + 1 ; set .AlivePlayerCount , .AlivePlayerCount + 1;
	warp .warpzone$,.warpx,.warpy;
	end;
	
	case 2:
	if (.@DungeonReserved) { //has already reserved access
		mes "You already reserved access to the dungeon.";
		mes "Your position in the waiting list : ^0000ff"+callsub (S_Position,getcharid(1))+"^000000.";
		if (callsub (S_Position,getcharid(1))) mes "You will be informed when you can enter the dungeon.";
		close;
	}
	else if (.@count_online < .min_party_size) { //not enough players online or not in a party
		mes "You need a party of "+.min_party_size+" players online to reserve the dungeon.";
		close;
	}
	else if (getpartyleader(getcharid(1),1) != getcharid(3)) { //not party leader
		mes "Only the party leader can reserve access to the dungeon.";
		close;
	}
	else if (getarraysize(.PartyIDs)) { //people already waiting
		setarray .PartyIDs[getarraysize(.PartyIDs)] , getcharid(1);
		mes "You successfully reserved the entrance.";
		mes "Your position in the waiting list : ^0000ff"+callsub (S_Position,getcharid(1))+"^000000.";
		mes "You will be informed when you can enter the dungeon.";
		close;
	}
	if (countitem(.item) < .amount) {
		mes "You don't have "+.amount+" "+getitemname(.item)+".";
		mes "^ff0000It costs "+.amount+" "+getitemname(.item)+" to reserve an access.^000000";
		close;
	}
	delitem .item,.amount;
	set .Dungeon , 1;
	setarray .PartyIDs[0] , getcharid(1);
	mes "^ff0000You can now enter the dungeon.^000000";
	mes "If none of the party members enter the dungeon before "+.delay+" minutes, the dungeon will be automatically closed.";
	initnpctimer ; set .TimeDelay , 0;
	getpartymember getcharid(1), 1;
	getpartymember getcharid(1), 2;
	for ( set .@i , 0 ; .@i < $@partymembercount ; set .@i , .@i + 1 ) {
		if (attachrid($@partymemberaid[.@i])) { set @dungeon , 0 ; set @warped , 0; }
	}
	end;
	
	case 3:
	end;
	}

OnTimer300000:
	set .TimeDelay , 1;
	if (.AlivePlayerCount == 0) callsub S_NextParty;
	end;

S_Position:
	for (set .@i , 0 ; .@i < getarraysize(.PartyIDs) ; set .@i , .@i + 1) if (.PartyIDs[.@i] == getarg(0)) set .@j , .@i;
	return .@j;

S_CheckCount:
	debugmes "checkcount";
	if (.AlivePlayerCount == 0 || (.Delay && .AlivePlayerCount == .EnteredPlayers)) callsub S_NextParty;
	return;

S_NextParty:
	addrid(2,0,.PartyIDs[0]);
	announce "Everyone is dead, you lost access to the dungeon.";
	deletearray .PartyIDs[0],1;
	if (.PartyIDs[0]) {
		detachrid ; addrid(2,0,.PartyIDs[0]);
		announce "Your party can now enter the dungeon.",bc_self;
		announce "Please enter it before a "+.delay+" minutes delay, else you will loose access.",bc_self;
		initnpctimer;
		set .TimeDelay , 0;
	}
	end;
	
OnPCDieEvent:
	getmapxy(.@map$,.@x,.@y,0);
	if (.@map$ == .warpzone$) { set @dungeon , 1 ; set .AlivePlayerCount , .AlivePlayerCount - 1 ; warp .exitzone$,.exitx,.exity ; callsub S_CheckCount; }
	end;
	
OnPCLogoutEvent: //if player logs out in the dungeon, he's counted as dead
	getmapxy(.@map$,.@x,.@y,0);
	if (.@map$ == .warpzone$) { set @dungeon = 1 ; set .AlivePlayerCount , .AlivePlayerCount - 1 ; callsub S_CheckCount; }
	end;

OnPCLoginEvent: //if player logs in in the dungeon, he's warped out of it
	getmapxy(.@map$,.@x,.@y,0);
	if (.@map$ == .warpzone$) warp .exitzone$,.exitx,.exity;
	end;
	
OnInit:
//===============================set this up==========================================
	set .dungeon_name$ , "the Fire dungeon";
	set .item , 671; //item required (gold coin)
	set .amount , 1; //amount required
	set .min_party_size , 1; //minimum amount of players needed to enter the dungeon
	set .delay , 5; //delay after wich dungeon is closed if all the players in it are dead (in minutes)
	set .warpzone$ , "mus_arena01" ; .warpx = 62 ; .warpy = 48; //entrance warp coordinates
	set .exitzone$ , "mus_arena03" ; .exitx = 116 ; .exity = 193; //exit coordinates
//=============================end of user setup======================================
	mapwarp .warpzone$,.exitzone$,.exitx,.exity;
	set .Dungeon , 0 ; set .PlayerCount , 0 ; set .AlivePlayerCount , 0 ; set .WaitingCount , 0;
	setarray .PartyIDs[0],0;
} 

 

its not working?

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...