meko

Core Developers
  • Content count

    236
  • Joined

  • Last visited

  • Days Won

    20

meko last won the day on February 18

meko had the most liked content!

4 Followers

About meko

  • Rank
    Advanced Member

Contact Methods

  • IRC Nickname
    meko

Profile Information

  • Gender
    Not Telling
  1. function foobar { [email protected]_argument$ = getarg(0); // get the value of the first argument passed to foobar() [email protected]$ = "Hello " + [email protected]_argument$; // add the value of the first argument to "Hello" return [email protected]$; // exit the function, while returning the value of [email protected]$ } mes(foobar("world")); // Hello World
  2. [email protected]$ = [email protected] % (10 ** ([email protected] + 1)) / (10 ** [email protected]) + [email protected]$; // x = (y mod (10 ** (z + 1)) / (10 ** z)) // x = y mod 10 // this means it can be simplified to: [email protected]$ = ([email protected] % 10) + [email protected]$; but I believe your original script had an error because it uses both [email protected] and [email protected]$
  3. dispbottom(sprintf("Gained 1 cash point. You now have a total of %i cash points.", ++#CASHPOINTS));
  4. That's quite resource-intensive, but sure: prontera,39,30,0 script npc_name npc_id,{ // ask the player if they want to proceed mesf("Do you want to warp your party to %s? It will cost %i tickets to every party member.", .destination_map$, .ticket_cost); if (select("yes", "no") != 1) close; // now go through a lenghty routine to validate everything [email protected] = getcharid(CHAR_ID_PARTY); if ([email protected] < 1) { mes("You must be in a party."); close; } [email protected] = getpartyleader([email protected], 1); if ([email protected] != getcharid(CHAR_ID_ACCOUNT)) { mes("You must be a party leader."); close; } if (strcharinfo(PC_MAP) != .start_map$) { mesf("You must be on %s.", .start_map$); close; } [email protected]_delta = .ticket_cost - TICKETMANIAC; if ([email protected]_delta > 0) { mesf("You are missing %i ticket%s.", [email protected]_delta, [email protected]_delta > 1 ? "s" : ""); close; } getpartymember([email protected], 1); [email protected]_count = [email protected]; copyarray([email protected]_cid[0], [email protected][0], [email protected]_count); copyarray([email protected]_name$[0], [email protected]$[0], [email protected]_count); freeloop(true); for ([email protected] = 0; [email protected] < [email protected]_count; [email protected]) { [email protected]$ = [email protected]_name$[[email protected]]; [email protected] = [email protected]_cid[[email protected]]; [email protected] = charid2rid([email protected]); if ([email protected] < 1 || isloggedin([email protected], [email protected]) == false) { mesf("All party members must be online, but %s is currently offline.", [email protected]$); freeloop(false); close; } [email protected]$ = strcharinfo(PC_MAP, "", [email protected]); if ([email protected]$ != .start_map$) { mesf("All party members must be on %s, but %s is currently on %s.", .start_map$, [email protected]$, [email protected]$); freeloop(false); close; } [email protected]_delta = .ticket_cost - getvariableofpc(TICKETMANIAC, [email protected], 0); if ([email protected]_delta > 0) { mesf("Party member %s is missing %i ticket%s.", [email protected]$, [email protected]_delta, [email protected]_delta > 1 ? "s" : ""); freeloop(false); close; } } // we got through the loop, so all conditions are met; now let's warp and decrease tickets for ([email protected] = 0; [email protected] < [email protected]_count; [email protected]) { [email protected] = [email protected]_cid[[email protected]]; [email protected] = charid2rid([email protected]); set(getvariableofpc(TICKETMANIAC, [email protected]), max(0, getvariableofpc(TICKETMANIAC, [email protected]) - .ticket_cost)); if ([email protected] != getcharid(CHAR_ID_CHAR)) { warpchar(.destination_map$, rand(.destination_loc[0], .destination_loc[2]), rand(.destination_loc[1], .destination_loc[3]), [email protected]); } } freeloop(false); mes("All party members have been warped. Now it's your turn!"); close2(); TICKETMANIAC = max(0, TICKETMANIAC - .ticket_cost); warp(.destination_map$, rand(.destination_loc[0], .destination_loc[2]), rand(.destination_loc[1], .destination_loc[3])); end; OnInit: // change those settings to your liking .start_map$ = "prontera"; .ticket_cost = 1; .destination_map$ = "payon"; .destination_loc[0] = 20; // x1 .destination_loc[1] = 20; // y1 .destination_loc[2] = 90; // x2 .destination_loc[3] = 90; // y2 }
  5. bonus2(bHPRegenRate, ((MaxHP/100)*5), 1000); bonus2(bHPDrainRate, 10, 2);
  6. use bonus instead of bonus2
  7. If you are unsure about the resources you need, choose a scalable VPS, such as DigitalOcean Droplets or AWS Lightsail, which allows you to scale the resources up or down to meet demand
  8. you might want to trigger the command in OnPCLogoutEvent
  9. use checkcell()
  10. The ID sent by the server is hardcoded: https://github.com/HerculesWS/Hercules/blob/stable/src/map/pc.c#L6752
  11. - script AutoVIP FAKE_NPC,{ OnPCLoginEvent: // save the original group @ACTUAL_GROUP = getgroupid(); // check if the player was never a VIP if (##VIP_UNTIL < 1) { // give the free VIP status ##VIP_UNTIL = gettimetick(2) + .free_vip_length; } // check if the player is currently a VIP if (##VIP_UNTIL > gettimetick(2)) { // move the player to the VIP group until logout setgroupid(.vip_group); // notify the player dispbottom("You are a VIP player."); // schedule a timer to revert the group on expiration addtimer((##VIP_UNTIL - gettimetick(2)) * 1000, strnpcinfo(0) + "::OnExpire"); } // check if the player was a VIP but it expired while away else if (##VIP_UNTIL > 1) { goto OnExpire; } end; OnExpire: if (##VIP_UNTIL <= gettimetick(2)) { // revert to the original group setgroupid(@ACTUAL_GROUP); // notify the player dispbottom("Your VIP status expired. You are now a normal player."); // update the variable ##VIP_UNTIL = 1; } end; /////////// Configuration below OnInit: .vip_group = 1; // the ID of your VIP group .free_vip_length = (((60 * 60) * 24) * 5); // the length of the free VIP period (5 days) }
  12. To check on which map a player is: [email protected]$ = strcharinfo(PC_MAP, "%", [email protected]_id); if ([email protected]$ == "%") { // player is not on a map } else { // player is on a map // << add further checks here >> }
  13. in the Script<> section, you could do something like: if (gettimetick(2) <= @ITEM_LOCK[0]) end; @ITEM_LOCK[0] = gettimetick(2) + 1; percentheal(100, 100);
  14. you can find the documentation in the /doc folder, and some more on the wiki: https://github.com/HerculesWS/Hercules/wiki