Mumbles Posted February 21, 2013 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 127 Reputation: 36 Joined: 01/21/13 Last Seen: July 25, 2014 Share Posted February 21, 2013 (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 February 21, 2013 by Via Quote Link to comment Share on other sites More sharing options...
Capuche Posted February 21, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted February 21, 2013 (edited) if( rand(1) ) bonus2 bAddMonsterDropItem,908,200; else bonus2 bAddMonsterDropItem,909,200; ? forget it won't work Edited February 21, 2013 by Capuche Quote Link to comment Share on other sites More sharing options...
Mumbles Posted February 21, 2013 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 127 Reputation: 36 Joined: 01/21/13 Last Seen: July 25, 2014 Author Share Posted February 21, 2013 (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 February 21, 2013 by Via Quote Link to comment Share on other sites More sharing options...
Ajjwidjdneidjenw Posted February 21, 2013 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 161 Reputation: 31 Joined: 12/06/11 Last Seen: December 25, 2022 Share Posted February 21, 2013 (edited) bonus2 bAddMonsterDropItem,(rand(1)? 908:909),200; Nevermind, what Capuche said I'll look into it later, bed first ~_~. Edited February 21, 2013 by Jeroen Quote Link to comment Share on other sites More sharing options...
Brian Posted February 21, 2013 Group: Members Topic Count: 75 Topics Per Day: 0.02 Content Count: 2223 Reputation: 593 Joined: 10/26/11 Last Seen: June 2, 2018 Share Posted February 21, 2013 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. It should be rand(2) if you want it to return 0 or 1. Quote Link to comment Share on other sites More sharing options...
Capuche Posted February 21, 2013 Group: Developer Topic Count: 10 Topics Per Day: 0.00 Content Count: 2407 Reputation: 616 Joined: 07/05/12 Last Seen: March 20 Share Posted February 21, 2013 (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 February 21, 2013 by Capuche 1 Quote Link to comment Share on other sites More sharing options...
Mumbles Posted February 21, 2013 Group: Members Topic Count: 23 Topics Per Day: 0.01 Content Count: 127 Reputation: 36 Joined: 01/21/13 Last Seen: July 25, 2014 Author Share Posted February 21, 2013 Sigh. I mean, the logic seems right in either case; why *Athena doesn't already support variables in item scripts by now is beyond me. ;~; Brian, halp! 1 Quote Link to comment Share on other sites More sharing options...
michaelsoftman Posted February 22, 2013 Group: Members Topic Count: 48 Topics Per Day: 0.01 Content Count: 410 Reputation: 29 Joined: 04/04/12 Last Seen: November 28, 2024 Share Posted February 22, 2013 (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 February 22, 2013 by michaelsoftman 1 Quote Link to comment Share on other sites More sharing options...
Ajjwidjdneidjenw Posted February 22, 2013 Group: Members Topic Count: 15 Topics Per Day: 0.00 Content Count: 161 Reputation: 31 Joined: 12/06/11 Last Seen: December 25, 2022 Share Posted February 22, 2013 (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 February 22, 2013 by Jeroen 1 Quote Link to comment Share on other sites More sharing options...
Question
Mumbles
I'd like to know if such a result is possible:
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 ViaLink to comment
Share on other sites
8 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.