-
Content Count
366 -
Joined
-
Last visited
-
Days Won
8
Reputation Activity
-
Patskie got a reaction from MikZ in Infinity loop (error)
Your calling getinventorylist multiple times (while && for) and i'm not sure why
Here try
//===== Hercules Script ====================================== //= Healer //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.2 //===== Description: ========================================= //= Basic healer script. //===== Additional Comments: ================================= //= 1.0 Initial script. //= 1.1 Aligned coordinates with @go. //= 1.2 Fix variables and character stuck at healing //============================================================ function script H_VIPBuff { query_sql( "SELECT CAST( `vip` AS DATE ),DATEDIFF( IFNULL(`vip`,NOW()),NOW() ), TIMESTAMPDIFF(SECOND, NOW(), `vip`) FROM `login` WHERE `account_id` = "+getcharid(3)+" LIMIT 1", .@vip_date$, .@day, .@vip_second); return .@day > 0 || .@vip_second > 0 ? true : false; } - script Healer FAKE_NPC,{ .@price = 0; // Zeny required for heal .@Buffs = 1; // Also buff players? (1: yes / 0: no) .@Delay = 2; // Heal delay, in seconds if (@HD > gettimetick(2)) end; if (.@price) { message strcharinfo(PC_NAME),"Healing costs "+.@price+" Zeny."; if (Zeny < .@price) end; if(select("^0055FFHeal^000000", "^777777Cancel^000000") == 2) close; Zeny -= .@price; } specialeffect(EF_HEAL2, AREA, playerattached()); percentheal 100,100; if (callfunc ("H_VIPBuff")) { sc_end SC_STONE; sc_end SC_FREEZE; sc_end SC_STUN; sc_end SC_SLEEP; sc_end SC_POISON; sc_end SC_CURSE; sc_end SC_SILENCE; sc_end SC_CONFUSION; sc_end SC_BLIND; sc_end SC_BLOODING; sc_end SC_DPOISON; sc_end SC_FEAR; sc_end SC_COLD; sc_end SC_BURNING; sc_end SC_DEEP_SLEEP; sc_end SC_DEC_AGI; sc_end SC_BROKENARMOR; sc_end SC_BROKENWEAPON; sc_end SC_NOEQUIPWEAPON; sc_end SC_NOEQUIPSHIELD; sc_end SC_NOEQUIPARMOR; sc_end SC_NOEQUIPHELM; sc_end SC__STRIPACCESSARY; sc_end SC_PROPERTYUNDEAD; sc_end SC_ORCISH; sc_end SC_BERSERK; sc_end SC_SKE; sc_end SC_SWOO; sc_end SC_SKA; sc_end SC_SLOWDOWN; sc_end SC_FROSTMISTY; sc_end SC_ILLUSION; sc_end SC_BITESCAR; //sc_start SC_CASH_PLUSEXP,.exp_bonus_duration,.bonus_vip_exp_rate; //sc_start SC_CASH_RECEIVEITEM,.bonus_duration,.bonus_vip_drop_rate; specialeffect(EF_INCAGILITY, AREA, playerattached()); sc_start SC_INC_AGI,240000,10; specialeffect(EF_BLESSING, AREA, playerattached()); sc_start SC_BLESSING,240000,10; specialeffect(EF_KYRIE, AREA, playerattached()); sc_start SC_KYRIE, 120000, 3; specialeffect( EF_IMPOSITIO, AREA, playerattached()); sc_start SC_IMPOSITIO, 60000, 3; specialeffect(EF_GLORIA, AREA, playerattached()); sc_start SC_GLORIA, 30000, 3; if( getbrokenid(1) ) repairall; getinventorylist; for (.@i = 0; .@i < @inventorylist_count; .@i++) if ( @inventorylist_identify[.@i] == 1 ) continue; else if ( getskilllv(MC_IDENTIFY) == 1 && Sp >= 10 ) heal 0,0; // lol... this is supposed to reduce their SP by 10, whatever else if ( countitem(Spectacles) ) delitem Spectacles,1; else if ( getskilllv(RG_COMPULSION) && Zeny >= ( 100 - ( 5 + 4 * getskilllv(RG_COMPULSION) ) )* 2/5 ) Zeny -= ( 100 - ( 5 + 4 * getskilllv(RG_COMPULSION) ) )* 2/5; else if ( getskilllv(MC_DISCOUNT) && Zeny >= ( 100 - ( 5 + 2 * getskilllv(MC_DISCOUNT) ) )* 2/5 ) Zeny -= ( 100 - ( 5 + 2 * getskilllv(MC_DISCOUNT) ) )* 2/5; else if ( Zeny >= 40 ) Zeny -= 40; else break; delitem2 @inventorylist_id[.@i], 1, 0, @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i]; getitem2 @inventorylist_id[.@i], 1, 1, @inventorylist_refine[.@i], 0, @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i]; .@icount++; } if ( .@icount ) message strcharinfo(0), "Identified "+ .@icount +" Items."; } else { if (.@Buffs) { specialeffect(EF_INCAGILITY, AREA, playerattached()); sc_start SC_INC_AGI,240000,5; specialeffect(EF_BLESSING, AREA, playerattached()); sc_start SC_BLESSING,240000,5; } if (.@Delay) @HD = gettimetick(2)+.@Delay; end; } }
-
Patskie got a reaction from FearlesS in R> IP & account based freebies npc
/* Run below script to create table * CREATE TABLE IF NOT EXISTS `freebies_ip` AS * SELECT `LAST_IP` `IP` FROM `LOGIN` LIMIT 0; */ prontera,150,150,6 script Test 4W_SAILOR,{ if (!#FREEBIES && !query_sql("SELECT `IP` FROM `FREEBIES_IP` WHERE `IP` = '" + getcharip() + "'", .@ip$)) { .@i = 0; while (.@i < .size) { getitem .freebies[.@i], .freebies[.@i+1]; .@i += 2; } #FREEBIES = 1; query_sql("INSERT INTO `FREEBIES_IP` VALUES ('" + getcharip() + "')"); end; } mes "Already claimed freebies"; close; OnInit: // <item id>,<amount> setarray .freebies[0], Speed_Up_Potion_Box10, 5, Yggdrasilberry_Box_, 10; .size = getarraysize(.freebies); end; } Run the sql script first on the comment header
-
Patskie got a reaction from ThyroDree in Item Shower around player
- script asdfh FAKE_NPC,{ OnCmd: if (!.@atcmd_numparameters || .@atcmd_numparameters != 2) { message strcharinfo(0), "Usage: @itemshower <item_id> <item_quantity>"; end; } .@item = atoi(.@atcmd_parameters$[0]); .@q = atoi(.@atcmd_parameters$[1]); if (!.@q || getitemname(.@item) == "null") { message strcharinfo(0), "Invalid item/amount"; end; } getmapxy .@map$, .@x, .@y, UNITTYPE_PC; .@i = 0; while (.@i < .@q) { do { .@a = rand(.@x, .@x+200); .@b = rand(.@y, .@y+200); } while (!checkcell(.@map$, .@a, .@b, cell_chkpass)); makeitem .@item, 1, .@map$, .@a, .@b; .@i++; } end; OnInit: bindatcmd "itemshower", strnpcinfo(3) + "::OnCmd", 99, 99, true; end; }
-
Patskie got a reaction from meko in HOURLY ITEM REWARD SCRIPT for HERCULES
Try :
- script asdfgh FAKE_NPC,{ OnPCLoginEvent: .players[getarraysize(.players)] = getcharid(CHAR_ID_ACCOUNT); end; OnPCLogoutEvent: .@i = callfunc("array_find", .players, getcharid(CHAR_ID_ACCOUNT)); if (!(.@i < 0)) deletearray .players[.@i], 1; end; OnMinute15: if (!.random_receiver) { .@i = 0; .@s = getarraysize(.players); while (.@i < .@s) { getitem Jellopy, 1, .players[.@i]; .@i++; } } else getitem Jellopy, 1, .players[rand(getarraysize(.players))]; end; OnInit: .random_receiver = 0; // 0 - all online players | 1 = random online player end; } PS : I am using below release so please plug that as well to your server to avoid any issues
-
Patskie got a reaction from Ridley in Trade headgear for another headgear but keep the refine rate?
Much better if you use getitem2
new_1-1,56,126,0 script Test 4W_SAILOR,{ if ( !countitem( 5172 ) ) close; getinventorylist; mes "Pick the refine rate of " + getitemname( 5172 ) + " that you want to trade..."; next; for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) { if ( @inventorylist_id[ .@i ] == 5172 ) .@refine$[ getarraysize( .@refine$ ) ] = @inventorylist_refine[ .@i ]; } .@s = select( implode( .@refine$, ":" ) ) - 1; mes "Are you sure you want to trade +" + .@refine$[ .@s ] + " " + getitemname( 5172 ) + " to +" + .@refine$[ .@s ] + " " + getitemname( 2249 ) + "?"; next; if ( select( "Yes:No" ) - 1 ) close; delitem2 5172,1,1,.@refine$[ .@s ],0,0,0,0,0; getitem2 2249,1,1,.@refine$[ .@s ],0,0,0,0,0; close; } -
Patskie got a reaction from Helena in Trade headgear for another headgear but keep the refine rate?
Much better if you use getitem2
new_1-1,56,126,0 script Test 4W_SAILOR,{ if ( !countitem( 5172 ) ) close; getinventorylist; mes "Pick the refine rate of " + getitemname( 5172 ) + " that you want to trade..."; next; for ( .@i = 0; .@i < @inventorylist_count; .@i++ ) { if ( @inventorylist_id[ .@i ] == 5172 ) .@refine$[ getarraysize( .@refine$ ) ] = @inventorylist_refine[ .@i ]; } .@s = select( implode( .@refine$, ":" ) ) - 1; mes "Are you sure you want to trade +" + .@refine$[ .@s ] + " " + getitemname( 5172 ) + " to +" + .@refine$[ .@s ] + " " + getitemname( 2249 ) + "?"; next; if ( select( "Yes:No" ) - 1 ) close; delitem2 5172,1,1,.@refine$[ .@s ],0,0,0,0,0; getitem2 2249,1,1,.@refine$[ .@s ],0,0,0,0,0; close; } -
Patskie got a reaction from caspe in delete certain items when entering the map.
Supports multiple items and multiple maps configuration ( check the OnInit part ) :
- script Sample -1,{ OnPCLoadMapEvent: getmapxy .@map$, .@xx, .@yy, 0; for ( .@x = 0; .@x < getarraysize(.Maps$); .@x++ ) { for ( .@y = 0; .@y < .size; .@y++ ) { if ( .@map$ == .Maps$[.@x] && countitem(.item_id[.@y]) ) { dispbottom "Item " +getitemname(.item_id[.@y])+ " (" +countitem(.item_id[.@y])+ ") was deleted on your inventory"; delitem .item_id[.@y], countitem(.item_id[.@y]); } } } end; OnInit: setarray .Maps$[0],"prontera","payon","geffen"; setarray .item_id[0],501,502; .size = getarraysize(.item_id); for ( .@i = 0; .@i < getarraysize(.Maps$); .@i++ ) setmapflag .Maps$[.@i], mf_loadevent; end;} -
Patskie got a reaction from TokyRO in [Guide] How to setup hercules
There is an existing server installation guide made by Diconfrost VaNz on this topic but this is outdated. So let me give ample time to share my experience on how to install Hercules SVN on your local machine.
1. To obtain hercules, refer to Ind's topic
2. Go to conf/char-server.conf and look for the code below :
// Server Communication username and password.userid: s1passwd: p1
Set s1 and p1 to anything you want but take note of them as you will use them later on when you move to SQL portion of this installation.
In my case, i will use patskie since it is my screen name.
// Server Communication username and password.userid: patskiepasswd: patskie
3. Set your server name? Find this line also on your conf/char-server.conf. Change it to whatever you want :
// Server name, use alternative character such as ASCII 160 for spaces.// NOTE: Do not use spaces or any of these characters which are not allowed in // Windows filenames /:*?"<>|// ... or else guild emblems won't work client-side!server_name: Hercules
4. Remove // on the following code :
//login_ip: 127.0.0.1
//char_ip: 127.0.0.1 Note : 127.0.0.1 means localhost, local machine.
5. Save and exit
6. Now go to conf/map-server.conf
7. Same to what you have did in conf/char-server.conf :
//--------------------------------------------------------------// Configuration Info//--------------------------------------------------------------// Interserver communication passwords, set in account.txt (or equiv.)userid: patskiepasswd: patskie
8. Remove // on the following code :
//char_ip: 127.0.0.1
//map_ip: 127.0.0.1
9. Once you're done. Save and exit.
10. Now go to conf/inter-server.conf
11. Set the following code :
// Global SQL settings// overriden by local settings when the hostname is defined there// (currently only the login-server reads/obeys these settings)sql.db_hostname: 127.0.0.1sql.db_port: 3306sql.db_username: rootsql.db_password: ragnaroksql.db_database: herculessql.codepage:// MySQL Character SQL serverchar_server_ip: 127.0.0.1char_server_port: 3306char_server_id: rootchar_server_pw: ragnarokchar_server_db: hercules// MySQL Map SQL Servermap_server_ip: 127.0.0.1map_server_port: 3306map_server_id: rootmap_server_pw: ragnarokmap_server_db: hercules// MySQL Log SQL Databaselog_db_ip: 127.0.0.1log_db_port: 3306log_db_id: rootlog_db_pw: ragnaroklog_db_db: loglog_codepage:log_login_db: loginlog Note : Use 127.0.0.1 as ip because you will run these server on your local machine. Use root as the database id because by default MySQL workbench uses root as username. And finally ragnarok as database password which is configurable by users. Set map, char an sql database to hercules and set log database to loginlog
12. Once done, Save and exit
13. Now go to src/common/mmo.h and find the following code :
#ifndef PACKETVER #define PACKETVER 20120418#endif Change to :
#ifndef PACKETVER #define PACKETVER 20100730#endif Note : You can change 20120418 (2012-04-18) to whatever client-date you want. In my case i will use 2010-07-30 client (20100730).
14. Save and exit.
15. Now let's go to mysql part.
16. Download MySQL workbench here. Why workbench? More convenient to use.
17. Once you are finished downloading and installing. Download WAMP server here because workbench will not start functioning if you do not have WAMP server
18. Once you are finished downloading and installing wampserver. Run it
19. Open mysql workbench
20. Add user and password into it. Follow this guide. Make sure you set username as root and password as ragnarok because this is the credentials located on your conf/inter-server.conf
21. Create a server instance and connection. Just click New Connection for creating connection and click New Server Instance for creating a new server instance everything there are self explanatory
22. More likely you must have the following : ( Check image below )
23. At the left portion of the application. You can see schemas. Right click on one of them (test schema) and click on create schema
24. Set the name of the schema to hercules because that is the credential we put in our inter-server
25. Create also a schema log
26. Double click hercules schema
27. Under file located at the bottom of the home button ( upper left to be exact ) click Open SQL Script and locate sql script on sql-files/main.sql, open it and execute ( you can find execute button at the upper portion of the text editor of mysql workbench it looks like a thunder xD )
28. Double click log schema
29. Under file located at the bottom of the home button ( upper left to be exact ) click Open SQL Script and locate sql script on sql-files/logs.sql, open it and execute ( you can find execute button at the upper portion of the text editor of mysql workbench it looks like a thunder xD )
30. Once everything is set double click again hercules schema
31. Execute the following code
SELECT * FROM login; 32. Change userid, user_pass to the credentials you have put on both char-server and map-server.conf
33. Click apply.
34. Once done, go back to your server files and compile everything using Microsoft Visual Studio 2009 or 2010 or 2012
Note :
Microsoft Visual Studio 2009 = Hercules-9
Microsoft Visual Studio 2010 = Hercules-10
Microsoft Visual Studio 2012 = Hercules-12
35. Open it via C++
36. In my case i am using MVS 2010, Highlight char-server, login-server, map-server, mapcache at the left portion of the application. Right click on it and click Build Selection
37. Check image for successful compilation, Once done exit the application
38. Now you're done! Run run-server.bat on main folder
I hope this guide help other people who find it difficult to install hercules svn on your local machine. Actually this guide is not hard. I just divided the guide into small chunks so that people will understand more. If you think that any portion of installation is not included in my guide or maybe in some way not good or not correct then feel free to post it.
Additional Notes :
- If you want other people to connect then you must port forward your router, or you can use other application like hamachi
- If any error occur feel free to post it here. Make sure you will post it in a detailed manner. Post screenshot if possible
- I include a diff client for 2010-07-30 since i use it in this guide
2010-07-30-DIFF.rar
-
Patskie got a reaction from grobyczen in [Guide] How to setup hercules
There is an existing server installation guide made by Diconfrost VaNz on this topic but this is outdated. So let me give ample time to share my experience on how to install Hercules SVN on your local machine.
1. To obtain hercules, refer to Ind's topic
2. Go to conf/char-server.conf and look for the code below :
// Server Communication username and password.userid: s1passwd: p1
Set s1 and p1 to anything you want but take note of them as you will use them later on when you move to SQL portion of this installation.
In my case, i will use patskie since it is my screen name.
// Server Communication username and password.userid: patskiepasswd: patskie
3. Set your server name? Find this line also on your conf/char-server.conf. Change it to whatever you want :
// Server name, use alternative character such as ASCII 160 for spaces.// NOTE: Do not use spaces or any of these characters which are not allowed in // Windows filenames /:*?"<>|// ... or else guild emblems won't work client-side!server_name: Hercules
4. Remove // on the following code :
//login_ip: 127.0.0.1
//char_ip: 127.0.0.1 Note : 127.0.0.1 means localhost, local machine.
5. Save and exit
6. Now go to conf/map-server.conf
7. Same to what you have did in conf/char-server.conf :
//--------------------------------------------------------------// Configuration Info//--------------------------------------------------------------// Interserver communication passwords, set in account.txt (or equiv.)userid: patskiepasswd: patskie
8. Remove // on the following code :
//char_ip: 127.0.0.1
//map_ip: 127.0.0.1
9. Once you're done. Save and exit.
10. Now go to conf/inter-server.conf
11. Set the following code :
// Global SQL settings// overriden by local settings when the hostname is defined there// (currently only the login-server reads/obeys these settings)sql.db_hostname: 127.0.0.1sql.db_port: 3306sql.db_username: rootsql.db_password: ragnaroksql.db_database: herculessql.codepage:// MySQL Character SQL serverchar_server_ip: 127.0.0.1char_server_port: 3306char_server_id: rootchar_server_pw: ragnarokchar_server_db: hercules// MySQL Map SQL Servermap_server_ip: 127.0.0.1map_server_port: 3306map_server_id: rootmap_server_pw: ragnarokmap_server_db: hercules// MySQL Log SQL Databaselog_db_ip: 127.0.0.1log_db_port: 3306log_db_id: rootlog_db_pw: ragnaroklog_db_db: loglog_codepage:log_login_db: loginlog Note : Use 127.0.0.1 as ip because you will run these server on your local machine. Use root as the database id because by default MySQL workbench uses root as username. And finally ragnarok as database password which is configurable by users. Set map, char an sql database to hercules and set log database to loginlog
12. Once done, Save and exit
13. Now go to src/common/mmo.h and find the following code :
#ifndef PACKETVER #define PACKETVER 20120418#endif Change to :
#ifndef PACKETVER #define PACKETVER 20100730#endif Note : You can change 20120418 (2012-04-18) to whatever client-date you want. In my case i will use 2010-07-30 client (20100730).
14. Save and exit.
15. Now let's go to mysql part.
16. Download MySQL workbench here. Why workbench? More convenient to use.
17. Once you are finished downloading and installing. Download WAMP server here because workbench will not start functioning if you do not have WAMP server
18. Once you are finished downloading and installing wampserver. Run it
19. Open mysql workbench
20. Add user and password into it. Follow this guide. Make sure you set username as root and password as ragnarok because this is the credentials located on your conf/inter-server.conf
21. Create a server instance and connection. Just click New Connection for creating connection and click New Server Instance for creating a new server instance everything there are self explanatory
22. More likely you must have the following : ( Check image below )
23. At the left portion of the application. You can see schemas. Right click on one of them (test schema) and click on create schema
24. Set the name of the schema to hercules because that is the credential we put in our inter-server
25. Create also a schema log
26. Double click hercules schema
27. Under file located at the bottom of the home button ( upper left to be exact ) click Open SQL Script and locate sql script on sql-files/main.sql, open it and execute ( you can find execute button at the upper portion of the text editor of mysql workbench it looks like a thunder xD )
28. Double click log schema
29. Under file located at the bottom of the home button ( upper left to be exact ) click Open SQL Script and locate sql script on sql-files/logs.sql, open it and execute ( you can find execute button at the upper portion of the text editor of mysql workbench it looks like a thunder xD )
30. Once everything is set double click again hercules schema
31. Execute the following code
SELECT * FROM login; 32. Change userid, user_pass to the credentials you have put on both char-server and map-server.conf
33. Click apply.
34. Once done, go back to your server files and compile everything using Microsoft Visual Studio 2009 or 2010 or 2012
Note :
Microsoft Visual Studio 2009 = Hercules-9
Microsoft Visual Studio 2010 = Hercules-10
Microsoft Visual Studio 2012 = Hercules-12
35. Open it via C++
36. In my case i am using MVS 2010, Highlight char-server, login-server, map-server, mapcache at the left portion of the application. Right click on it and click Build Selection
37. Check image for successful compilation, Once done exit the application
38. Now you're done! Run run-server.bat on main folder
I hope this guide help other people who find it difficult to install hercules svn on your local machine. Actually this guide is not hard. I just divided the guide into small chunks so that people will understand more. If you think that any portion of installation is not included in my guide or maybe in some way not good or not correct then feel free to post it.
Additional Notes :
- If you want other people to connect then you must port forward your router, or you can use other application like hamachi
- If any error occur feel free to post it here. Make sure you will post it in a detailed manner. Post screenshot if possible
- I include a diff client for 2010-07-30 since i use it in this guide
2010-07-30-DIFF.rar
-
Patskie got a reaction from evilpuncker in ATM System
This script enhances player capabilities by depositing, withdrawing and inquiring their balance anytime, anywhere!
How to use :
Just use @atm in-game.
How to install :
• Import the bank.sql on your database REMOVED ON VERSION 2.0
• Go to conf/script.conf
• Find input_max_value: 10000000 and change it to 2147483647
• Go to src/common/mmo.h
• Find #define MAX_ZENY 1000000000 and change it to 2000000000
• Recompile your server and re-start it
• Put atm.txt on your npc folder
• Reload the script by using @reloadscript or @loadscript and enjoy!
Script features :
• Register your account on the bank REMOVED ON VERSION 2.0
• Automatically register your account to the bank system ADDED ON VERSION 2.0
• Interest triggers every 00:00 each day ADDED ON VERSION 2.0 THANKS TO ANGELMELODY FOR THE SUGGESTION!
• Limited times of reminder on your account number during login ADDED ON VERSION 2.0
• The bank can hold up to 9,223,372,036,854,775,807 zeny from it's original 2,147,483,647 zeny ADDED ON VERSION 2.0
• Deposit zeny to the bank
• Withdraw zeny from the bank
• Inquire your account balance
Script restriction :
• You should put your account number first before doing transactions. By default your account number is your account id ADDED ON VERSION 2.0
• Restrict 0 zeny deposit and withdraw
• Restrict depositing amount which is larger than the current holding zeny
• Restrict the user to withdraw amount which is larger than the balance of the account
• Restrict the user to withdraw which will probably result of holding 2,000,000,000 zeny or more
Changelog :
atm.txt
http://pastebin.com/raw.php?i=2YW0wPPp
-
Patskie got a reaction from astralprojection in Ip to Mac Address Reward.
query_sql "SELECT `last_mac` FROM `login` WHERE `account_id` = '" + .@aid[ .@j ] + "' LIMIT 1", .@mac$; -
-
Patskie got a reaction from ShankS in PvP points script..
Change all :
pk_points++; to :
#pk_points++; -
Patskie got a reaction from milk in Christmas Event Help
Follow syntax :
mes ( countitem( item_id ) < amount_of_item_needed ? "^FF0000" : "^009900" ) + countitem( item_id ) + "/" + amount_of_item_needed + " " + getitemname( item_id ) + "^000000"; -
Patskie got a reaction from ShankS in PvP points script..
Change : OnPCKillEvent: if( strcharinfo(3)!=.map$ ) end; pk_points++; dispbottom "You've gained one point! Your total is ["+pk_points+"] PK point(s)."; end; To :
OnPCKillEvent: if ( strcharinfo( 3 ) != .map$ || killedrid == last_killed ) end; last_killed = killedrid; pk_points++; dispbottom "You've gained one point! Your total is ["+pk_points+"] PK point(s)."; end; -
Patskie reacted to GmOcean in Scripting Tutorials & Guides
Scripting Tutorials and Guides
I'm going to attempt to help everyone here with their scripts while not being directly involved in helping you with them xD.
This will also help future/current scripters get some fresh info and maybe inspire innovative ideas towards scripting.
So that we can prove that us " Scripters " are the superior ragnarok emulation race! Take that Source Code writers!! Jk lol, we need you too .
What I'm going to do, is write detailed tutorials on how to write a few scripts. Starting from the basics to more advanced scripts.
This way everyone can follow along. And hopefully this will help everyone understand how to write a few scripts and even troubleshoot their own scripts.
Also please read: Scripting Standards.
It will help you understand how to read some of the syntax and way people script things.
// A list of <sprite id>s can be found here: Sprite_IDs Credits: Ai4rei
Scripting Tutorials & Guides
In this section you will learn how to write scripts ranging from Complete Begginer Level Scripts ( Me and Some of you ) -> Expert Level Scripts ( Think, Developer Status O.o; )
- Beginner Scripts -
Scripts for complete beginners and novice scripters.
- Intermediate Scripts -
Scripts for intermediate level scripters. If you completed my beginner script series, then you are ready for this section.
- Advanced Scripts -
Scripts for advanced level scripters. If you completed my intermediate script series and have made a few of your own intermediate scripts, then you are ready for this section.
The idea behind this topic, is for new users, and current ones, to have a (second)place they can go to for reference when trying to write a script if they can't figure it out with script_commands.txt file. It will also help people learn how to write scripts. While hopefully, keeping script writing techniques to a ' very ' similar structure!
*Read Me* - I have updated the links on this post to link to the oldboard so these guides can be viewed. However, do note that the script_commands.txt links within those guides are no longer accurate. Enjoy your scripting.
-
Patskie got a reaction from milk in Scripting Tutorials & Guides
This would be awesome if people who knows how to script can collaborate with GmOcean to make this topic as good as possible.
This topic should be pinned in my opinion
-
Patskie got a reaction from jaBote in request - npc who give hourly points
- script hourly_points -1,{OnInit: //Configs .time = 60 * 60 * 1000; // Time in milliseconds. Default: 1 hour (60 * 60 * 1000) .max_idle = 15 * 30; // Maximum idle time in seconds .points = 1; // Points to give the user each active hour. .points_variable$ = "#CASHPOINTS"; // Variable name to store the points end;OnPCLoginEvent: addtimer .time, strnpcinfo(3)+"::OnPoints"; end;OnPoints: if (checkidle() < .max_idle && checkvending() != 2) { setd .points_variable$, getd(.points_variable$) + .points; dispbottom "Current Balance = " + #CASHPOINTS; goto OnPCLoginEvent; } end;}
Would trigger once only after script has been executed.
You can access character and account variables. In your example instead of doing too many query_sql commands. You can do like
dispbottom "Current Balance = " + hourlypoints; -
Patskie got a reaction from Edgar in Redeemer NPC / Coupon NPC / Promotional NPC
/*DROP TABLE IF EXISTS `reward_codes`;CREATE TABLE IF NOT EXISTS `reward_codes` ( `code` VARCHAR(10) NOT NULL DEFAULT '', `nameid` INT(11) UNSIGNED NOT NULL DEFAULT '0', `item_name` VARCHAR(45) NOT NULL DEFAULT '', `amount` SMALLINT(6) UNSIGNED NOT NULL DEFAULT '0', `time_created` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00' PRIMARY KEY (`code`)) ENGINE = MYISAM;DROP TABLE IF EXISTS `rewardlogs`;CREATE TABLE `rewardlogs` ( `account_id` INT( 10 ) NOT NULL, `code` VARCHAR( 10 ) NOT NULL, `redeem_time` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00') ENGINE = MyISAM;*/- script promoclaim -1,{OnInit: bindatcmd "claim",strnpcinfo(3)+"::OnClaim"; bindatcmd "code",strnpcinfo(3)+"::OnEditCode"; end; OnClaim: // if ( getgmlevel() ) end; mes "^FF0000 Enter a new promotional code."; input .@pc$; close2; query_sql "SELECT `nameid`, `amount` FROM `reward_codes` WHERE `code` = '" + escape_sql(.@pc$) + "'", .@item, .@amt; if ( !.@item ) dispbottom "Either invalid code or the code is already claimed by other people"; else { getitem .@item, .@amt; dispbottom "Promotional code successfully redeemed."; query_sql "DELETE FROM `reward_codes` WHERE `code` = '" + escape_sql(.@pc$) + "'"; query_logsql "INSERT INTO `rewardlogs` VALUES ( '" + getcharid(3) + "', '" + escape_sql(.@pc$) + "', NOW() )"; } end; OnEditCode: if ( getgmlevel() < 99 ) end; set .@choice$, "Setup a new promotional code:View existing codes:Delete exisiting codes:Cancel"; setarray .@length, 4,10; // <min>,<max> switch ( select( .@choice$ ) ) { case 1: input .@pcode$; if ( getstrlen( .@pcode$ ) < .@length[0] || getstrlen( .@pcode$ ) > .@length[1] ) { dispbottom "Codes must not be less than " +.@length[0]+ " and must be greater than " +.@length[1]+ "."; end; } mes "You have entered ^FF0000"+.@pcode$+"^000000 as the code."; mes "Are you sure?"; if ( select("Yes:No, thanks") - 1 ) end; query_sql "SELECT `code` FROM `reward_codes` WHERE `code` = '" + escape_sql(.@pcode$) + "'", .@pcode_exists; if ( .@pcode_exists ) { dispbottom "Sorry, that code already exist."; end; } mes "Please set a reward for the players who has entered the code."; input .@reward; next; if ( !.@reward || getitemname(.@reward) == "null" ) { dispbottom "Sorry, that is an invalid item id."; end; } set .@iname$, getitemname(.@reward); mes "Item number ^FF0000"+.@reward+"^000000"; mes "is equivalent to ^FF0000"+.@iname$+"^000000."; mes "Are you sure?"; next; if ( select("Yes:No, thanks") - 1 ) end; mes "How many ^FF0000"+.@iname$+"^000000.?"; input .@amount; next; if ( !.@amount ) { dispbottom "Sorry, that is an invalid amount number."; end; } mes "Are you sure?"; next; if ( select("Yes:No, thanks") - 1 ) end; query_sql "INSERT INTO `reward_codes` VALUES ( '" + escape_sql(.@pcode$) + "', '" + .@reward + "', '" + escape_sql(.@iname$) + "', '" + .@amount + "', NOW() )"; dispbottom "Done creating code!"; break; case 2: set .@nb, query_sql("SELECT code, item_name, amount FROM `reward_codes` ORDER BY time_created DESC LIMIT 20", .@code$, .@nid$, .@amount); if ( !.@nb ) { dispbottom "No exisiting codes."; end; } dispbottom "============================================="; dispbottom "============== EXISITING CODES =============="; dispbottom "============================================="; for(set .@i,0; .@i < .@nb; set .@i,.@i+1) dispbottom ""+.@code$[.@i]+" ( Reward: "+.@amount[.@i]+" "+.@nid$[.@i]+" ) "; dispbottom "============================================="; break; case 3: input .@dcode$; query_sql "SELECT `code` FROM `reward_codes` WHERE `code` = '" + escape_sql(.@dcode$) + "'", .@dcode_exists; if ( !.@dcode_exists ) { dispbottom "Promotional code not found."; end; } mes "Would you like to delete that code?"; next; if ( select("Yes:No, thanks") - 1 ) end; query_sql "DELETE FROM `reward_codes` WHERE `code` = '" + escape_sql(.@dcode$) + "'"; break; case 4: break; default: break; } close;} -
Patskie reacted to Mystery in when reach job lvl 10
Maybe it'd be kind if you shared the script too? Maybe other people might have the same idea / issue ^-^
-
Patskie reacted to jaBote in Endless Tower Problem!
Chances are it won't work on rAthena since our instancing system is differently built.
-
Patskie got a reaction from Alexandria in @rickroll
Change : OnAtcommand: atcommand "@me " +.Messages$[rand(getarraysize(.Messages$))]; end; to :
OnAtcommand: if ( gettimetick(2) < #timer ) end; atcommand "@me " +.Messages$[rand(getarraysize(.Messages$))]; #timer = gettimetick(2) + 10; end; -
Patskie got a reaction from WalkingBad in @rickroll
Change : OnAtcommand: atcommand "@me " +.Messages$[rand(getarraysize(.Messages$))]; end; to :
OnAtcommand: if ( gettimetick(2) < #timer ) end; atcommand "@me " +.Messages$[rand(getarraysize(.Messages$))]; #timer = gettimetick(2) + 10; end; -
Patskie got a reaction from WalkingBad in @rickroll
Try :
- script rickroll -1,{ OnInit: setarray .Messages$[0], "Never gonna give you up", "Never gonna let you down", "Never gonna run around and desert you", "Never gonna make you cry", "Never gonna say goodbye", "Never gonna tell a lie and hurt you"; bindatcmd "rickroll",strnpcinfo(3)+"::OnAtcommand"; end; OnAtcommand: atcommand "@me " +.Messages$[rand(getarraysize(.Messages$))]; end;} -
Patskie got a reaction from mrlongshen in @buff
- script Sample -1,{ OnInit: bindatcmd "buff", strnpcinfo( 3 )+"::OnBuff"; end; OnBuff: if ( getgroupid() > 40 ) end; specialeffect2 EF_INCAGILITY; sc_start SC_INC_AGI,240000,10; specialeffect2 EF_BLESSING; sc_start SC_BLESSING,240000,10; end;}