Jump to content
  • 0

Quick question regarding || (or) in item scripts.


Question

Posted (edited)

I'd like to know if such a result is possible:

if(Class == Job_Assassin || Class == Job_Assassin_Cross) { bonus2 bAddMonsterDropItem,908,200; || bonus2 bAddMonsterDropItem,909,200; }

 

The objective is:

[Assassin, Assassin Cross]

Add a 20% chance of gaining 'Jellopy' or 'Spawn' when a monster is killed.

 

Please note this is simply an example. The key word here is "or", with the goal of adding a chance to gain either a Jellopy or Spawn; not a chance to gain both.

Edited by Via

8 answers to this question

Recommended Posts

Posted (edited)

Can we use variables in item scripts? o3o

if(Class == Job_Assassin || Class == Job_Assassin_Cross) { for(set @var,rand(908,909); countitem(@var) > 0; set @var,rand(908,909) do(bonus2 bAddMonsterDropItem,@var,200;) }

 

I'm at school so I can't exactly test this til later today. Halp ;~;

Edited by Via
Posted
if( rand(1) ) bonus2 bAddMonsterDropItem,908,200; else bonus2 bAddMonsterDropItem,909,200;
?

 

forget it won't work

 
bonus2 bAddMonsterDropItem,(rand(1)? 908:909),200;
 

Nevermind, what Capuche said I'll look into it later, bed first ~_~.

rand(1) always returns 0. :P

It should be rand(2) if you want it to return 0 or 1.

Posted (edited)

XD! Where are you my beloved brain ?!

 

 

 

btw none of us find an answer

Add a 20% chance of gaining 'Jellopy' or 'Spawn' when a monster is killed.

bonus2 bAddMonsterDropItem,(rand(2)? 908:909),200; just add 1 bonus when player equip the item

 

I think you need source modification

Edited by Capuche
  • Upvote 1
Posted (edited)

There's a backwards way around this.

 

Have the item call a function when equipped. 

 

if(Class == Job_Assassin || Class == Job_Assassin_Cross) { callfunc "awesomefunc"; }

 

In that function, have an 'OnNPCKillEvent' label with code like this in it:

OnNPCKillEvent:
set .@number,rand(0,1);
if (.@number == 0) {
     set .@drop,rand(0,9);
     if (.@drop < 2) 
          getitem 908,1;
}

else if (.@number == 1) {
     set .@drop,rand(0,9);
     if (.@drop < 2) 
          getitem 909,1;
}
break;
Edited by michaelsoftman
  • Upvote 1
Posted (edited)

How do item effects work anyway? I mean they have to be refreshed by re-equiping everytime. Anyway here's a little work around

 

-    script    IDrop    -1,{

OnNPCKillEvent:
    If(isequiped(.id))
        if(!rand(.chance))
            getitem (rand(2)? 908:909),1;
    end;

//Config
OnInit:
 set .id,1002; //Item ID of the item needed for the drop chance
 set .chance,5; //Chance of drop rate (2 = 1 in 2 (50%) 3 = 1 in 3 (33%), 4 = 1 in 4 (25%) etc.
 end;
 
}
Edited by Jeroen
  • Upvote 1

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...