![]() |
|
|
#1 |
|
Архивный участник
Join Date: Oct 2005
Posts: 153
|
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 |
|
|
|
|
#2 |
|
Архивный участник
Join Date: May 2005
Posts: 99
|
Code:
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 push_const 10 // MINIMUM shift_sp 1 push_const 20 // MORE RANDOM func_call 55 // func[Rand] shift_sp -1 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 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...) |
|
|
|
|
#3 |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
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 ![]() in this case the player would have a 75% chance of getting the item
|
|
|
|
|
#4 |
|
Архивный участник
Join Date: May 2005
Posts: 99
|
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 |
|
|
|
|
#5 |
|
Архивный участник
Join Date: Aug 2005
Posts: 145
|
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
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: Oct 2005
Posts: 330
|
maybe wishing potion quest ai.obj code will help
|
|
|
|
|
#7 |
|
Архивный участник
Join Date: Oct 2005
Posts: 153
|
any other info ? ive tryed adidng toolpunk idea and ai presents error. Maybe i introduced code badly. Any ideas?
|
|
|
|
|
#8 |
|
Архивный участник
Join Date: May 2005
Posts: 99
|
toolpunk ai code must work
|
|
|
|
|
#9 |
|
Архивный участник
Join Date: May 2005
Posts: 99
|
if you still have problem, here is a demonstration :
Code:
class summon_mithril_arrow : (null) handler 13 // CREATED variable_begin "myself" "_choiceN" "_code" "_from_choice" variable_end shift_sp 1 push_const 100 // MAXIMUM RANDOM func_call 55 // func[Rand] shift_sp -1 push_const 49 // MINIMUM TO GIVE greater branch_false L1445 L1444 shift_sp 1 push_event // myself push_const 28 add fetch_i // master push_const 2404 add fetch_i push_const 1344 push_const 10 // MINIMUM ITEM shift_sp 1 push_const 20 // MORE ITEM TO GIVE func_call 55 // func[Rand] shift_sp -1 add func_call 77 // func[GiveItem1] shift_sp -3 shift_sp -1 L1445 shift_sp 1 func_call 175 // func[Despawn] shift_sp -1 handler_end class_end 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. |
|
|
|
|
#10 |
|
Архивный участник
Join Date: May 2005
Posts: 2,033
|
WOOT!
i produced working ai code ![]() this is the first time... XD |
|
|
|
|