Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 25.12.2005, 20:36   #1
khul
Архивный участник
 
Join Date: Oct 2005
Posts: 153
Default 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
khul is offline  
Old 25.12.2005, 21:08   #2
filrip
Архивный участник
 
Join Date: May 2005
Posts: 99
Default

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
MINIMUM is the minimum number of arrow give, you can set it to 0
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...)
filrip is offline  
Old 25.12.2005, 22:47   #3
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

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
toolpunk is offline  
Old 25.12.2005, 22:53   #4
filrip
Архивный участник
 
Join Date: May 2005
Posts: 99
Default

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
filrip is offline  
Old 26.12.2005, 05:43   #5
srh
Архивный участник
 
Join Date: Aug 2005
Posts: 145
Default

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
srh is offline  
Old 26.12.2005, 10:41   #6
Mirror
Архивный участник
 
Join Date: Oct 2005
Posts: 330
Default

maybe wishing potion quest ai.obj code will help
Mirror is offline  
Old 27.12.2005, 01:55   #7
khul
Архивный участник
 
Join Date: Oct 2005
Posts: 153
Default

any other info ? ive tryed adidng toolpunk idea and ai presents error. Maybe i introduced code badly. Any ideas?
khul is offline  
Old 27.12.2005, 02:49   #8
filrip
Архивный участник
 
Join Date: May 2005
Posts: 99
Default

toolpunk ai code must work
filrip is offline  
Old 27.12.2005, 02:56   #9
filrip
Архивный участник
 
Join Date: May 2005
Posts: 99
Default

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
MINIMUM ITEM and MORE ITEM TO GIVE is still as my first example.

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.
filrip is offline  
Old 27.12.2005, 17:54   #10
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

WOOT!
i produced working ai code
this is the first time... XD
toolpunk is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:15.