Jump to content
  • 0

Question

Posted (edited)

I am trying to create a script that when an mvp monster is killed it will reward an item. I'm no good at scripting I am just trying to understand how it works and all. Is this the correct way? 

 

 

- script MVPBox -1,{

        OnNPCKillEvent:
        setarray .@BOSSID[0],1511,1038,1272,1389,1086,1251;
        setarray .@HMVP[0],1647,1785,1630,1039,1874,2068,2238,2240,2236,2253,1719,1046,1112,1115,1418,1871,1252,2251,1768,2165,1885,2241,1649,1651,1832,1492,2255,1734,2202,1779;
                if ( getmonsterinfo( killedrid,22) && getarraysize( .@BOSSID ) ) {
                                getitem 13909,1;
                }
                else if ( getmonsterinfo( killedrid,22) && getarraysize( .@HMVP ) ) {
                                getitem 19508,1;
               }
      end;
}

 

I don't think its working at all. What I have in mind is mvp box will drop when the mvp spawn time is 1-2 hours and another mvp box when the mvp spawn time is more than 2 hours.

 

Thanks in advance.

Edited by mathibas

2 answers to this question

Recommended Posts

Posted

I'm a rookie in scripting, but this does not seem to be right to me:

if ( getmonsterinfo( killedrid,22) && getarraysize( .@BOSSID ) ) {

getarraysize returns the size of the array, and not whether the item is inside the array or not. You need to do a search in the arrays you defined.

Currently you need to loop through the arrays and check every item, but someday this might get into prod

http://rathena.org/board/topic/92070-suggestion-new-scriptcommand-search-array/

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...