Zeke Posted February 4, 2014 Group: Members Topic Count: 9 Topics Per Day: 0.00 Content Count: 21 Reputation: 0 Joined: 12/05/13 Last Seen: March 9, 2016 Share 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 Link to comment Share on other sites More sharing options...
TecnoCronus Posted February 4, 2014 Group: Members Topic Count: 3 Topics Per Day: 0.00 Content Count: 8 Reputation: 3 Joined: 02/04/12 Last Seen: December 2, 2023 Share 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 Link to comment Share on other sites More sharing options...
-SkittleNugget- Posted February 4, 2014 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 318 Reputation: 54 Joined: 12/23/12 Last Seen: July 1, 2017 Share 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 Link to comment Share on other sites More sharing options...
Skorm Posted February 6, 2014 Group: Forum Moderator Topic Count: 33 Topics Per Day: 0.01 Content Count: 1282 Reputation: 393 Joined: 02/03/12 Last Seen: April 11 Share 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 Link to comment Share on other sites More sharing options...
Missingno Posted February 6, 2014 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 135 Reputation: 41 Joined: 02/05/14 Last Seen: December 23, 2022 Share 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 Link to comment Share on other sites More sharing options...
-SkittleNugget- Posted February 6, 2014 Group: Members Topic Count: 11 Topics Per Day: 0.00 Content Count: 318 Reputation: 54 Joined: 12/23/12 Last Seen: July 1, 2017 Share Posted February 6, 2014 Both should work. += is more appropriate as your adding the variable itself to something. Quote Link to comment Share on other sites More sharing options...
Missingno Posted February 10, 2014 Group: Members Topic Count: 7 Topics Per Day: 0.00 Content Count: 135 Reputation: 41 Joined: 02/05/14 Last Seen: December 23, 2022 Share 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 Link to comment Share on other sites More sharing options...
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...
Link to comment
Share on other sites
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.