-
Posts
283 -
Joined
-
Last visited
-
Days Won
2
Content Type
Profiles
Forums
Downloads
Jobs Available
Server Database
Third-Party Services
Top Guides
Store
Crowdfunding
Posts posted by Kurofly
-
-
does your mapserv show you any error? The script works fine for me
Someone had a problem with the 'DISTINCT' wrod in the SQL query so maybe you have the same problem
Try to change this line:
.@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);
by this one:
.@n = query_sql ("SELECT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid);
btw if the script tells you that -1 players received... it means no one is online on the map
-
To add a srcipt you just have to follow these steps (really easy):
- save your script as a .txt fie in the folder you like (usually in npc/custom folder)
here you'd save it in npc/custom/mapreward.txt
- add its path in your npc/scripts_custom.conf
write this somewhere in this file: npc: npc/custom/mapreward.txt
You're done.
For your NPC, tell me if I get it:
You want a NPC that'd set up a list of items (with amounts) that players can get by clicking on him.
You want the NPC to activate on command.
You want players to be able to take their items part by part so that they can store them so that they don't exceed he weight limit.
-
//===== eAthena Script ============================================ //= #itemall //===== By: ======================================================= //= Originally by goddameit //= redo by ~AnnieRuru~ //===== Current Version: ========================================== //= 1.0 //===== Compatible With: ========================================== //= eAthena 14910 Trunk TXT/SQL //===== Description: ============================================== //= give items to all players in the map, or on the server //===== Topic ===================================================== //= http://www.eathena.ws/board/index.php?showtopic=276326 //===== Additional Comments: ====================================== //= topic splitted //================================================================= - script itemall -1,{ OnWhisperGlobal: if ( getgmlevel() < 89 ) end; // configure minimum GM level here if ( compare( @whispervar0$, "map" ) ) set .@map$, strcharinfo(3); else if ( compare( @whispervar0$, "all" ) == 0 ) { dispbottom "[itemall] Please enter \"map#<item id>#<item amount>\" or \"all#<item id>#<item amount>\""; end; } set .@itemid, atoi( @whispervar1$ ); set .@amount, atoi( @whispervar2$ ); if ( getiteminfo( .@itemid, 0 ) == -1 ) { dispbottom "[itemall] Invalid item ID"; end; } if ( .@amount == 0 ) set .@amount, 1; set .@origin$, strcharinfo(0); while ( .@i < $online_count ) { attachrid getd("$online_aid"+ .@i ); if ( .@map$ == "" || strcharinfo(3) == .@map$ ) { message strcharinfo(0), .@origin$ +" gives all players online in this map "+ .@amount +" "+ getitemname(.@itemid); getitem .@itemid, .@amount; } set .@i, .@i +1; } end; OnPCLoginEvent: setd "$online_aid"+ $online_count, getcharid(3); set $online_count, $online_count +1; end; OnPCLogoutEvent: while ( .@i < $online_count && getd("$online_aid"+ .@i ) != getcharid(3) ) set .@i, .@i +1; if ( $online_count == .@i ) end; // prevent @loadnpc/@reloadscript bug becos not in the array while ( .@i < $online_count ) { setd "$online_aid"+ .@i, getd("$online_aid"+ ( .@i +1 ) ); set .@i, .@i +1; } set $online_count, $online_count -1; end; OnInit: if ( getusers(1) ) end; while ( .@i < $online_count ) { setd "$online_aid"+ .@i, 0; set .@i, .@i +1; } set $online_count, 0; end; }
Try this!
how to use?
here:
map#<item ID>#<amount> if you want to give prices on your current map
all#<item ID>#<amount> if you want to give prices on all of your players
example: prontera#969#50 all players in prontera will receive 50x Gold
You have to whisper the npc
whisper to : npc:itemall
message : map#<item ID>#<amount> or all#<item ID>#<amount>
- 1
-
Wouldn't you prefer to put the items directly in the storage of the players?
- script MapReward -1,{ OnInit: //command : @mapreward <map name> <item id> {<amount>} bindatcmd "mapreward",strnpcinfo(0)+"::OnReward"; end; OnReward: .@rid = getcharid(3,strcharinfo(0)); .@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid); for (.@i = 0 ; .@i < .@n ; .@i++) { attachrid(.@aid[.@i]); if (strcharinfo(3) != .@atcmd_parameters$[0]) { deletearray .@aid[.@i],1 ; .@i-- ; .@n--; } } for (.@i = 0 ; .@i < .@n ; .@i++) { attachrid(.@aid[.@i]); if (.@atcmd_parameters$[2]=="") getitem atoi(.@atcmd_parameters$[1]),(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1); } if (attachrid(.@rid)) dispbottom ""+(.@n)+" players on "+.@atcmd_parameters$[0]+" received "+(.@atcmd_parameters$[2]!=""?atoi(.@atcmd_parameters$[2]):1)+" "+getitemname(atoi(.@atcmd_parameters$[1])); }
I changed it a bit so that you can add amounts
command : @mapreward <map name> <item id> {<amount>}
ex: '@mapreward prontera 512 10' will give all players in prontera 10 apples
'@mapreward prontera 512' will give all players in prontera 1 apple
-
ragnarok is a SQL table, it stores data from the game.
I don't remember the old times when I created my server so I can't tell you^^
-
- script MapReward -1,{ OnInit: bindatcmd "mapreward",strnpcinfo(0)+"::OnReward"; end; OnReward: .@rid = getcharid(3,strcharinfo(0)); .@n = query_sql ("SELECT DISTINCT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1'",.@aid); for (.@i = 0 ; .@i < .@n ; .@i++) { attachrid(.@aid[.@i]); if (strcharinfo(3) != .@atcmd_parameters$[1]) { deletearray .@aid[.@i],1 ; .@i-- ; .@n--; } } for (.@i = 0 ; .@i < .@n ; .@i++) { attachrid(.@aid[.@i]); getitem atoi(.@atcmd_parameters$[0]),1; } if (attachrid(.@rid)) dispbottom ""+(.@n)+" players on "+.@atcmd_parameters$[1]+" received 1 "+getitemname(atoi(.@atcmd_parameters$[0])); }
command : @mapreward <item id> <map name>
For the NPC I don't understand ^^
You mean the NPC makes all pkayers able to receive once an item of their choice (amongst a list)?
- 1
-
Server-Side:
The shop (put it in a script file)
- shop myshopname -1,512:-1,513:-1,514:-1
don't forget to put the items you want to sell and their prices
The item:
<ID>,My_Item_Name,My Item Name,2,10,,10,,,,,0xFFFFFFFF,63,2,,,,,,{callshop "myshopname",1;},{},{}
Client-Side:
newer than 2012-04-10a:
iteminfo.lub:
[<ID>] = { unidentifiedDisplayName = "My Item Name", unidentifiedResourceName = "Ä«ÇÁ¶óÀÌ¿ë±Ç", unidentifiedDescriptionName = { "Opens a shop.", "", "Weight: ^7777771^000000" }, identifiedDisplayName = "My Item Name", identifiedResourceName = "Ä«ÇÁ¶óÀÌ¿ë±Ç", identifiedDescriptionName = { "Opens a shop.", "", "Weight: ^7777771^000000" }, slotCount = 0, ClassNum = 0 },
older than 2012-04-10a:
idnum2itemdesctable.txt:
<ID># Opens a shop. Weight: ^7777771^000000 #
idnum2itemdisplaynametable.txt:
<ID>#My Item Name#
idnum2itemresnametable.txt
<ID>#Ä«ÇÁ¶óÀÌ¿ë±Ç#
Don't forget to edit the id and item name in all files
- 1
-
- script ScriptLoader -1,{ OnInit: setarray .script_locations$ , "npc/path/to/script1" , "npc/path/to/script2"; query_sql ("SELECT `account_id` FROM `ragnarok`.`char` WHERE `online` = '1' LIMIT 1",.@aid); if (.@aid == -1) end; else attachrid(.@aid); OnPCLoginEvent: if (!.set) { for (.@i = 0 ; .@i < getarraysize(.script_locations$) ; .@i++) atcommand "@loadnpc "+.script_locations$[.@i]; .set = 1; } }
Just so that it also loads the scripts on init because if you use '@reloadscript' you'd have to wait for someone to log on.
Not really convenient to test some scripts on your own..
-
Can't keep a promise, can i ?
Well it's almost done, the only thing left to do is to set up the modes combinations.
I've tested it to its limits, or so I believe so it should be stable (I can't list all the things I prevented because that would make an entire post^^)
I had to study for my finals that begins tomorrow so I didn't have enough time to finish but I'll post it tomorrow for sure.
Hope you'll enjoy, see you tomorrow!
-
- script ScriptLoader -1,{ OnInit: setarray .script_locations$ , "npc/path/to/script1" , "npc/path/to/script2"; end; OnPCLoginEvent: if (!.set) { for (.@i = 0 ; .@i < getarraysize(.script_locations$) ; .@i++) atcommand "@loadnpc "+.script_locations$[.@i]; .set = 1; } }
My bad I just forgot a '$'.
Never forget the $$ xD
- 1
-
Sorry if it takes some more time than expected, I'm adding a lot of features and I had to clean up the mess I made changing the whole data storing.
It'll be uploaded tomorrow.
The 'shopping' thing will look like this (still need a bit of work but it's almost done)
You can sell any time of equipment apart from bound ones
Everything displays accordingly
When two or more items of the same id are in the shop, you'll be asked which one you want to buy (since there's actually no way to display it directly in the shop)
You can also directly see the effects of the cards slotted in the items (credits to emistry, thank you if you pass by there^^)
You can disable it if you don't have a recent enough version, all the details are in the script
Wow that makes a lot of screens ><
Well it's just to let you know how it'll look like.
I still have to test it to its limits and to make sure there'll be no bugs (I found a funny one today and I really didn't expect it^^), get over with the ticket mode system (both will be usable at the same time if you want), make some things clearer and try to prevent some people from finding cheats.
I really care about bugs and cheats because I'm making a system which can be, if abused, used to duplicate any item and/or to get infinite money. That'd be as bad for you as it'd be for me
Well let me know if you have any ideas, I'm really curious about them ^^
- 1
-
Nice
It'll help me out a lot, thank you !
-
When someone get hit by script? What do you mean by that?
You know if you explain what you want to do in details I can surely do it for you. It's up to you.
-
no it's just to see them better than if they were one after another.
from my script editor it was aligned but when i CPed it it went wrong ^^
-
Well if this is the only solution...
- script ScriptLoader -1,{ OnInit: setarray .script_locations$ , "npc/path/to/script1" , "npc/path/to/script2"; end; OnPCLoginEvent: if (!.set) { for (.@i = 0 ; .@i < getarraysize(.script_locations$) ; .@i++) atcommand "@loadnpc "+.script_locations[.@i]; .set = 1; } }
Still it's really weird
- 1
-
No idea ^^
Does at least one of your custom scripts works? Maybe it's because you have too many of them?
Try to put your custom scripts at the begining of your scripts_custom.conf we never know.
Are the other scripts in scripts_custom.conf working? maybe it's because the whole file isn't loaded.
Try to put them in other .conf
-
Did you edit your trunk/npc/scripts_custom.conf ?
// -------------------------------------------------------------- // - Custom Scripts - // -------------------------------------------------------------- // All the custom scripts, remove the '//' to enable... // Place your scripts here! //npc: npc/location/to/script.txt
You can also use the '@loadnpc' command in-game if you don't want to load all of your NPCs automatically.
It would look like
@loadnpc npc/location/to/script.txt
-
Do you want it to prevent 'reloadscript' from reseting the timer?
- script hour_points -1,{ function AddPlayer; OnInit: setarray .maps$ , "morocc"; //maps where the system is active .points = 1; //number of points get after one hour for (.@i = 0 ; .@i < getarraysize(.maps$) ; .@i++) if (!getmapflag(.maps$[.@i],mf_loadevent)) setmapflag .maps$[.@i],mf_loadevent; initnpctimer; end; OnPCLoadMapEvent: for (.@i = 0 ; .@i < getarraysize(.maps$) ; .@i++) { if (.maps$[.@i] == strcharinfo(3)) { dispbottom "You entered a special zone and will now receive points every hour you spend there."; dispbottom "Please note that warping out of the map will reset your timer."; AddPlayer(strcharinfo(0),strnpcinfo(0)); } } end; OnTimer1000: //will check very second if player is still on the map for (.@i = 0 ; .@i < .player_amount ; .@i += 3) { if (!attachrid(getcharid(3,.players$[.@i])) || strcharinfo(3) != .players$[.@i+1]) { deletearray .players$[.@i],3 ; .player_amount -= 3; } } for (.@i = 0 ; .@i < .player_amount ; .@i += 3) { setarray .players$[.@i+2] , ""+(atoi(.players$[.@i+2]) + 1)+""; if (atoi(.players$[.@i+2]) >= 10 && attachrid(getcharid(3,.players$[.@i]))) { MapPoints += .points; dispbottom "You stayed one hour in this map and so earned "+.points+" map point"+(.points>1?"s":"")+"."; dispbottom "Your total points : "+MapPoints; setarray .players$[.@i+2] , "0"; } } initnpctimer; function AddPlayer { //player name , npc name for (.@i = 0 ; .@i < getvariableofnpc(.player_amount,getarg(1)) ; .@i += 3) if (getvariableofnpc(.players$[.@i],getarg(1)) == getarg(0)) return; setarray getvariableofnpc(.players$[getvariableofnpc(.player_amount,getarg(1))],getarg(1)) , getarg(0) , strcharinfo(3) , "0"; set getvariableofnpc(.player_amount,getarg(1)) , getvariableofnpc(.player_amount,getarg(1)) + 3; return; } }
this one doesn't support reloadscript and will reset all timers, it also won't start them back if players doesn't warp in the map again.
don't forget to edit these:
setarray .maps$ , "morocc"; //maps where the system is active .points = 1; //number of points get after one hour
-
Hey rA!
I'm trying to attach a script to a skill but I have no idea how to do that since I'm a real novice in source stuff.
Does anyone know how to call a scripting function from the source via skill.c or battle.c?
Thanks in advance
-
Guess you can't do that with switch, you'll have to put if statements.
You could do something like this
- script tokens -1,{ OnInit: bindatcmd "tokens",strnpcinfo(0)+"::OnTokens"; end; OnTokens: setarray .@list$ , "entrar","info","trocar"; for (.@i = 0 ; .@i < getarraysize(.@list$) ; .@i++) if (.@atcmd_parameters$[0] == .@list$[.@i]) .@num = .@i; switch(.@num) { case 1: warp "<location>",<x>,<y>; break; case 2: dispbottom "this is the info"; break; case 3: //don't know what you mean by change break; } if (!.@num) { dispbottom "unknown demand."; .@demands$ = .@list$; for (.@i = 1 ; .@i < getarraysize(.@list$) ; .@i++) .@demands$ = .@demands$ + " , "+.@list$[.@i]; dispbottom "Possible demands : "+.@demands$; } }
using an array position to convert a string to a number
Or you could use 1, 2, 3, etc.. as parameters and so use atoi
Combinning the two would be too complicated for what you intend to do
-
Go to your data\texture\À¯ÀúÀÎÅÍÆäÀ̽º\collection folder and add card_yellow.bmp
-
What is your script supposed to do?
-
amatsu,235,237,4 script healer 925,{ end; OnInit: freeloop(1); getmapxy( .m$, .x, .y, 1, strnpcinfo(0) ); OnTimer5000: initnpctimer; addrid( 4, 0, .x-15, .y-15, .x+15, .y+15 ); if( playerattached() ) { getinventorylist; .@len = @inventorylist_count; copyarray .@inventorylist_id, @inventorylist_id, .@len; copyarray .@inventorylist_identify, @inventorylist_identify, .@len; for ( .@j = 0; .@j < .@len; .@j++ ) { if ( !.@inventorylist_identify[.@j] ) { delitem2 .@inventorylist_id[.@j], 1, 0, 0, 0, 0, 0, 0, 0; getitem .@inventorylist_id[.@j], 1; } } if( HP < MAXHP ) { specialeffect2 EF_HEAL2; percentheal 100, 100; } repairall; } }
I have this in stock, I never used it and I don't even know who it belongs to xD
It'll heal, identify, repair all players around it every 5 seconds
oh sry I forgot blessing and agi
amatsu,235,237,4 script healer 925,{ //30 32 end; OnInit: freeloop(1); getmapxy( .m$, .x, .y, 1, strnpcinfo(0) ); OnTimer5000: initnpctimer; addrid( 4, 0, .x-15, .y-15, .x+15, .y+15 ); if( playerattached() ) { getinventorylist; .@len = @inventorylist_count; copyarray .@inventorylist_id, @inventorylist_id, .@len; copyarray .@inventorylist_identify, @inventorylist_identify, .@len; for ( .@j = 0; .@j < .@len; .@j++ ) { if ( !.@inventorylist_identify[.@j] ) { delitem2 .@inventorylist_id[.@j], 1, 0, 0, 0, 0, 0, 0, 0; getitem .@inventorylist_id[.@j], 1; } } if( HP < MAXHP ) { specialeffect2 EF_HEAL2; percentheal 100, 100; } if (!getstatus(30)) sc_start 30,240000,10; if (!getstatus(32))sc_start 32,240000,10; repairall; } }
-
Tell us exactly what you need to do, that's not really clear ^^
You can't use switch with strings because it's supposed to be used with numbers.
Server side doesnt read certain scripts. Why?
in General Support
Posted
It works for me, normally all your scripts should load when you execute the command '@loadnpc .../.../yourscript.txt
Does your mapserv show sql errors?
For the limit, you should be able to put as many scripts as you want as far as you don't exceed 128 so 16 shouldn't be a problem.
Does the script loadings fail or does it just not load them?
Again if you have errors please show them to me