Jump to content
  • 0

Need help to make this script work with eamod ?


Zeke

Question


  • Group:  Members
  • Topic Count:  9
  • Topics Per Day:  0.00
  • Content Count:  21
  • Reputation:   0
  • Joined:  12/05/13
  • Last Seen:  


- 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 by Skorm
Added code box there were no tabs x_x...
Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  8
  • Reputation:   3
  • Joined:  02/04/12
  • Last Seen:  

Please post the erros too,

 

 

Looking quickly, I found this error:

Zeny += .gain_zeny;

it should be

set Zeny += gain_zeny;
 
Edited by TecnoCronus
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

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.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

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;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   41
  • Joined:  02/05/14
  • Last Seen:  

Please post the erros too,

Looking quickly, I found this error:

Zeny += .gain_zeny;
it should be
set 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.
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  11
  • Topics Per Day:  0.00
  • Content Count:  318
  • Reputation:   54
  • Joined:  12/23/12
  • Last Seen:  

Both should work.

+= is more appropriate as your adding the variable itself to something.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  135
  • Reputation:   41
  • Joined:  02/05/14
  • Last Seen:  

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...