Christian [epicRO]
New member
New Event on epicRO - Russian Roulette
I would like to share with you our new event on epicRO. Started with an atcommand, registration with Event Manager NPC and a simple SQL Db for registred Players.
Autostart with Atcommand (e.g. atcommand_event) as gamemaster.
- script atcommand_event -1,{
OnInit:
bindatcmd "event",strnpcinfo(3)+"::OnAtcommand",1;
end;
OnAtcommand:
mes "[Atcommand]";
set $eventgmname$, strcharinfo(0);
mes "Event will start now.";
close2;
detachrid;
set $RRDURCHGANG, $RRDURCHGANG + 1;
set $RRREGISTREDUSER, 0;
set $RRZENYPOT, 0;
set $RRNEXTPLAYER, 0;
query_sql("TRUNCATE TABLE `event_russian_roulette`");
set $russianroulette, 1;
announce "Event Manager: "+$eventgmname$+" wants to play Russian Roulette with you!",bc_all|bc_blue;
announce "Event Manager: Visit me for more informations and register yourself for 1.000 Zeny.",bc_all|bc_blue;
sleep 5000;
announce "Event Manager: Event will start in 5 minutes and runs until the last player standing.",bc_all|bc_blue;
announce "Event Manager: Visit me for more informations and register yourself for 1.000 Zeny.",bc_all|bc_blue;
sleep 60000;
announce "Event Manager: Russian Roulette will start in 4 minutes.",bc_all|bc_blue;
announce "Event Manager: I will use the pistol. You'll have a 1:4 chance to survive.",bc_all|bc_blue;
sleep 60000;
announce "Event Manager: Russian Roulette will start in 3 minutes.",bc_all|bc_blue;
announce "Event Manager: Current Survive-Zenypot is filled with "+$RRZENYPOT+" Zeny.",bc_all|bc_blue;
sleep 60000;
announce "Event Manager: Russian Roulette will start in 2 minutes.",bc_all|bc_blue;
announce "Event Manager: You'll earn at least 1 Loyality Coin (10%) for every survived round.",bc_all|bc_blue;
sleep 60000;
announce "Event Manager: Russian Roulette will start in 60 seconds.",bc_all|bc_blue;
announce "Event Manager: For now we have "+$RRREGISTREDUSER+" registred player.",bc_all|bc_blue;
sleep 60000;
set $russianroulette, 0;
announce "Event Manager: Event starts right now. No more registrations!",bc_all|bc_blue;
announce "Event Manager: "+$RRREGISTREDUSER+" Players. 1:4 Chance. "+$RRZENYPOT+" Zeny.",bc_all|bc_blue;
sleep 10000;
set .color$, "0xFFD842";
query_sql("UPDATE `event_russian_roulette` SET `selected` = 0");
RUNDENBEGINN:
set .color$, "0xFFD842";
set .@nb, query_sql("SELECT count(char_id) from `event_russian_roulette` LIMIT 1", .@playersleft);
if (.@playersleft < 2) goto RRFINISH;
set .round, .round + 1;
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: ROUND "+.round+"! START! "+.@playersleft+" PLAYERS LEFT!", bc_area, .color$);
sleep 2000;
SELECTNEXTPLAYER:
if (.nextcolor == 1) {
set .color$, "0xB5DA91";
set .nextcolor, 0;
}
else {
set .nextcolor, .nextcolor + 1;
set .color$, "0xB2CAE6";
}
set .@nb, query_sql("SELECT count(char_id) from `event_russian_roulette` WHERE selected = 0 LIMIT 1", .playertoselect);
if (.playertoselect == 0) {
query_sql("UPDATE `event_russian_roulette` SET `selected` = 0");
goto RUNDENBEGINN;
}
set .nb, query_sql("SELECT `name`,`char_id`,`account_id` from `event_russian_roulette` WHERE selected = 0 ORDER BY RAND() LIMIT 1", .name$, .charid, .accountid);
query_sql("UPDATE `event_russian_roulette` SET `selected` = 1 WHERE `char_id` = "+.charid+"");
sleep 1000;
set .rand, rand(1,5);
if (.rand == 1) areaannounce("prontera", 125, 240, 155, 200, "Event Manager: Now it's your chance to win or die "+.name$+"!", bc_area, .color$);
if (.rand == 2) areaannounce("prontera", 125, 240, 155, 200, "Event Manager: May Fortuna be with "+.name$+"!", bc_area, .color$);
if (.rand == 3) areaannounce("prontera", 125, 240, 155, 200, "Event Manager: Look what I've got here for ya "+.name$+"!", bc_area, .color$);
if (.rand == 4) areaannounce("prontera", 125, 240, 155, 200, "Event Manager: Pang! Haha~ Don't worry "+.name$+" ... 3 ... 2 ... 1!", bc_area, .color$);
sleep 1000;
set .x, 0;
set .y, 0;
set .toofar, 0;
getmapxy(.map$, .x, .y, UNITTYPE_PC, .name$);
if ((139 - .x) > 20) set .toofar, 1;
if ((226 - .y) > 20) set .toofar, 1;
if (.toofar == 1) {
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: "+.name$+" is too far away. > 20 cells. Dismissed.", bc_area, 0xFF692C);
query_sql("DELETE FROM event_russian_roulette WHERE char_id = "+.charid+"");
charcommand("#die "+.name$+"");
}
if (charid2rid(.charid) == 0) {
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: "+.name$+" is offline. Dismissed.", bc_area, 0xFF692C);
query_sql("DELETE FROM event_russian_roulette WHERE char_id = "+.charid+"");
}
else {
specialeffect(538, AREA, .accountid);
if (rand(1,4) == 4) {
specialeffect(643, AREA, .accountid);
specialeffect(372, AREA, .accountid);
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: "+.name$+" "+.name$+" has been killed! Dismissed.", bc_area, .color$);
charcommand("#die "+.name$+"");
query_sql("DELETE FROM event_russian_roulette WHERE char_id = "+.charid+"");
}
else {
specialeffect(639, AREA, .accountid);
specialeffect(402, AREA, .accountid);
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: "+.name$+" has survived. No hit.", bc_area, .color$);
if (rand(1,100) < 11) {
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: 10%! "+.name$+" has won a Loyality Coin.", bc_area, .color$);
rodex_sendmail(.charid, "Event Manager", "Loyality Coin - Russian Roulette", "Take this as a parts reward.", 0, 29000, 1);
}
}
}
set .@nb, query_sql("SELECT count(char_id) from `event_russian_roulette` LIMIT 1", .@playersleft);
if (.@playersleft < 2) goto RRFINISH;
sleep 2000;
goto SELECTNEXTPLAYER;
RRFINISH:
sleep 5000;
set .nb, query_sql("SELECT `name`,`char_id`,`account_id` from `event_russian_roulette` ORDER BY RAND() LIMIT 1", .name$, .charid, .accountid);
announce "Event Manager: Aaaaand the winner is: "+.name$+"! Congratulations!",bc_all|bc_blue;
announce "Event Manager: "+.name$+" has won "+$RRZENYPOT+" Zeny.",bc_all|bc_blue;
rodex_sendmail(.charid, "Event Manager", "Zeny Russian Roulette", "Take this as your reward.", $RRZENYPOT);
end;
}
You'll need to create following table into your ragnarok database.
CREATE TABLE `event_russian_roulette` (
`unique_id` INT(20) NULL DEFAULT NULL,
`char_id` INT(11) NULL DEFAULT NULL,
`account_id` INT(11) NULL DEFAULT NULL,
`name` VARCHAR(50) NULL DEFAULT NULL,
`selected` INT(11) NULL DEFAULT NULL
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
Registration while Event-Start for the players works well with a NPC located in Prontera.
If you wants to relocate this NPC you should also edit the areaannounce (used because of anti chat flooding).
prontera,139,226,5 script Event Manager 4_F_EDEN_OFFICER,{
set .@name$,"[^FF8000Event Manager^000000]";
if ($russianroulette == 1) {
mes .@name$;
mes "Welcome to the event called Russian Roulette. You can register yourself with a fee of 1.000 Zeny. This Zeny will become the reward of this event. Aditional you can earn 1 Loyality Coin for every survived round.";
next;
mes .@name$;
mes "What is your choice?";
next;
menu "Register me please.",RRREGISTER,"What to do?",RRINFO,"What to win?",RRREWARD;
close;
RRINFO:
mes .@name$;
mes "You have to register yourself within 5 minutes and stay here for a while. After some players have registred we will start the event.";
next;
mes .@name$;
mes "I will load a pistole with 1 bullet. We use a pistol with 9 slots. As you can see your chance is 1:4 to survive.";
next;
RRREWARD:
mes .@name$;
mes "You can win with a 10% chance a Loyality Coin every round you've survived. If you are the last man standing you can also win the sum of registration zeny.";
close;
RRREGISTER:
if ($RRDURCHGANG != getd("$RRDURCHGANG_"+uniqueid$+"")) {
set RRREGISTRED, 0;
setd("$RRREGISTRED_"+uniqueid$+"", 0);
}
mes .@name$;
mes "Do you want to register you as a event player? It will cost you 1.000 Zeny.";
next;
menu "Register",-,"Info?",RRINFO,"Rewards?",RRREWARD;
if (getd("$RRREGISTRED_"+uniqueid$+"") == 1) set RRREGISTRED, 1;
if (RRREGISTRED == 1) {
mes .@name$;
mes "You are already registred. Please wait until the event starts.";
close;
}
if (Zeny < 1000) {
mes .@name$;
mes "You don't have enough zeny my dear.";
close;
}
set Zeny, Zeny - 1000;
dispbottom "You've paid 1.000 Zeny for russian roulette registration.";
set $RRZENYPOT, $RRZENYPOT + 1000;
set RRREGISTRED, 1;
setd("$RRREGISTRED_"+uniqueid$+"", 1);
setd("$RRDURCHGANG_"+uniqueid$+"", $RRDURCHGANG);
set .@nb, query_sql("INSERT INTO `event_russian_roulette` (`unique_id`, `char_id`, `account_id`, `name`) VALUES ('"+uniqueid$+"', '"+getcharid(CHAR_ID_CHAR)+"', '"+getcharid(CHAR_ID_ACCOUNT)+"', '"+strcharinfo(0)+"');", .@ausgabe$);
mes .@name$;
mes "You have been registred. Thank you. The current pot belongs "+$RRZENYPOT+" zeny.";
set .@nb, query_sql("SELECT count(char_id) from `event_russian_roulette` LIMIT 1", $RRREGISTREDUSER);
npctalk "Thank you for your registration "+strcharinfo(0)+". "+$RRREGISTREDUSER+". player.";
next;
mes .@name$;
mes "Now please wait for my announcements. I wish you a lot of luck. The Event will start within the next seconds.";
close;
}
mes .@name$;
mes "No event is running.";
close;
}
Disable uniqueid if you don't use gepard or harmony.
I would like to share with you our new event on epicRO. Started with an atcommand, registration with Event Manager NPC and a simple SQL Db for registred Players.
Autostart with Atcommand (e.g. atcommand_event) as gamemaster.
- script atcommand_event -1,{
OnInit:
bindatcmd "event",strnpcinfo(3)+"::OnAtcommand",1;
end;
OnAtcommand:
mes "[Atcommand]";
set $eventgmname$, strcharinfo(0);
mes "Event will start now.";
close2;
detachrid;
set $RRDURCHGANG, $RRDURCHGANG + 1;
set $RRREGISTREDUSER, 0;
set $RRZENYPOT, 0;
set $RRNEXTPLAYER, 0;
query_sql("TRUNCATE TABLE `event_russian_roulette`");
set $russianroulette, 1;
announce "Event Manager: "+$eventgmname$+" wants to play Russian Roulette with you!",bc_all|bc_blue;
announce "Event Manager: Visit me for more informations and register yourself for 1.000 Zeny.",bc_all|bc_blue;
sleep 5000;
announce "Event Manager: Event will start in 5 minutes and runs until the last player standing.",bc_all|bc_blue;
announce "Event Manager: Visit me for more informations and register yourself for 1.000 Zeny.",bc_all|bc_blue;
sleep 60000;
announce "Event Manager: Russian Roulette will start in 4 minutes.",bc_all|bc_blue;
announce "Event Manager: I will use the pistol. You'll have a 1:4 chance to survive.",bc_all|bc_blue;
sleep 60000;
announce "Event Manager: Russian Roulette will start in 3 minutes.",bc_all|bc_blue;
announce "Event Manager: Current Survive-Zenypot is filled with "+$RRZENYPOT+" Zeny.",bc_all|bc_blue;
sleep 60000;
announce "Event Manager: Russian Roulette will start in 2 minutes.",bc_all|bc_blue;
announce "Event Manager: You'll earn at least 1 Loyality Coin (10%) for every survived round.",bc_all|bc_blue;
sleep 60000;
announce "Event Manager: Russian Roulette will start in 60 seconds.",bc_all|bc_blue;
announce "Event Manager: For now we have "+$RRREGISTREDUSER+" registred player.",bc_all|bc_blue;
sleep 60000;
set $russianroulette, 0;
announce "Event Manager: Event starts right now. No more registrations!",bc_all|bc_blue;
announce "Event Manager: "+$RRREGISTREDUSER+" Players. 1:4 Chance. "+$RRZENYPOT+" Zeny.",bc_all|bc_blue;
sleep 10000;
set .color$, "0xFFD842";
query_sql("UPDATE `event_russian_roulette` SET `selected` = 0");
RUNDENBEGINN:
set .color$, "0xFFD842";
set .@nb, query_sql("SELECT count(char_id) from `event_russian_roulette` LIMIT 1", .@playersleft);
if (.@playersleft < 2) goto RRFINISH;
set .round, .round + 1;
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: ROUND "+.round+"! START! "+.@playersleft+" PLAYERS LEFT!", bc_area, .color$);
sleep 2000;
SELECTNEXTPLAYER:
if (.nextcolor == 1) {
set .color$, "0xB5DA91";
set .nextcolor, 0;
}
else {
set .nextcolor, .nextcolor + 1;
set .color$, "0xB2CAE6";
}
set .@nb, query_sql("SELECT count(char_id) from `event_russian_roulette` WHERE selected = 0 LIMIT 1", .playertoselect);
if (.playertoselect == 0) {
query_sql("UPDATE `event_russian_roulette` SET `selected` = 0");
goto RUNDENBEGINN;
}
set .nb, query_sql("SELECT `name`,`char_id`,`account_id` from `event_russian_roulette` WHERE selected = 0 ORDER BY RAND() LIMIT 1", .name$, .charid, .accountid);
query_sql("UPDATE `event_russian_roulette` SET `selected` = 1 WHERE `char_id` = "+.charid+"");
sleep 1000;
set .rand, rand(1,5);
if (.rand == 1) areaannounce("prontera", 125, 240, 155, 200, "Event Manager: Now it's your chance to win or die "+.name$+"!", bc_area, .color$);
if (.rand == 2) areaannounce("prontera", 125, 240, 155, 200, "Event Manager: May Fortuna be with "+.name$+"!", bc_area, .color$);
if (.rand == 3) areaannounce("prontera", 125, 240, 155, 200, "Event Manager: Look what I've got here for ya "+.name$+"!", bc_area, .color$);
if (.rand == 4) areaannounce("prontera", 125, 240, 155, 200, "Event Manager: Pang! Haha~ Don't worry "+.name$+" ... 3 ... 2 ... 1!", bc_area, .color$);
sleep 1000;
set .x, 0;
set .y, 0;
set .toofar, 0;
getmapxy(.map$, .x, .y, UNITTYPE_PC, .name$);
if ((139 - .x) > 20) set .toofar, 1;
if ((226 - .y) > 20) set .toofar, 1;
if (.toofar == 1) {
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: "+.name$+" is too far away. > 20 cells. Dismissed.", bc_area, 0xFF692C);
query_sql("DELETE FROM event_russian_roulette WHERE char_id = "+.charid+"");
charcommand("#die "+.name$+"");
}
if (charid2rid(.charid) == 0) {
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: "+.name$+" is offline. Dismissed.", bc_area, 0xFF692C);
query_sql("DELETE FROM event_russian_roulette WHERE char_id = "+.charid+"");
}
else {
specialeffect(538, AREA, .accountid);
if (rand(1,4) == 4) {
specialeffect(643, AREA, .accountid);
specialeffect(372, AREA, .accountid);
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: "+.name$+" "+.name$+" has been killed! Dismissed.", bc_area, .color$);
charcommand("#die "+.name$+"");
query_sql("DELETE FROM event_russian_roulette WHERE char_id = "+.charid+"");
}
else {
specialeffect(639, AREA, .accountid);
specialeffect(402, AREA, .accountid);
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: "+.name$+" has survived. No hit.", bc_area, .color$);
if (rand(1,100) < 11) {
areaannounce("prontera", 125, 240, 155, 200, "Event Manager: 10%! "+.name$+" has won a Loyality Coin.", bc_area, .color$);
rodex_sendmail(.charid, "Event Manager", "Loyality Coin - Russian Roulette", "Take this as a parts reward.", 0, 29000, 1);
}
}
}
set .@nb, query_sql("SELECT count(char_id) from `event_russian_roulette` LIMIT 1", .@playersleft);
if (.@playersleft < 2) goto RRFINISH;
sleep 2000;
goto SELECTNEXTPLAYER;
RRFINISH:
sleep 5000;
set .nb, query_sql("SELECT `name`,`char_id`,`account_id` from `event_russian_roulette` ORDER BY RAND() LIMIT 1", .name$, .charid, .accountid);
announce "Event Manager: Aaaaand the winner is: "+.name$+"! Congratulations!",bc_all|bc_blue;
announce "Event Manager: "+.name$+" has won "+$RRZENYPOT+" Zeny.",bc_all|bc_blue;
rodex_sendmail(.charid, "Event Manager", "Zeny Russian Roulette", "Take this as your reward.", $RRZENYPOT);
end;
}
You'll need to create following table into your ragnarok database.
CREATE TABLE `event_russian_roulette` (
`unique_id` INT(20) NULL DEFAULT NULL,
`char_id` INT(11) NULL DEFAULT NULL,
`account_id` INT(11) NULL DEFAULT NULL,
`name` VARCHAR(50) NULL DEFAULT NULL,
`selected` INT(11) NULL DEFAULT NULL
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
Registration while Event-Start for the players works well with a NPC located in Prontera.
If you wants to relocate this NPC you should also edit the areaannounce (used because of anti chat flooding).
prontera,139,226,5 script Event Manager 4_F_EDEN_OFFICER,{
set .@name$,"[^FF8000Event Manager^000000]";
if ($russianroulette == 1) {
mes .@name$;
mes "Welcome to the event called Russian Roulette. You can register yourself with a fee of 1.000 Zeny. This Zeny will become the reward of this event. Aditional you can earn 1 Loyality Coin for every survived round.";
next;
mes .@name$;
mes "What is your choice?";
next;
menu "Register me please.",RRREGISTER,"What to do?",RRINFO,"What to win?",RRREWARD;
close;
RRINFO:
mes .@name$;
mes "You have to register yourself within 5 minutes and stay here for a while. After some players have registred we will start the event.";
next;
mes .@name$;
mes "I will load a pistole with 1 bullet. We use a pistol with 9 slots. As you can see your chance is 1:4 to survive.";
next;
RRREWARD:
mes .@name$;
mes "You can win with a 10% chance a Loyality Coin every round you've survived. If you are the last man standing you can also win the sum of registration zeny.";
close;
RRREGISTER:
if ($RRDURCHGANG != getd("$RRDURCHGANG_"+uniqueid$+"")) {
set RRREGISTRED, 0;
setd("$RRREGISTRED_"+uniqueid$+"", 0);
}
mes .@name$;
mes "Do you want to register you as a event player? It will cost you 1.000 Zeny.";
next;
menu "Register",-,"Info?",RRINFO,"Rewards?",RRREWARD;
if (getd("$RRREGISTRED_"+uniqueid$+"") == 1) set RRREGISTRED, 1;
if (RRREGISTRED == 1) {
mes .@name$;
mes "You are already registred. Please wait until the event starts.";
close;
}
if (Zeny < 1000) {
mes .@name$;
mes "You don't have enough zeny my dear.";
close;
}
set Zeny, Zeny - 1000;
dispbottom "You've paid 1.000 Zeny for russian roulette registration.";
set $RRZENYPOT, $RRZENYPOT + 1000;
set RRREGISTRED, 1;
setd("$RRREGISTRED_"+uniqueid$+"", 1);
setd("$RRDURCHGANG_"+uniqueid$+"", $RRDURCHGANG);
set .@nb, query_sql("INSERT INTO `event_russian_roulette` (`unique_id`, `char_id`, `account_id`, `name`) VALUES ('"+uniqueid$+"', '"+getcharid(CHAR_ID_CHAR)+"', '"+getcharid(CHAR_ID_ACCOUNT)+"', '"+strcharinfo(0)+"');", .@ausgabe$);
mes .@name$;
mes "You have been registred. Thank you. The current pot belongs "+$RRZENYPOT+" zeny.";
set .@nb, query_sql("SELECT count(char_id) from `event_russian_roulette` LIMIT 1", $RRREGISTREDUSER);
npctalk "Thank you for your registration "+strcharinfo(0)+". "+$RRREGISTREDUSER+". player.";
next;
mes .@name$;
mes "Now please wait for my announcements. I wish you a lot of luck. The Event will start within the next seconds.";
close;
}
mes .@name$;
mes "No event is running.";
close;
}
Disable uniqueid if you don't use gepard or harmony.
Last edited by a moderator: