-
Content Count
363 -
Joined
-
Days Won
46
Reputation Activity
-
meko got a reaction from Echoes in Recent changes to the Hercules engine
It seems there's been no changelog since quite a while so here's one highlighting the most recent changes related to scripting. Sorry if that's not the right category, please move accordingly. New script commands: chr ord gettimer getunits getvariableofpc can_use_command has_permission addchannelhandler removechannelhandler setunitdata getunitdata getunitname setunitname getequipisenableopt getequippedoptioninfo getequipoptioninfo setequipoption navigateto Modified script commands (extra parameters): strcharinfo strnpcinfo addtimer deltimer addtimercount checkoption checkoption1 checkoption2 setoption warpparty warpguild classchange New params: BankVault
Big projects currently in development:
Implementation of the official Clan system Implementation of the official RoDEX system Implementation of the official Achievements system Complete rewrite of the map cache system -
meko got a reaction from Like it~* in Recent changes to the Hercules engine
It seems there's been no changelog since quite a while so here's one highlighting the most recent changes related to scripting. Sorry if that's not the right category, please move accordingly. New script commands: chr ord gettimer getunits getvariableofpc can_use_command has_permission addchannelhandler removechannelhandler setunitdata getunitdata getunitname setunitname getequipisenableopt getequippedoptioninfo getequipoptioninfo setequipoption navigateto Modified script commands (extra parameters): strcharinfo strnpcinfo addtimer deltimer addtimercount checkoption checkoption1 checkoption2 setoption warpparty warpguild classchange New params: BankVault
Big projects currently in development:
Implementation of the official Clan system Implementation of the official RoDEX system Implementation of the official Achievements system Complete rewrite of the map cache system -
meko got a reaction from Legend in Recent changes to the Hercules engine
It seems there's been no changelog since quite a while so here's one highlighting the most recent changes related to scripting. Sorry if that's not the right category, please move accordingly. New script commands: chr ord gettimer getunits getvariableofpc can_use_command has_permission addchannelhandler removechannelhandler setunitdata getunitdata getunitname setunitname getequipisenableopt getequippedoptioninfo getequipoptioninfo setequipoption navigateto Modified script commands (extra parameters): strcharinfo strnpcinfo addtimer deltimer addtimercount checkoption checkoption1 checkoption2 setoption warpparty warpguild classchange New params: BankVault
Big projects currently in development:
Implementation of the official Clan system Implementation of the official RoDEX system Implementation of the official Achievements system Complete rewrite of the map cache system -
meko got a reaction from bWolfie in Recent changes to the Hercules engine
It seems there's been no changelog since quite a while so here's one highlighting the most recent changes related to scripting. Sorry if that's not the right category, please move accordingly. New script commands: chr ord gettimer getunits getvariableofpc can_use_command has_permission addchannelhandler removechannelhandler setunitdata getunitdata getunitname setunitname getequipisenableopt getequippedoptioninfo getequipoptioninfo setequipoption navigateto Modified script commands (extra parameters): strcharinfo strnpcinfo addtimer deltimer addtimercount checkoption checkoption1 checkoption2 setoption warpparty warpguild classchange New params: BankVault
Big projects currently in development:
Implementation of the official Clan system Implementation of the official RoDEX system Implementation of the official Achievements system Complete rewrite of the map cache system -
meko got a reaction from tedexx in Recent changes to the Hercules engine
It seems there's been no changelog since quite a while so here's one highlighting the most recent changes related to scripting. Sorry if that's not the right category, please move accordingly. New script commands: chr ord gettimer getunits getvariableofpc can_use_command has_permission addchannelhandler removechannelhandler setunitdata getunitdata getunitname setunitname getequipisenableopt getequippedoptioninfo getequipoptioninfo setequipoption navigateto Modified script commands (extra parameters): strcharinfo strnpcinfo addtimer deltimer addtimercount checkoption checkoption1 checkoption2 setoption warpparty warpguild classchange New params: BankVault
Big projects currently in development:
Implementation of the official Clan system Implementation of the official RoDEX system Implementation of the official Achievements system Complete rewrite of the map cache system -
meko got a reaction from Like it~* in Script that runs a custom monster for testing.
First of all, I would encourage you to read the whole documentation to understand how the herc language works. If you still have problems then, here's something that could help you get started:
<map>,<x>,<y>,<dir> script <name> <sprite>,{ // YOUR INPUT FUNCTIONS GO HERE function input_mob_id { do { mes("Please enter the desired mob ID."); input(.@id, 1001, 10000); } while(getmonsterinfo(.@id, MOB_LV) < 0); // ^ the above will keep asking the player over and over until // they enter the ID of a monster that exists next(); return .@id; } function input_mob_agi { mes("Please enter the desired AGI."); input(.@agi, 1, 99); // ^ the above will ask the player once, but cap the value next(); return .@agi; } // YOUR MAIN SCRIPT GOES HERE do { mes("Hi there, please enter the desired values."); // print a message next(); // require the player to click "next" .@mobID = input_mob_id(); // call the mob id menu, store the value .@mobAGI = input_mob_agi(); // call the mob AGI menu, store the value // ^ HERE ADD MORE CALLS AS NEEDED mes("Do you wish to proceed?"); // print a message select("Start over.", "Proceed."); // ask the player if they wish to continue } while (@menu != 2); mes("Please close the dialog to continue."); close2(); // require the player to close the dialog // HERE SPAWN YOUR MONSTER .@unitID = monster("<map name>", <x>, <y>, getmonsterinfo(.@mobID, MOB_NAME), .@mobID, 1); // MAKE SURE TO CHANGE THE map, x and y // NOW MANIPULATE THE MONSTER WITH THE DATA YOU GATHERED setunitdata(.@unitID, UDT_AGI, .@mobAGI); end; // terminate the script } -
meko got a reaction from tedexx in Random item with chance request
here, I made this for you:
<map>,<x>,<y>,<dir> script <name> <sprite>,{ mes("Hi there."); mes("Can I help you?"); next(); select("claim reward"); mes("..."); next(); for (.@i = 0; .@i < .reward_len; .@i += 3) { if (rand(100) < .reward[.@i + 2]) { getitem(.reward[.@i], .reward[.@i + 1]); mesf("You obtained %i %s.", .reward[.@i + 1], getitemname(.reward[.@i])); .@reward = true; // got at least one reward next(); } } if (.@reward != true) { mes("It seems you're out of luck."); next(); } mes("Come back anytime!"); close; OnInit: setarray(.reward[0], //ID,QTY,% 607, 5, 50, 608, 6, 52, 678, 4, 50, 672, 1, 2); .reward_len = getarraysize(.reward); }
hope it helps
UPDATE: added reward_len (sorry, forgot that)
-
meko reacted to Asheraf in [How To Add] Always show emotion npc
This is could be done using 2 script commands showevent() or questinfo() for more informations you can check the commands documentation https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt#L8976-L9017
-
meko got a reaction from raPalooza~ in little known fact about getarg()
When a function is invoked, the arguments are pushed to the stack, but if an argument is a scope variable its reference is also pushed. This means you can access variables of the parent scope from within a function.
function do_something { setarray(getarg(0), 69, 42, 1337); return; } debugmes(.@var[0]); // <= 0 debugmes(.@var[1]); // <= 0 debugmes(.@var[2]); // <= 0 do_something(.@var[0]); debugmes(.@var[0]); // <= 69 debugmes(.@var[1]); // <= 42 debugmes(.@var[2]); // <= 1337
-
meko got a reaction from Ehwaz in little known fact about getarg()
When a function is invoked, the arguments are pushed to the stack, but if an argument is a scope variable its reference is also pushed. This means you can access variables of the parent scope from within a function.
function do_something { setarray(getarg(0), 69, 42, 1337); return; } debugmes(.@var[0]); // <= 0 debugmes(.@var[1]); // <= 0 debugmes(.@var[2]); // <= 0 do_something(.@var[0]); debugmes(.@var[0]); // <= 69 debugmes(.@var[1]); // <= 42 debugmes(.@var[2]); // <= 1337
-
meko got a reaction from Legend in little known fact about getarg()
When a function is invoked, the arguments are pushed to the stack, but if an argument is a scope variable its reference is also pushed. This means you can access variables of the parent scope from within a function.
function do_something { setarray(getarg(0), 69, 42, 1337); return; } debugmes(.@var[0]); // <= 0 debugmes(.@var[1]); // <= 0 debugmes(.@var[2]); // <= 0 do_something(.@var[0]); debugmes(.@var[0]); // <= 69 debugmes(.@var[1]); // <= 42 debugmes(.@var[2]); // <= 1337
-
meko got a reaction from Legend in Needs testing: bank vault (#1717)
EDIT: this PR was merged
I need someone to test a certain pull request on the official ragnarok client (is it called Gravity?).
See https://github.com/HerculesWS/Hercules/pull/1717
What needs testing: manipulating the vault from script while the bank window is open and checking if it updates the window accordingly.
Thanks for your time
-
meko got a reaction from Legend in Making Square as Basilica
the x1,y1,x2,y2 is the square area composed of the coordinates of the top-left tile and the bottom-right tile
Let's imagine a grid of x,y coordinates:
0,0 0,1 0,2 0,3 0,4
1,0 1,1 1,2 1,3 1,4
2,0 2,1 2,2 2,3 2,4
3,0 3,1 3,2 3,3 3,4
4,0 4,1 4,2 4,3 4,4
Let's say you want the coordinates in red to be basilica;
The top-left red tile is 1,1 in this case. This would be your x1,y1.
The bottom-right tile is 3,3. This would be your x2,y2
so you'd write setcell("map", 1,1, 3,3, cell_basilica, true)
If you do not know the coordinates you can simply walk to it with your character and use the @where command
-
meko got a reaction from Legend in Help with npc of invasion
on line 22 just change "poring" to whatever name you want
same goes for "INVASION BOSS" on line 34
see https://github.com/HerculesWS/Hercules/blob/master/doc/script_commands.txt#L6072
-
meko got a reaction from Legend in PvP Ranking! - Request
here's a rough draft (not tested)
- script PvP Ranking FAKE_NPC,{ OnPCKillEvent: pvp_rank[.this_week] += 3; // raise our own pvp rank dispbottom("You gain 3 points on PvP Rank"); attachrid(killedrid); pvp_rank[.this_week] = max(0, pvp_rank[.this_week] - 3); // decrease their pvp rank dispbottom("You received -3 points penalty on PvP Rank"); end; OnPCLoginEvent: OnClaimReward: .@char = getcharid(CHAR_ID_CHAR); if ($pending_badges[.@char] < 1) { end; } pvp_rank[$last_week] = 0; dispbottom(sprintf("PvP Rank: you obtained %i points this week, putting you at rank %i.", $pending_points[.@char], $pending_rank[.@char] + 1)); dispbottom(sprintf("Reward: %i badges.", $pending_badges[.@char])); getitem(Rok_Star_Badge, $pending_badges[.@char]); $pending_badges[.@char] = 0; $pending_points[.@char] = 0; $pending_rank[.@char] = 0; end; OnInit: .top_len = 10; // we want a top 10 // fallthrough OnSun0001: // every Sunday at 00:01 AM $last_week = .this_week; .this_week = atoi(gettimestr("%y%W", 4)); // YYWW if ($last_week < 1) { end; // this is our first week running this script } .@count = query_sql(sprintf("SELECT c.char_id, c.name, r.value" "FROM `char_reg_num_db` r " "JOIN `char` c ON r.char_id = c.char_id " "WHERE `key`='pvp_rank' AND `index`='%i' " "ORDER BY `value` DESC " "LIMIT " + .top_len + ";", $last_week), .top_char[0], .top_char$[0], .top_points[0]); // store that info so it can be reused throughout the week query_sql(sprintf("DELETE FROM `char_reg_num_db` WHERE `key`='pvp_rank' AND `index` <= %i", $last_week)); // janitor task for (.@i = 0; .@i < .@count; .@i++) { .@badges = (10 * .top_len) - (10 * .@i); // the badges this player won .@char = .top_char[.@i]; .@acc = charid2rid(.@char); $pending_badges[.@char] += .@badges; $pending_points[.@char] = .top_points[.@i]; $pending_rank[.@char] = (.@i + 1); if (.@acc > 0) { addtimer(rand(5000), "PvP Ranking::OnClaimReward", .@acc); } } end; } You'll notice I did +3 and -3 for both killing and being killed; This is on purpose, else someone could just make 2 characters and kill each other to keep getting +1 every time (+3, -2)
To display the top 10 from last week in a npc you'd do something like:
mes("Here's the ranking for last week:"); next(); if (getvariableofnpc(.top_char[0], "PvP Ranking") < 1) { mes("(no ranking available for that week)"); next(); } .@max = getvariableofnpc(.top_len, "PvP Ranking"); for (.@i = 0; .@i < .@max; .@i++) { .@points = getvariableofnpc(.top_points[.@i], "PvP Ranking"); if (.@points < 1) { break; } mes(sprintf("%i. %s — %i points.", .@i + 1, getvariableofnpc(.top_char$[.@i], "PvP Ranking"), .@points)); next(); } -
meko got a reaction from Legend in PvP Ranking! - Request
working on it, I'll post here the script asap, free of charge
-
meko got a reaction from nuna in Hello may i request if you warp on payon then you go back to your savepoint
add this mapflag: loadevent
then do something like:
OnPCLoadMapEvent: if (strcharinfo(PC_MAP) == "moc_fild22" && !@auth_moc_fild22) { warp("SavePoint", 0, 0); // player is not authorized to be on moc_fild22 } end;
and in the npc that warps the player to that map you'd just set @auth_moc_fild22 to true and warp to moc_fild22
-
meko got a reaction from nuna in Can some one convert this script to hercules
.@count = query_sql("SELECT c.name, r.value AS points "
"FROM `char_reg_num_db` r "
"JOIN `char` c ON r.char_id = c.char_id "
"WHERE `key`='brokeemp' AND `index`='0' "
"ORDER BY `value` DESC "
"LIMIT 10;",
.@char$[0], .@points[0]);
for (.@i = 0; .@i < .@count; .@i++) {
mes(sprintf("%d. %s — %d points.", .@i + 1, .@char$[.@i], .@points[.@i]));
}
-
meko got a reaction from Sephus in Needs testing: bank vault (#1717)
EDIT: this PR was merged
I need someone to test a certain pull request on the official ragnarok client (is it called Gravity?).
See https://github.com/HerculesWS/Hercules/pull/1717
What needs testing: manipulating the vault from script while the bank window is open and checking if it updates the window accordingly.
Thanks for your time