Zeke Posted February 4, 2014 Posted February 4, 2014 (edited) - script treasurebox_event -1,{ OnInit: // treasure box id + amount to spawn setarray .treasure_box,1902,1; // map list setarray .map$, "geffen"; // zeny gain upon killing box .gain_zeny = 1000000; // item gain upon killing box setarray .item,607,3,671,5; .map_size = getarraysize( .map$ ); .item_size = getarraysize( .item ); .npc_name$ = strnpcinfo(0); // end; OnClock0200: OnClock0400: OnClock0600: OnClock0800: OnClock1000: OnClock1200: OnClock1400: OnClock1600: OnClock1800: OnClock2000: OnClock2200: OnClock0000: // etc .@index = rand( .map_size ); .map_name$ = setchar( .map$[.@index], strtoupper( charat( .map$[.@index],0 ) ), 0 ); announce "A Rare Treasure Box has Been Spawned "+.treasure_box[1]+" x "+getmonsterinfo( .treasure_box[0],MOB_NAME )+" at "+.map_name$,bc_all; // monster .map$,0,0,"--ja--",.treasure_box[0],.treasure_box[1],.npc_name$+"::OnKill"; monster .map$[.@index],0,0,"--ja--",.treasure_box[0],.treasure_box[1],.npc_name$+"::OnKill"; end; OnKill: .@box_amount = mobcount( strcharinfo(3),.npc_name$+"::OnKill" ); Zeny += .gain_zeny; if( .item_size > 1 ) for( .@i = 0; .@i < ( .item_size - 1 ); .@i += 2 ) getitem .item[.@i],.item[.@i+1]; announce strcharinfo(0)+" Gained "+.gain_zeny+" Zeny, 3 Yggdrasil Berries & 5 RO Coins for Killing the Treasure Box. "+( ( .@box_amount )?"Left "+.@box_amount+" at "+.map_name$:"" )+".",bc_all; end; } Edited February 4, 2014 by Skorm Added code box there were no tabs x_x... Quote
TecnoCronus Posted February 4, 2014 Posted February 4, 2014 (edited) Please post the erros too, Looking quickly, I found this error: Zeny += .gain_zeny; it should be set Zeny += gain_zeny; Edited February 4, 2014 by TecnoCronus Quote
-SkittleNugget- Posted February 4, 2014 Posted February 4, 2014 eAMod, is based on the eAthena Emulator. rAthena scripting syntax has alot of things eAthena does not have which means you will need to rewrite for it to work if it doesn't initially. Quote
Skorm Posted February 6, 2014 Posted February 6, 2014 Hmm try... - script treasurebox_event -1,{ OnInit: setarray .treasure_box,1902,1; // treasure box id + amount to spawn setarray .map$, "geffen"; // map list set .gain_zeny, 1000000; // zeny gain upon killing box setarray .item,607,3,671,5; // item gain upon killing box set .map_size, getarraysize( .map$ ); set .item_size, getarraysize( .item ); set .npc_name$, strnpcinfo(0); // end; OnClock0200: OnClock0400: OnClock0600: OnClock0800: OnClock1000: OnClock1200: OnClock1400: OnClock1600: OnClock1800: OnClock2000: OnClock2200: OnClock0000: set .@index, rand( .map_size ); announce "A Rare Treasure Box has Been Spawned "+.treasure_box[1]+" x "+getmonsterinfo( .treasure_box[0],MOB_NAME )+" at "+.map$[.@index],bc_all; monster .map$[.@index],0,0,"--ja--",.treasure_box[0],.treasure_box[1],.npc_name$+"::OnKill"; end; OnKill: set .@box_amount, mobcount( strcharinfo(3),.npc_name$+"::OnKill" ); set Zeny, Zeny+.gain_zeny; if( .item_size > 1 ) for( set(.@i, 0); .@i < ( .item_size - 1 ); set(.@i,.@i + 2) ) getitem .item[.@i],.item[.@i+1]; announce strcharinfo(0)+" Gained "+.gain_zeny+" Zeny, 3 Yggdrasil Berries & 5 RO Coins for Killing the Treasure Box. "+( ( .@box_amount )?"Left "+.@box_amount+" at "+.map_name$:"" )+".",bc_all; end; } Quote
Missingno Posted February 6, 2014 Posted February 6, 2014 Please post the erros too, Looking quickly, I found this error: Zeny += .gain_zeny; it should beset Zeny += gain_zeny; Uh...this is still wrong lol; in fact, it wouldn't even work on eAthena or eAmod. The proper conversion would be: set Zeny, Zeny + .gain_zeny;Variables that were set in a similar manner should follow this conversion for the script to run properly; that or just drop eAmod and use a real emulator. Quote
-SkittleNugget- Posted February 6, 2014 Posted February 6, 2014 Both should work. += is more appropriate as your adding the variable itself to something. Quote
Missingno Posted February 10, 2014 Posted February 10, 2014 Both should work. += is more appropriate as your adding the variable itself to something. Yes, but neither eAthena nor rAthena accept assignments in that manner (=, +=, -=, *=, /=, etc.) using set. Read the documentation or the Wiki article for set if you're still confused. Quote
Question
Zeke
- script treasurebox_event -1,{
OnInit:
// treasure box id + amount to spawn
setarray .treasure_box,1902,1;
// map list
setarray .map$,
"geffen";
// zeny gain upon killing box
.gain_zeny = 1000000;
// item gain upon killing box
setarray .item,607,3,671,5;
.map_size = getarraysize( .map$ );
.item_size = getarraysize( .item );
.npc_name$ = strnpcinfo(0);
// end;
OnClock0200:
OnClock0400:
OnClock0600:
OnClock0800:
OnClock1000:
OnClock1200:
OnClock1400:
OnClock1600:
OnClock1800:
OnClock2000:
OnClock2200:
OnClock0000:
// etc
.@index = rand( .map_size );
.map_name$ = setchar( .map$[.@index], strtoupper( charat( .map$[.@index],0 ) ), 0 );
announce "A Rare Treasure Box has Been Spawned "+.treasure_box[1]+" x "+getmonsterinfo( .treasure_box[0],MOB_NAME )+" at "+.map_name$,bc_all;
// monster .map$,0,0,"--ja--",.treasure_box[0],.treasure_box[1],.npc_name$+"::OnKill";
monster .map$[.@index],0,0,"--ja--",.treasure_box[0],.treasure_box[1],.npc_name$+"::OnKill";
end;
OnKill:
.@box_amount = mobcount( strcharinfo(3),.npc_name$+"::OnKill" );
Zeny += .gain_zeny;
if( .item_size > 1 )
for( .@i = 0; .@i < ( .item_size - 1 ); .@i += 2 )
getitem .item[.@i],.item[.@i+1];
announce strcharinfo(0)+" Gained "+.gain_zeny+" Zeny, 3 Yggdrasil Berries & 5 RO Coins for Killing the Treasure Box. "+( ( .@box_amount )?"Left "+.@box_amount+" at "+.map_name$:"" )+".",bc_all;
end;
}
Added code box there were no tabs x_x...
6 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.