Jump to content
  • 0

Make some changes on this script


myieee

Question


  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  83
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

I have a Monster Hunt Event script and i want some changes here. like if someone die the remaining members of party will warp out automatically and  they have to wait atleast 5minutes to join and finish the event. thanks..

prontera,157,162,5	script	Monster Hunt	105,{
mes "[Monster Hunt]";
if( !.monsterhunt ){
mes "No event for the moment.";
}else if( getmapusers("pvp_n_1-3") ){
mes "There is someone/party inside.";
}else if( !getcharid(1) || getpartyleader(getcharid(1),2) != getcharid(0) ){
mes "You're not a Leader in a Party.";
}else{
getpartymember( getcharid(1) );
set .@PartyCount, $@partymembercount;
if (.@PartyCount == 5) {
mes "Would you like to join?";
menu "Yes",-,"No",M_Exit;
  warpparty "pvp_n_1-3",100,139,getcharid(1);
  end;
}else{
  mes "Dont have enough player/s on your party. You need 5 Members.";
}
}
close;
OnMinute04:
if( rand(100) < 100 ){
announce "Monster hunt is now open! First party of 5 players (all level 255).",0;
killmonsterall "pvp_n_1-3";
monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
set .monsterhunt,1;
}
end;
OnMobKilled:
set .monsterhunt,0;
if( getmapusers("pvp_n_1-3") != 5 ){
announce "Monster Hunt failed by the party <<"+strcharinfo(1)+">>.",bc_all;
warpparty "prontera",156,126,getcharid(1);
goto OnClear;
}else{
getpartymember( getcharid(1),0 );
for( set .@i, 0; .@i < getarraysize($@partymembername$); set .@i, .@i+1 )
  getitem 7227,1,getcharid(3, $@partymembername$[.@i]);
announce "Monster Hunt event finished <<"+strcharinfo(1)+">> ,the monster will be respawn maybe in an hour",bc_all;
}
warpparty "prontera",156,126,getcharid(1);
end;
OnClear:
set .monsterhunt,1;
set .@PartyCount, $@partymembercount;
if (.@PartyCount == 5) {
monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
}
end;
M_Exit:
close;


}
Reply
Report
 
Edited by myieee
Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  83
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

bump

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

You should keep a trace of the party id when warping them, this way you can use the 'OnPCDieEvent' label to know if the player who just died was in that party (use getcharid(1) to retrieve the party id since the player is attached to the script on death).

If the player is indeed in the party doing the event, you jut have to warp the entire party out with the 'warpparty' script command.

 

For the delay part, I'll need a bit more infos:

Do you want to make the party unable to join the event for 5 minutes by forbidding the party id? (which can easily be useless if the players just change their party)

Or do you want to make each player unable to join for 5 minutes? (which will make any party which has an unauthorized player unable to do the event for the remaining time)

Or maybe a mix of those two, like a party can join if the total of each player restrictcion time doesn't go over a certain amount?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  83
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

You should keep a trace of the party id when warping them, this way you can use the 'OnPCDieEvent' label to know if the player who just died was in that party (use getcharid(1) to retrieve the party id since the player is attached to the script on death).

If the player is indeed in the party doing the event, you jut have to warp the entire party out with the 'warpparty' script command.

 

For the delay part, I'll need a bit more infos:

Do you want to make the party unable to join the event for 5 minutes by forbidding the party id? (which can easily be useless if the players just change their party)

Or do you want to make each player unable to join for 5 minutes? (which will make any party which has an unauthorized player unable to do the event for the remaining time)

Or maybe a mix of those two, like a party can join if the total of each player restrictcion time doesn't go over a certain amount?

okay here are the info

 

1st. if someone die in the party. i just need to warp the entire party 

2nd. if someone failed to finish the event. and the party wants to enter again . they have to wait any (party of five) atleast 5mins to join the event 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Sorry I almost forgot you  :unsure:

 

You can try this, I didn't test it so that might not work but I'm sure you'll be able to correct it yourself if you need to.

prontera,157,162,5	script	Monster Hunt	105,{
++		function CheckDelay; // initialise the function
		mes "[Monster Hunt]";
		if( !.monsterhunt ){
		mes "No event for the moment.";
		}else if( getmapusers("pvp_n_1-3") ){
		mes "There is someone/party inside.";
		}else if( !getcharid(1) || getpartyleader(getcharid(1),2) != getcharid(0) ){
		mes "You're not a Leader in a Party.";
		}
++		else if ((.@ticks = CheckDelay(getcharid(1))) > 0) { // one of the player in the party still has a delay
++			mes "You have to wait "+.@ticks+" seconds in order to join the event again.";
++		}
		else{
		getpartymember( getcharid(1) );
		set .@PartyCount, $@partymembercount;
		if (.@PartyCount == 5) {
		mes "Would you like to join?";
		menu "Yes",-,"No",M_Exit;
++		set .PartyId , getcharid(1); // keep trace of the party id in order to warp the party out if someone dies
		warpparty "pvp_n_1-3",100,139,getcharid(1);
		end;
		}else{
		mes "Dont have enough player/s on your party. You need 5 Members.";
		}
		}
		close;
	OnMinute04:
		if( rand(100) < 100 ){
		announce "Monster hunt is now open! First party of 5 players (all level 255).",0;
		killmonsterall "pvp_n_1-3";
		monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
		set .monsterhunt,1;
		}
		end;
	OnMobKilled:
		set .monsterhunt,0;
		if( getmapusers("pvp_n_1-3") != 5 ){
		announce "Monster Hunt failed by the party <<"+strcharinfo(1)+">>.",bc_all;
		warpparty "prontera",156,126,getcharid(1);
		goto OnClear;
		}else{
		getpartymember( getcharid(1),0 );
		for( set .@i, 0; .@i < getarraysize($@partymembername$); set .@i, .@i+1 )
		getitem 7227,1,getcharid(3, $@partymembername$[.@i]);
		announce "Monster Hunt event finished <<"+strcharinfo(1)+">> ,the monster will be respawn maybe in an hour",bc_all;
		}
		warpparty "prontera",156,126,getcharid(1);
		end;
	OnClear:
		set .monsterhunt,1;
		set .@PartyCount, $@partymembercount;
		if (.@PartyCount == 5) {
		monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
		}
		end;
		M_Exit:
		close;
++	OnPCDieEvent: // warps the party out of the event and sets a delay
++		if (getcharid(1) == .PartyId) {
++		announce "Party "+strcharinfo(1)+" has failed the Monster Hunt event!",0;
++		warpparty "<map>",<x>,<y>,getcharid(1); // don't forget to edit this part
++		addrid(2,0,getcharid(1));
++		set MonsterHuntTime , gettimetick(2) + 300; // 5 min delay for every player in the party
++		}
++		end;


++	function	CheckDelay	{ // returns the amount of time the party needs to wait before doing the event again
++		getpartymember getarg(0),2;
++		for (; .@i < $@partymembercount ; .@i++)
++			if (attachrid($@partymemberaid[.@i]))
++				if (MonsterHuntTime > .@time) .@time = MonsterHuntTime;
++		return (.@time - gettimetick(2));
++	}

}
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  83
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

 

Sorry I almost forgot you  :unsure:

 

You can try this, I didn't test it so that might not work but I'm sure you'll be able to correct it yourself if you need to.

prontera,157,162,5	script	Monster Hunt	105,{
++		function CheckDelay; // initialise the function
		mes "[Monster Hunt]";
		if( !.monsterhunt ){
		mes "No event for the moment.";
		}else if( getmapusers("pvp_n_1-3") ){
		mes "There is someone/party inside.";
		}else if( !getcharid(1) || getpartyleader(getcharid(1),2) != getcharid(0) ){
		mes "You're not a Leader in a Party.";
		}
++		else if ((.@ticks = CheckDelay(getcharid(1))) > 0) { // one of the player in the party still has a delay
++			mes "You have to wait "+.@ticks+" seconds in order to join the event again.";
++		}
		else{
		getpartymember( getcharid(1) );
		set .@PartyCount, $@partymembercount;
		if (.@PartyCount == 5) {
		mes "Would you like to join?";
		menu "Yes",-,"No",M_Exit;
++		set .PartyId , getcharid(1); // keep trace of the party id in order to warp the party out if someone dies
		warpparty "pvp_n_1-3",100,139,getcharid(1);
		end;
		}else{
		mes "Dont have enough player/s on your party. You need 5 Members.";
		}
		}
		close;
	OnMinute04:
		if( rand(100) < 100 ){
		announce "Monster hunt is now open! First party of 5 players (all level 255).",0;
		killmonsterall "pvp_n_1-3";
		monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
		set .monsterhunt,1;
		}
		end;
	OnMobKilled:
		set .monsterhunt,0;
		if( getmapusers("pvp_n_1-3") != 5 ){
		announce "Monster Hunt failed by the party <<"+strcharinfo(1)+">>.",bc_all;
		warpparty "prontera",156,126,getcharid(1);
		goto OnClear;
		}else{
		getpartymember( getcharid(1),0 );
		for( set .@i, 0; .@i < getarraysize($@partymembername$); set .@i, .@i+1 )
		getitem 7227,1,getcharid(3, $@partymembername$[.@i]);
		announce "Monster Hunt event finished <<"+strcharinfo(1)+">> ,the monster will be respawn maybe in an hour",bc_all;
		}
		warpparty "prontera",156,126,getcharid(1);
		end;
	OnClear:
		set .monsterhunt,1;
		set .@PartyCount, $@partymembercount;
		if (.@PartyCount == 5) {
		monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
		}
		end;
		M_Exit:
		close;
++	OnPCDieEvent: // warps the party out of the event and sets a delay
++		if (getcharid(1) == .PartyId) {
++		announce "Party "+strcharinfo(1)+" has failed the Monster Hunt event!",0;
++		warpparty "<map>",<x>,<y>,getcharid(1); // don't forget to edit this part
++		addrid(2,0,getcharid(1));
++		set MonsterHuntTime , gettimetick(2) + 300; // 5 min delay for every player in the party
++		}
++		end;


++	function	CheckDelay	{ // returns the amount of time the party needs to wait before doing the event again
++		getpartymember getarg(0),2;
++		for (; .@i < $@partymembercount ; .@i++)
++			if (attachrid($@partymemberaid[.@i]))
++				if (MonsterHuntTime > .@time) .@time = MonsterHuntTime;
++		return (.@time - gettimetick(2));
++	}

}

well i tried to fix it but it still doesnt work. there are some errors in line 11 and 13.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

I just tried it quickly on my server, it seems to work for me. What error do you have?

 

A few things I noticed:

 

I'm not sure if there are some places on the 'pvp_n_1-3' map that you can't access but if there are it would be a good idea to define an area in which the monster spawns so that you don't make it spawn somewhere players can't go ^^

		set .@PartyCount, $@partymembercount;
		if (.@PartyCount == 5) {
		monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
		}

It's a really bad idea to use the '$@partymembercount' variable at this point! If any other script uses the 'getpartymember' command it will overwrite this variable.

Why do you check if the party is still of 5 players before spawning the mob? I'd spawn it anyway since they need to be 5 to enter.

		end;
		M_Exit:
		close;

why? xD, the script will end anyway.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  34
  • Topics Per Day:  0.01
  • Content Count:  83
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

I just tried it quickly on my server, it seems to work for me. What error do you have?

 

A few things I noticed:

 

I'm not sure if there are some places on the 'pvp_n_1-3' map that you can't access but if there are it would be a good idea to define an area in which the monster spawns so that you don't make it spawn somewhere players can't go ^^

		set .@PartyCount, $@partymembercount;
		if (.@PartyCount == 5) {
		monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
		}

It's a really bad idea to use the '$@partymembercount' variable at this point! If any other script uses the 'getpartymember' command it will overwrite this variable.

Why do you check if the party is still of 5 players before spawning the mob? I'd spawn it anyway since they need to be 5 to enter.

		end;
		M_Exit:
		close;

why? xD, the script will end anyway.

i got this error on line 11. parse_simpleexpr: unmatch ')' oh btw im using eathena . 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   31
  • Joined:  07/08/14
  • Last Seen:  

Ahh ok, I'm sorry I never used eathena.

 

I think you already have to edit those parts, can you comment the lines that give you errors so that you can tell me all the errors you have? This way I'll be able to know what needs to be edited.

prontera,157,162,5	script	Monster Hunt	105,{
		function CheckDelay; // initialise the function
++		set .@ticks , CheckDelay(getcharid(1));
		mes "[Monster Hunt]";
		if( !.monsterhunt ){
		mes "No event for the moment.";
		}else if( getmapusers("pvp_n_1-3") ){
		mes "There is someone/party inside.";
		}else if( !getcharid(1) || getpartyleader(getcharid(1),2) != getcharid(0) ){
		mes "You're not a Leader in a Party.";
		}
--		else if ((.@ticks = CheckDelay(getcharid(1))) > 0) { // one of the player in the party still has a delay
++		else if (.@ticks > 0) { // one of the player in the party still has a delay
			mes "You have to wait "+.@ticks+" seconds in order to join the event again.";
		}
		else{
		getpartymember( getcharid(1) );
		set .@PartyCount, $@partymembercount;
		if (.@PartyCount == 5) {
		mes "Would you like to join?";
		menu "Yes",-,"No",M_Exit;
		set .PartyId , getcharid(1); // keep trace of the party id in order to warp the party out if someone dies
		warpparty "pvp_n_1-3",100,139,getcharid(1);
		end;
		}else{
		mes "Dont have enough player/s on your party. You need 5 Members.";
		}
		}
		close;
	OnMinute04:
		if( rand(100) < 100 ){
		announce "Monster hunt is now open! First party of 5 players (all level 255).",0;
		killmonsterall "pvp_n_1-3";
		monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
		set .monsterhunt,1;
		}
		end;
	OnMobKilled:
		set .monsterhunt,0;
		if( getmapusers("pvp_n_1-3") != 5 ){
		announce "Monster Hunt failed by the party <<"+strcharinfo(1)+">>.",bc_all;
		warpparty "prontera",156,126,getcharid(1);
		goto OnClear;
		}else{
		getpartymember( getcharid(1),0 );
		for( set .@i, 0; .@i < getarraysize($@partymembername$); set .@i, .@i+1 )
		getitem 7227,1,getcharid(3, $@partymembername$[.@i]);
		announce "Monster Hunt event finished <<"+strcharinfo(1)+">> ,the monster will be respawn maybe in an hour",bc_all;
		}
		warpparty "prontera",156,126,getcharid(1);
		end;
	OnClear:
		set .monsterhunt,1;
		set .@PartyCount, $@partymembercount;
		if (.@PartyCount == 5) {
		monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1991,1,"Monster Hunt::OnMobKilled";
		}
		end;
		M_Exit:
		close;
	OnPCDieEvent: // warps the party out of the event and sets a delay
		if (getcharid(1) == .PartyId) {
		announce "Party "+strcharinfo(1)+" has failed the Monster Hunt event!",0;
		warpparty "<map>",<x>,<y>,getcharid(1); // don't forget to edit this part
		addrid(2,0,getcharid(1));
		set MonsterHuntTime , gettimetick(2) + 300; // 5 min delay for every player in the party
		}
		end;


	function	CheckDelay	{ // returns the amount of time the party needs to wait before doing the event again
		getpartymember getarg(0),2;
--		for (; .@i < $@partymembercount ; .@i++)
++		for (; .@i < $@partymembercount ; set .@i , .@i + 1)
			if (attachrid($@partymemberaid[.@i]))
--				if (MonsterHuntTime > .@time) .@time = MonsterHuntTime;
++				if (MonsterHuntTime > .@time) set .@time , MonsterHuntTime;
		return (.@time - gettimetick(2));
	}

}

The 'addrid' script command might not be available in eathena, if you have an error with this command can you tell me the name of your sql database so that I can do it using sql queries? Thx

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