View Single Post
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