It will check if the last of selected item was consumed and do ::OnRestock NPC Event to restock the items to the selected amount. Works very well and without any ms of lag. Thanks to @Dastgir
Fixed and corrected. Works fine on current branch.
How to enable:
Move "restock.c" to "src/plugins" and open "Makefile" with editor. add "restock" to line "MYPLUGINS = "
Move "atcommand_restock.txt" to "npc/custom" and add "npc/custom/atcommand_restock.txt" to your "scripts_custom.
conf" for autostart.Open file "conf/plugins.conf" and add " "restock", " to enable this plugin after you'll restart the map serve
Do "make all" on console. To enable all changes. Enjoy @restock and @restock2
If you want to disable @restock on Castles/WoE just configure your atcommand_restock.txt and do a mapcheck on "OnRestock:" like
getmapxy(.@playermap$, .@playerx, .@playery, UNITTYPE_PC);
if (getmapflag(.@playermap$, "mf_gvg_castle") == 1) {
dispbottom "Atcommand disabled on this map.";
end;
}
restock.c
atcommand_restock.txt
SQL Table:
CREATE TABLE `restock` (
`charid` INT(10) NOT NULL,
`restockid` INT(6) NOT NULL,
`restkq` INT(5) NOT NULL,
`restkf` INT(10) NOT NULL DEFAULT '1'
)
COLLATE='latin1_swedish_ci'
ENGINE=MyISAM
;
It will check if the last of selected item was consumed and do ::OnRestock NPC Event to restock the items to the selected amount. Works very well and without any ms of lag. Thanks to @Dastgir
Fixed and corrected. Works fine on current branch.
How to enable:
Move "restock.c" to "src/plugins" and open "Makefile" with editor. add "restock" to line "MYPLUGINS = "
Move "atcommand_restock.txt" to "npc/custom" and add "npc/custom/atcommand_restock.txt" to your "scripts_custom.
conf" for autostart.Open file "conf/plugins.conf" and add " "restock", " to enable this plugin after you'll restart the map serve
Do "make all" on console. To enable all changes. Enjoy @restock and @restock2
If you want to disable @restock on Castles/WoE just configure your atcommand_restock.txt and do a mapcheck on "OnRestock:" like
getmapxy(.@playermap$, .@playerx, .@playery, UNITTYPE_PC);
if (getmapflag(.@playermap$, "mf_gvg_castle") == 1) {
dispbottom "Atcommand disabled on this map.";
end;
}
restock.c
atcommand_restock.txt
SQL Table:
CREATE TABLE `restock` (
`charid` INT(10) NOT NULL,
`restockid` INT(6) NOT NULL,
`restkq` INT(5) NOT NULL,
`restkf` INT(10) NOT NULL DEFAULT '1'
)
COLLATE='latin1_swedish_ci'
ENGINE=MyISAM
;
if you are using Linux, ignore other files and use only afk.c
Instruction.
1. Download and extract files using 7z or any application that can extract it.
2. extract it in your server directory ex: C:/RO Server/Hercules/
2.1. edit conf/plugins.conf and add costumeitem
3. Your done. you can now try your plugins
if you are using VS2010/VS2009/vs2013 or whatsoever and you are failing to compile because of platform issue.
this is what you need to do.
In Recompiling:
If you are using other MSVS/C
Quote
Note: Recompile if you modify the script.
If you have any questions feel free to drop a comment.
NOTE: You done have to edit your src to add this custom features(Less conflict when you want to update your server). Thanks to Mr. Ind for making this Plugins possible, This Plugins will convert your items to costume(item stats/combos/bonuses will also copied)
for more info on how to to use HPM visit Here
(Tested on Hercules rev. 146**)
Script Release: Costume System
attachrid(.@accountid);
Zeny = Zeny + $RRZENYPOT;
announce "Event Manager: This is your reward. You've won "+$RRZENYPOT+" zeny. Gz.",bc_self,0x00FF00;
detachrid();
Instead of #die you could also use a cleaner way:
unitskilluseid .accountid,"NV_TRICKDEAD",1;
But caution, if you decide to use TRICKDEAD instead, you've to save all players on start into an array and do something like this on event finish.
for (.@i = 0; .i < getarraysize(.@savedcharid); ++.@i) {
unitskilluseid .@savedaccountid,"NV_TRICKDEAD",1;
}
My players does love this mini event. I am acting as a gamemaster with the players as well. So they like to see me dying o.O
L_CUSTOMHELMS:
set .@minid, 2001;
set .@maxid, 2100;
set .@diff, .@maxid - .@minid;
set .@helm_menu$, "";
for ( set .@i, 0; .@i < .@diff; set .@i, .@i +1 ) {
set .@helmnr, .@helmnr + 1;
set .@helm_menu$, .@helm_menu$+" Helm ["+.@helmnr+"]:";
}
set .selected, select(.@helm_menu$) -1;
set CUST_LOOK_HEAD_TOP, getlook(LOOK_HEAD_TOP);
set .@viewid, .@minid + .selected - 1;
mes "You've selected Helm "+.selected+". You can see the style the next 5 seconds.";
close2;
set CUST_PREVIEWVIEW, 1;
setlook(LOOK_HEAD_TOP, .@viewid);
sleep2 5000;
setlook(LOOK_HEAD_TOP, CUST_LOOK_HEAD_TOP);
set CUST_PREVIEWVIEW, 0;
end;
// To prevent Logout to bypass the "preview"
OnPCLoginEvent:
if (CUST_PREVIEWVIEW == 1) {
setlook(LOOK_HEAD_TOP, CUST_LOOK_HEAD_TOP);
set CUST_PREVIEWVIEW, 0;
}
end;
first issue. Change this:
HPExport void plugin_init(void)
to
HPExport void plugin_init(void) {
Change:
addHookPre(clif, clif_parse_BankDeposit, clif_parse_BankDeposit_pre);
to
addHookPre(clif, pBankDeposit, clif_parse_BankDeposit_pre);
Also you may not change make file.
For build plugin need run:
make plugin.pluginname
Example for your plugin:
make plugin.rodex-bank-npc
no, need copy only extrac condition check. And if condition true, just before return, call hookStop().
This call will prevent calling default function and any post hooks. I will show example only with pre hook function, without registration code.
void clif_parse_BankDepositPre(int *fdPtr, struct map_session_data **sdPtr)
{
int fd = *fdPtr;
struct map_session_data *sd = *sdPtr;
if ((pc_cant_act2(sd)) || (sd->state.vending) || (sd->npc_id) || (pc_istrading(sd)) || (sd->chat_id != 0)) {
clif->messagecolor_self(fd, 0xFF0000, "You are not able to deposit while acting.");
hookStop();
return;
}
}
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.