![]() |
AI help- RANDOM chance to GIVE ITEM from AI
As topic says i need help with AI
I want to modify the code for s_quiver_of_arrow posted in this forum so mob doesnt always give the item when is despawned. Actual code gives item ALWAYS when NPC despawns. I need NPC to give item only SOMETIMES. here is actual code if some1 can modify it accordying to my request i ll very much apreciate it. thanks a lot. class summon_mithril_arrow : (null) handler 13 // CREATED variable_begin "myself" "_choiceN" "_code" "_from_choice" variable_end shift_sp 1 push_event // myself push_const 28 add fetch_i // master push_const 2404 add fetch_i push_const 1344 shift_sp 1 push_const 1320 func_call 55 // func[Rand] shift_sp -1 push_const 480 add func_call 77 // func[GiveItem1] shift_sp -3 shift_sp -1 shift_sp 1 func_call 175 // func[Despawn] shift_sp -1 handler_end class_end |
Code:
class summon_mithril_arrow : (null)MORE RANDOM is the number added to the MINIMUM, but randomly set between 0 and the number you set. You can set it to 0 to give only MINIMUM quantity of the item not tested if minimum = 0 and random return 0... i recommand that you set minimum to 1 to prevent crash of l2npc.exe (else it will try to give 0 arrow in this condition... can crash perhaps...) |
i thought of adding another func_call 55
heres an example: LXXXX shift_sp 1 push_const 4 func_call 55 shift_sp -1 push_const 0 greater branch_false LXXXXX //end of code -> no items given though im not sure if this would work out since its my own idea lol :D in this case the player would have a 75% chance of getting the item ;) |
lol, i have just see that i havent understand correctly the question, too bad my english
the code i have give does not answer to your request sorry lol. i have understand, as you can see, give random number of item, instead of give or not the item. sorry |
i think this is about crismass tree :)
ex: announce: prizes around giran :) ppl get search around giran and if they found him - then they may be get prizes :) |
maybe wishing potion quest ai.obj code will help :)
|
any other info ? ive tryed adidng toolpunk idea and ai presents error. Maybe i introduced code badly. Any ideas?
|
toolpunk ai code must work
|
if you still have problem, here is a demonstration :
Code:
class summon_mithril_arrow : (null)MAXIMUM RANDOM set the maximum number of chance to give the item. MINIMUM TO GIVE is the number of chance of the player. In this example, i have set 100 to max and 49 to have. So it's like a percent., you have 50% of chance to have the item. l2npc.exe choice randomly a number between 0 and 99 ( Rand(100) ). if this number is greater than 49, then it give the item. |
WOOT!
i produced working ai code :D this is the first time... XD |
| All times are GMT. The time now is 15:25. |