Mumbles Posted February 21, 2013 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
Capuche Posted February 21, 2013 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
Mumbles Posted February 21, 2013 Author 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
Ajjwidjdneidjenw Posted February 21, 2013 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
Brian Posted February 21, 2013 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
Capuche Posted February 21, 2013 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
Mumbles Posted February 21, 2013 Author 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
michaelsoftman Posted February 22, 2013 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
Ajjwidjdneidjenw Posted February 22, 2013 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
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 Via8 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.