View Single Post
Old 18.04.2007, 16:41   #7
GMan
Архивный участник
 
Join Date: Sep 2005
Posts: 198
Default

Well i was playing around and thinking about it, and noticed the when the handle starts by decreasing the count by 1 no matter what. So i figured that because of that, theres no need to see how many spawns are available, so i changed it to just spawn 1 no matter what. and now i share it

Code:
handler 1 115	//  ON_NPC_DELETED
	variable_begin
		"deleted_def"
		"i0"
		"i1"
		"i2"
		"maker0"
		"def0"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	//  i0
	push_const 260
	add
	push_reg_sp
	fetch_i
	push_event	//  myself
	push_const 656
	add
	fetch_i
	push_const 1
	func_call 167837699	//  func[DecreaseTotal]
	shift_sp -1
	assign4
	shift_sp -1
	push_event	//  i1
	push_const 264
	add
	push_reg_sp
	fetch_i
	push_event	//  deleted_def
	push_const 672
	add
	fetch_i
	push_const 1
	func_call 234946564	//  func[DecCount]
	shift_sp -1
	assign4
	shift_sp -1
	push_event	//  i1
	push_const 264
	add
	push_reg_sp
	fetch_i
	push_event	//  gg
	push_const 632
	add
	fetch_i
	push_event	//  myself
	push_const 656
	add
	fetch_i	//  def_count
	push_const 140
	add
	fetch_i4
	func_call 218169344	//  func[Rand]
	shift_sp -1
	assign4
	shift_sp -1
	push_event	//  def0
	push_const 664
	add
	push_reg_sp
	fetch_i
	push_event	//  myself
	push_const 656
	add
	fetch_i
	push_event	//  i1
	push_const 264
	add
	fetch_i4
	func_call 167837696	//  func[GetSpawnDefine]
	shift_sp -1
	assign
	shift_sp -1
	push_event	//  gg
	push_const 632
	add
	fetch_i
	push_event	//  def0
	push_const 664
	add
	fetch_i
	func_call 218169355	//  func[IsNull]
	shift_sp -1
	push_const 0
	equal
	branch_false L258758
L258757
//	push_event	//  i2
//	push_const 268
//	add
//	push_reg_sp
//	fetch_i
//	push_event	//  def0
//	push_const 664
//	add
//	fetch_i	//  total
//	push_const 140
//	add
//	fetch_i4
//	push_event	//  def0
//	push_const 664
//	add
//	fetch_i	//  npc_count
//	push_const 144
//	add
//	fetch_i4
//	sub
//	assign4
//	shift_sp -1
//	push_event	//  i2
//	push_const 268
//	add
//	fetch_i4
//	push_const 0
//	greater
//	branch_false L258760
L258759
	push_event	//  myself
	push_const 656
	add
	fetch_i
	push_const 1
	func_call 167837698	//  func[IncreaseTotal]
	shift_sp -1
	branch_false L258762
L258761
	push_event	//  def0
	push_const 664
	add
	fetch_i
	push_const 1
	func_call 234946563	//  func[IncCount]
	shift_sp -1
	shift_sp -1
	push_event	//  def0
	push_const 664
	add
	fetch_i
	push_const 1
	push_event	//  def0
	push_const 664
	add
	fetch_i	//  respawn_time
	push_const 148
	add
	fetch_i4
	func_call 235012096	//  func[Spawn]
	shift_sp -2
	shift_sp -1
L258762
L258760
L258758
handler_end
I left outthe if check as well but just commented it out incase you want to have it check that.. if so just uncomment and increase the line count.

and decompiled for easy view
Code:
	EventHandler ON_NPC_DELETED(deleted_def,i0,i1,i2,maker0,def0)
	{
		i0 = myself->DecreaseTotal(1);
		deleted_def->DecCount(1);
		i1 = gg->Rand(myself.total);
		def0 = myself->GetSpawnDefine(i1);
		if( gg->IsNull(def0) == 0 )
		{
			if( myself->IncreaseTotal(1) )
			{
				def0->IncCount(1);
				def0->Spawn(1,def0.respawn_time);
			}
		}
	}
To install just over write the ON_NPC_DELETED handel on the random_spawn class.

I have not fully tested this but after randomly checking the NPC console i have not seen any more errors in the last 24 hours.
GMan is offline