Jump to content
  • 0
Sign in to follow this  
Helena

Chatroom problem. Can someone convert this to Hercules?

Question

Hello Hercules,

 

I'm using this emulator now, previously rAthena. I had a script that always use to function properly but for some reason it's causing trouble now...

 

The problem is, the ".minplayer2start" no longer functions. The chatroom shows as 1/1, while it actually should be 1/4 (because the NPC doesn't count, of course.)

 

Can someone help me find a working code for this? Thank you.

 

 

-	script	custom_bg#control	-1,{OnInit:	set .minplayer2start, 3; // minimum player to start	setarray .rewarditem,		673, 5, // reward to the winning team		673, 3; // reward to the losing team	set .startingscore, 99; // score at start	set .eventlasting, 100; // event last 100 seconds	end;OnStart:	if ( getwaitingroomstate( 0, "red side" ) < .minplayer2start || getwaitingroomstate( 0, "blue side" ) < .minplayer2start ) end;	set .red, waitingroom2bg( "guild_vs3", 13,50, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead", "red side" );	copyarray .team1aid[.@i], $@arenamembers[.@i], $@arenamembersnum;	set .blue, waitingroom2bg( "guild_vs3", 86,50, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead", "blue side" );	copyarray .team2aid[.@i], $@arenamembers[.@i], $@arenamembersnum;	delwaitingroom "red side";	delwaitingroom "blue side";	bg_warp .red, "guild_vs3", 13,50;	bg_warp .blue, "guild_vs3", 86,50;	set .score[1], .startingscore;	set .score[2], .startingscore;	bg_updatescore "guild_vs3", .score[1], .score[2];	sleep .eventlasting * 1000;	if ( .score[1] == .score[2] )		mapannounce "guild_vs3", "Draw !", 0;	else if ( .score[1] > .score[2] ) {		mapannounce "guild_vs3", "red side wins !", 0;		callsub L_reward, 1, 0;		callsub L_reward, 2, 2;	}	else if ( .score[1] < .score[2] ) {		mapannounce "guild_vs3", "blue side wins !", 0;		callsub L_reward, 2, 0;		callsub L_reward, 1, 2;	}	bg_warp .red, "prontera", 155,182;	bg_warp .blue, "prontera", 158,182;	bg_destroy .red;	bg_destroy .blue;	donpcevent "red side::OnInit";	donpcevent "blue side::OnInit";	end;L_reward:	set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") );	for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 )		if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) )			getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );	return;OnredDead: callsub L_dead, 1;OnblueDead: callsub L_dead, 2;L_dead:	set .score[ getarg(0) ], .score[ getarg(0) ] -1;	bg_updatescore "guild_vs3", .score[1], .score[2];	if ( .score[ getarg(0) ] == 0 )		awake strnpcinfo(0);	end;OnredQuit: callsub L_quit, 1, .red;OnblueQuit: callsub L_quit, 2, .blue;L_quit:	if ( bg_get_data( getarg(1), 0) ) end;	set .score[ getarg(0) ], 0;	awake strnpcinfo(0);	end;} prontera,155,182,5	script	red side	100,{	end;OnInit:	waitingroom "red", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );	end;}prontera,158,182,5	script	blue side	100,{	end;OnInit:	waitingroom "blue", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );	end;}guild_vs3	mapflag	battleground	2guild_vs3	mapflag	nosave	SavePointguild_vs3	mapflag	nowarpguild_vs3	mapflag	nowarptoguild_vs3	mapflag	noteleportguild_vs3	mapflag	nomemoguild_vs3	mapflag	nopenalty

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

This should work (Tested)

-	script	custom_bg#control	-1,{OnInit:    set .minplayer2start, 3; // minimum player to start    setarray .rewarditem,        673, 5, // reward to the winning team        673, 3; // reward to the losing team    set .startingscore, 99; // score at start    set .eventlasting, 100; // event last 100 seconds    donpcevent "blue side::OnStart";    donpcevent "red side::OnStart";    end;OnStart:    if ( getwaitingroomstate( 0, "red side" ) < .minplayer2start || getwaitingroomstate( 0, "blue side" ) < .minplayer2start ) end;    set .red, waitingroom2bg( "guild_vs3", 13,50, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead", "red side" );    copyarray .team1aid[.@i], $@arenamembers[.@i], $@arenamembersnum;    set .blue, waitingroom2bg( "guild_vs3", 86,50, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead", "blue side" );    copyarray .team2aid[.@i], $@arenamembers[.@i], $@arenamembersnum;    delwaitingroom "red side";    delwaitingroom "blue side";    bg_warp .red, "guild_vs3", 13,50;    bg_warp .blue, "guild_vs3", 86,50;    set .score[1], .startingscore;    set .score[2], .startingscore;    bg_updatescore "guild_vs3", .score[1], .score[2];    sleep .eventlasting * 1000;    if ( .score[1] == .score[2] )        mapannounce "guild_vs3", "Draw !", 0;    else if ( .score[1] > .score[2] ) {        mapannounce "guild_vs3", "red side wins !", 0;        callsub L_reward, 1, 0;        callsub L_reward, 2, 2;    }    else if ( .score[1] < .score[2] ) {        mapannounce "guild_vs3", "blue side wins !", 0;        callsub L_reward, 2, 0;        callsub L_reward, 1, 2;    }    bg_warp .red, "prontera", 155,182;    bg_warp .blue, "prontera", 158,182;    bg_destroy .red;    bg_destroy .blue;    donpcevent "red side::OnStart";    donpcevent "blue side::OnStart";    end;L_reward:    set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") );    for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 )        if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) )            getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );    return;OnredDead: callsub L_dead, 1;OnblueDead: callsub L_dead, 2;L_dead:    set .score[ getarg(0) ], .score[ getarg(0) ] -1;    bg_updatescore "guild_vs3", .score[1], .score[2];    if ( .score[ getarg(0) ] == 0 )        awake strnpcinfo(0);    end;OnredQuit: callsub L_quit, 1, .red;OnblueQuit: callsub L_quit, 2, .blue;L_quit:    if ( bg_get_data( getarg(1), 0) ) end;    set .score[ getarg(0) ], 0;    awake strnpcinfo(0);    end;}prontera,158,182,5	script	blue side	100,{    end;OnStart:    waitingroom "blue", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}prontera,155,182,5	script	red side	100,{    end;OnStart:    waitingroom "red", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}guild_vs3    mapflag    battleground    2guild_vs3    mapflag    nosave    SavePointguild_vs3    mapflag    nowarpguild_vs3    mapflag    nowarptoguild_vs3    mapflag    noteleportguild_vs3    mapflag    nomemoguild_vs3    mapflag    nopenalty

Share this post


Link to post
Share on other sites
  • 0

 

This should work (Tested)

-	script	custom_bg#control	-1,{OnInit:    set .minplayer2start, 3; // minimum player to start    setarray .rewarditem,        673, 5, // reward to the winning team        673, 3; // reward to the losing team    set .startingscore, 99; // score at start    set .eventlasting, 100; // event last 100 seconds    donpcevent "blue side::OnStart";    donpcevent "red side::OnStart";    end;OnStart:    if ( getwaitingroomstate( 0, "red side" ) < .minplayer2start || getwaitingroomstate( 0, "blue side" ) < .minplayer2start ) end;    set .red, waitingroom2bg( "guild_vs3", 13,50, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead", "red side" );    copyarray .team1aid[.@i], $@arenamembers[.@i], $@arenamembersnum;    set .blue, waitingroom2bg( "guild_vs3", 86,50, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead", "blue side" );    copyarray .team2aid[.@i], $@arenamembers[.@i], $@arenamembersnum;    delwaitingroom "red side";    delwaitingroom "blue side";    bg_warp .red, "guild_vs3", 13,50;    bg_warp .blue, "guild_vs3", 86,50;    set .score[1], .startingscore;    set .score[2], .startingscore;    bg_updatescore "guild_vs3", .score[1], .score[2];    sleep .eventlasting * 1000;    if ( .score[1] == .score[2] )        mapannounce "guild_vs3", "Draw !", 0;    else if ( .score[1] > .score[2] ) {        mapannounce "guild_vs3", "red side wins !", 0;        callsub L_reward, 1, 0;        callsub L_reward, 2, 2;    }    else if ( .score[1] < .score[2] ) {        mapannounce "guild_vs3", "blue side wins !", 0;        callsub L_reward, 2, 0;        callsub L_reward, 1, 2;    }    bg_warp .red, "prontera", 155,182;    bg_warp .blue, "prontera", 158,182;    bg_destroy .red;    bg_destroy .blue;    donpcevent "red side::OnInit";    donpcevent "blue side::OnInit";    end;L_reward:    set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") );    for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 )        if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) )            getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );    return;OnredDead: callsub L_dead, 1;OnblueDead: callsub L_dead, 2;L_dead:    set .score[ getarg(0) ], .score[ getarg(0) ] -1;    bg_updatescore "guild_vs3", .score[1], .score[2];    if ( .score[ getarg(0) ] == 0 )        awake strnpcinfo(0);    end;OnredQuit: callsub L_quit, 1, .red;OnblueQuit: callsub L_quit, 2, .blue;L_quit:    if ( bg_get_data( getarg(1), 0) ) end;    set .score[ getarg(0) ], 0;    awake strnpcinfo(0);    end;}prontera,158,182,5	script	blue side	100,{    end;OnStart:    waitingroom "blue", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}prontera,155,182,5	script	red side	100,{    end;OnStart:    waitingroom "red", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}guild_vs3    mapflag    battleground    2guild_vs3    mapflag    nosave    SavePointguild_vs3    mapflag    nowarpguild_vs3    mapflag    nowarptoguild_vs3    mapflag    noteleportguild_vs3    mapflag    nomemoguild_vs3    mapflag    nopenalty

 

[Debug]: NPCEvent 'red side::OnInit' not found! (source: custom_bg#control)
[Debug]: NPCEvent 'blue side::OnInit' not found! (source: custom_bg#control)
 
After winning the pub is no longer visible, the red / blue pub from the NPC's

Share this post


Link to post
Share on other sites
  • 0

 

 

This should work (Tested)

-	script	custom_bg#control	-1,{OnInit:    set .minplayer2start, 3; // minimum player to start    setarray .rewarditem,        673, 5, // reward to the winning team        673, 3; // reward to the losing team    set .startingscore, 99; // score at start    set .eventlasting, 100; // event last 100 seconds    donpcevent "blue side::OnStart";    donpcevent "red side::OnStart";    end;OnStart:    if ( getwaitingroomstate( 0, "red side" ) < .minplayer2start || getwaitingroomstate( 0, "blue side" ) < .minplayer2start ) end;    set .red, waitingroom2bg( "guild_vs3", 13,50, strnpcinfo(0)+"::OnredQuit", strnpcinfo(0)+"::OnredDead", "red side" );    copyarray .team1aid[.@i], $@arenamembers[.@i], $@arenamembersnum;    set .blue, waitingroom2bg( "guild_vs3", 86,50, strnpcinfo(0)+"::OnblueQuit", strnpcinfo(0)+"::OnblueDead", "blue side" );    copyarray .team2aid[.@i], $@arenamembers[.@i], $@arenamembersnum;    delwaitingroom "red side";    delwaitingroom "blue side";    bg_warp .red, "guild_vs3", 13,50;    bg_warp .blue, "guild_vs3", 86,50;    set .score[1], .startingscore;    set .score[2], .startingscore;    bg_updatescore "guild_vs3", .score[1], .score[2];    sleep .eventlasting * 1000;    if ( .score[1] == .score[2] )        mapannounce "guild_vs3", "Draw !", 0;    else if ( .score[1] > .score[2] ) {        mapannounce "guild_vs3", "red side wins !", 0;        callsub L_reward, 1, 0;        callsub L_reward, 2, 2;    }    else if ( .score[1] < .score[2] ) {        mapannounce "guild_vs3", "blue side wins !", 0;        callsub L_reward, 2, 0;        callsub L_reward, 1, 2;    }    bg_warp .red, "prontera", 155,182;    bg_warp .blue, "prontera", 158,182;    bg_destroy .red;    bg_destroy .blue;    donpcevent "red side::OnInit";    donpcevent "blue side::OnInit";    end;L_reward:    set .@size, getarraysize( getd(".team"+ getarg(0) +"aid") );    for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 )        if ( isloggedin( getd(".team"+ getarg(0) +"aid["+ .@i +"]" ) ) )            getitem .rewarditem[ getarg(1) ], .rewarditem[ getarg(1) +1 ], getd(".team"+ getarg(0) +"aid["+ .@i +"]" );    return;OnredDead: callsub L_dead, 1;OnblueDead: callsub L_dead, 2;L_dead:    set .score[ getarg(0) ], .score[ getarg(0) ] -1;    bg_updatescore "guild_vs3", .score[1], .score[2];    if ( .score[ getarg(0) ] == 0 )        awake strnpcinfo(0);    end;OnredQuit: callsub L_quit, 1, .red;OnblueQuit: callsub L_quit, 2, .blue;L_quit:    if ( bg_get_data( getarg(1), 0) ) end;    set .score[ getarg(0) ], 0;    awake strnpcinfo(0);    end;}prontera,158,182,5	script	blue side	100,{    end;OnStart:    waitingroom "blue", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}prontera,155,182,5	script	red side	100,{    end;OnStart:    waitingroom "red", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}guild_vs3    mapflag    battleground    2guild_vs3    mapflag    nosave    SavePointguild_vs3    mapflag    nowarpguild_vs3    mapflag    nowarptoguild_vs3    mapflag    noteleportguild_vs3    mapflag    nomemoguild_vs3    mapflag    nopenalty

 

 

 

[Debug]: NPCEvent 'red side::OnInit' not found! (source: custom_bg#control)

[Debug]: NPCEvent 'blue side::OnInit' not found! (source: custom_bg#control)

 

After winning the pub is no longer visible, the red / blue pub from the NPC's

 

 

ops XD its because i only tested on boot, didn't actually play it, takes renaming the oninit in the remaining part to onstart (will edit in my post)

Share this post


Link to post
Share on other sites
  • 0

or add a delay after oninit to let the server initialize .minplayer2start in the main npc

prontera,155,182,5    script    red side    100,{    end;OnInit:    sleep 50;    waitingroom "red", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}prontera,158,182,5    script    blue side    100,{    end;OnInit:    sleep 50;    waitingroom "blue", getvariableofnpc( .minplayer2start, "custom_bg#control" ) +1, "custom_bg#control::OnStart", getvariableofnpc( .minplayer2start, "custom_bg#control" );    end;}

Share this post


Link to post
Share on other sites
  • 0

I was wondering about that too. Haha.

 

Back on topic, another way that strangely enough fixed my problem was changing "set .minplayer2start, 3;" into ".minplayer2start = 3;"

Edited by Helena

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

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