Jump to content
  • 0

[re-work] Script


aguyaguy

Question


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  12/17/11
  • Last Seen:  

i need someone to re-work this script.

if the event is failed . some party needs to finish the event but they need to wait for 10mins so they can go in inside of arena.

prontera,155,255,2 script MonsterHunt 929,{
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) {
warpparty "pvp_n_1-3",100,139,getcharid(1);
end;
}else{
mes "Dont have enough player/s on your party. You need 5 Member.";
}
}
close;
OnMinute:
if( rand(100) < 50 ){
announce "Monster Hunt Event is open.",0;
monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1751,1,"Monster Hunt::OnMobKilled";
set .monsterhunt,1;
}
end;
OnMobKilled:
set .monsterhunt,0;
if( getmapusers("pvp_n_1-3") != 5 ){
announce ""+strcharinfo(1)+" party failed.",bc_all;
}else{
getpartymember( getcharid(1),0 );
for( set .@i, 0; .@i < getarraysize($@partymembername$); set .@i, .@i+1 )
getitem 7227,1,getcharid(3, $@partymembername$[.@i]);
announce ""+strcharinfo(1)+" party killed the monster.",bc_all;
}
warpparty "prontera",0,0,getcharid(1);
end;
}
[/codeBOX]

Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  02/17/12
  • Last Seen:  

Haven't fully tested, but it should basically work...unless I missed out something really important *gulps*

Probably different from what you really wanted, I did make a few modifications but I hope it helps.

prontera,155,255,4	script	MonsterHunt	929,{
mes "[Monster Hunt]";
if ( !.monsterhunt )
	mes "No event for the moment.";
else if(!getcharid(1) || getpartyleader(getcharid(1),2) != getcharid(0))
	mes "You're not a Leader in a Party.";
else if ( getmapusers("pvp_n_1-3") > 0 )
	mes "There is someone/party inside.";
else{
	getpartymember( getcharid(1) );
	set $@CurrentParty, getcharid(1);
	set .@PartyCount, $@partymembercount;
	if (.@PartyCount == 5) // does NOT check for offline members
		warpparty "pvp_n_1-3",100,139,$@CurrentParty;
	else
		mes "Dont have enough player/s on your party. You need 5 Member.";
}
close;

OnInit:
set .mh_timer, rand(1,59);	// random between 1-59 minutes
sleep2 (.mh_timer*60000); 	// 60000 == 1 minute

OnEventStart:
if (.monsterhunt == 1) end;
announce "Monster Hunt Event is open.",0;
monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1751,1,"MonsterHunt::OnMobKilled";
set .monsterhunt,1;
end;

OnMobKilled:
if( getmapusers("pvp_n_1-3") != 5 )
	announce strcharinfo(1)+"'s party failed the Monster Hunt Event.",bc_all;
else{
	getpartymember($@CurrentParty);
	set .@PartyCount, $@partymembercount;
	copyarray .@PartyMemberName$, $@partymembername$, .@PartyCount;

	for( set .@i, 0; .@i < .@PartyCount; set .@i, .@i+1 )
		getitem 7227,1,getcharid(3,.@PartyMemberName$[.@i]);

	announce ""+strcharinfo(0)+" party killed the monster.",bc_all;
}
warpparty "prontera",0,0,$@CurrentParty;
goto OnClear;
end;

OnPCDieEvent:
if (getcharid(1) == $@CurrentParty && $@CurrentParty != 0 && strcharinfo(3) == "pvp_n_1-3") {
	sleep2 500;
	warp "prontera",0,0;
	percentheal 100,100;
	sleep2 1000;

	if (getmapusers("pvp_n_1-3") == 0) {
		announce strcharinfo(0)+"'s party failed the Monster Hunt Event.",bc_all;
		goto OnClear;	
	}
}
end;

OnClear:
set .monsterhunt, 0;
set $@CurrentParty, 0;
sleep2 600000; //sleep 10 minutes
goto OnInit;
end;
}

Few things I would question, such as if one of the party members died, why would you only announce the party failed AFTER killing the mob.

But I'll leave that to you. Cheers =)

EDIT: Oh, I didn't realize that you posted in the Scripting Support prior to this one. This event goes on by time, not by (50%) chance, but I'm sure you can sort that out.

Well then I guess you can come up with something better by merging both scripts. Good luck! =)

Edited by deltadestiny
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  12/17/11
  • Last Seen:  

your script is working , and i tested the script . if the party is failed . the monster is dead and the 10mins they can join isnt working . so they need to wait for an hour to join on that event

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  02/17/12
  • Last Seen:  

Uh sorry, I didn't get you. When you say the party failed, do you mean one or all of the members died?

And yeah, the event runs after a gap of random time (1-59 minutes).

Before I make the next modification, can I get a few more clarifications?

1. Do you have the PvP/GvG mapflag on for this map? If you do, dying will transport you out of that map instantly, which causes the team to fail even if they kill the mob.

2. If ONE party member dies, and the others manage to KILL the mob, is the team considered successful or a failure?

3. After the killing of the mob, should there be a cooldown period before the next mob is spawned? If so, how long?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  12/17/11
  • Last Seen:  

1. Do you have the PvP/GvG mapflag on for this map? If you do, dying will transport you out of that map instantly, which causes the team to fail even if they kill the mob.

yes its a gvgon . if someone die the event will be failed . because of the monster or getting dc'ed

2. If ONE party member dies, and the others manage to KILL the mob, is the team considered successful or a failure?

they will be failed because they did not finish the event . they need to wait for 10mins so they can join again because in my server i have like 4-5 parties battling on that event. so 1st come 1st serve. its like they need to spam the npc !

3. After the killing of the mob, should there be a cooldown period before the next mob is spawned? If so, how long?

well if they killed the mob with 5 players in a party - they will success and wait for another event . but if they failed the mob will be stay in that map and wait for 10mins so they are able to finish again .

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  02/17/12
  • Last Seen:  

Sorry, a newbie like me need some time to figure things out =P

I assume that the party will not be warped out even if one of the members die during the event.

- Added 50% chance of event running

- Added offline member check (please test this)

prontera,155,255,4	script	MonsterHunt	929,{
mes "[Monster Hunt]";
if ( !.monsterhunt )
	mes "No event for the moment.";
else if(!getcharid(1) || getpartyleader(getcharid(1),2) != getcharid(0))
	mes "You're not a Leader in a Party.";
else if ( getmapusers("pvp_n_1-3") > 0 )
	mes "There is someone/party inside.";
else{
	getpartymember( getcharid(1) );
	set $@CurrentParty, getcharid(1);
	set $@PartyCount, $@partymembercount;
	copyarray $@CurrPtMemberName$, $@partymembername$, $@PartyCount;

	if ($@PartyCount == 5)
		warpparty "pvp_n_1-3",100,139,$@CurrentParty;
	else
		mes "Dont have enough player/s on your party. You need 5 Members.";

	for (set .@i, 0; .@i < $@PartyCount; set .@i, .@i+1) {
		if(!isloggedin(getcharid(3, $@CurrPtMemberName$[.@i]))) {
			mes "Some party members are not online.";
			mes "Come back with everyone.";
			close;
		}
	}
}
close;

OnInit:
if (.monsterhunt == 0) { // i think this is not necessary, but i didnt test without it
	set .@MHchance, rand(10);
	if (.@MHchance > 4) goto OnEventStart;
	else {
		//announce "Chance was..."+.@MHchance,0; // debugging purpose
		announce "The Monster Hunt event is offline at the moment. Wait for the next announcement.",0;
		sleep 600000;
		goto OnInit;
	}
}
end;


OnEventStart:
announce "Monster Hunt Event is open.",0;
if (mobcount("pvp_n_1-3.gat","MonsterHunt::OnMobKilled") == 0) // EDIT#1
	monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1751,1,"MonsterHunt::OnMobKilled";
monster "pvp_n_1-3.gat",0,0,"RAIDEVENT",1751,1,"MonsterHunt::OnMobKilled";
set .monsterhunt,1;
end;

OnMobKilled:
if( getmapusers("pvp_n_1-3") != 5 )
	announce strcharinfo(1)+"'s party failed the Monster Hunt Event.",bc_all;
else{

	for( set .@i, 0; .@i < $@PartyCount; set .@i, .@i+1 )
		getitem 7227,1,getcharid(3,$@CurrPtMemberName$[.@i]);

	announce strcharinfo(0)+"'s party killed the monster with everyone present.",bc_all;
}
warpparty "prontera",0,0,$@CurrentParty;
goto OnClear;
end;

OnPCDieEvent:
if (getcharid(1) == $@CurrentParty && $@CurrentParty != 0 && strcharinfo(3) == "pvp_n_1-3") {
	sleep2 500;
	warp "prontera",154,255; // you may cancel this out
	percentheal 100,100;
	sleep2 1000;

	if (getmapusers("pvp_n_1-3") == 0) {
		announce strcharinfo(0)+"'s party failed the Monster Hunt Event.",bc_all;
		goto OnClear;	
	}
}
end;

OnClear:
set .monsterhunt, 0;
set $@CurrentParty, 0;
sleep2 600000; // 10 minutes waiting time until the next event
goto OnInit;
end;
}

Again, I did not test this 100% as I am working on two scripts simultaneously. Do let me know if there's anything not to your liking or if there's a bug in there.

EDIT#1:

- Located under OnStartEvent

- Precaution check for existing mob so that only 1 mob exists at a time

Edited by deltadestiny
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  12/17/11
  • Last Seen:  

this is what i've got

[Error]: script:op_2: invalid data for operator C_EQ

[Debug]: Data: string value="MonsterHunt::OnMobKilled"

[Debug]: Data: number value=0

[Debug]: Source <NPC>: MonsterHunt at prontera <155,255>

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  02/17/12
  • Last Seen:  

Oops, sorry!

Change

if (mobcount("pvp_n_1-3.gat","MonsterHunt::OnMobKilled" == 0 ))

to

if (mobcount("pvp_n_1-3.gat","MonsterHunt::OnMobKilled") == 0)

EDIT: Going to bed for now, will drop by again tomorrow. Good luck with the script!

Edited by deltadestiny
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  26
  • Reputation:   0
  • Joined:  12/17/11
  • Last Seen:  

your script is working but it says The monster hunt event is offline at the moment , wait for the next announcement ..well what i need is if they join and they failed . they can join in the next 10mins ! :(

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  02/17/12
  • Last Seen:  

Sir you are confusing me =(

if the event is failed . some party needs to finish the event but they need to wait for 10mins so they can go in inside of arena.
... they need to wait for 10mins so they can join again because in my server i have like 4-5 parties battling on that event. so 1st come 1st serve. its like they need to spam the npc !

I thought your 'some' and 'they' means ANY party can go in after 10 minutes?

So now if the party fails the event (by any means), you don't want the 50% chance to be implemented? Instead you want them[1] to be ABLE to join in again after 10 minutes (100% event runs)? And when you say 'them[1]', are you referring to the previous party who failed the event, or do all other parties now stand a chance to participate?

well if they killed the mob with 5 players in a party - they will success and wait for another event . but if they failed the mob will be stay in that map and wait for 10mins so they are able to finish again.

WHEN is the next event?

WHO are 'they'? As asked above, the party that failed the event, or ALL other parties?

What if one of the current party members died, and the rest killed the mob? The event is considered a failure, right? What will you do after the 10 minutes cooldown? Spawn the mob again?

This may lead to abuse by the current party.

Consider these scenarios, words in bold require your clarification.

Party1 join event > all party members died > event fail > wait 10 minutes > can other parties join now, or only Party1 can enter?

Party1 join event > 1 party member died > others kill the mob > event fail > wait 10 minutes > what happens next?

Party1 join event > event successful > how long until the next event?

I apologize for not understanding you fully, but the lack of information made me assume things which doesn't seem to fit your criteria.

Anyway, just clear those things up for me and I'll write the script for you =)

Edited by deltadestiny
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...