View Single Post
Old 10.03.2007, 19:02   #4
evern
Архивный участник
 
Join Date: Jul 2006
Posts: 46
Default

Thanks to fidows post i am able begin my first attempt to add skills that buff stats, i'm able to add a kind of validation to whether players buff stack on this by retaining the summon until a certain period using TIMER_FIRED, which when it will die and negate the stats, but a major problem arise because players can select the summon and unsummoning it manually, this causing the AI not able to negate the stats before the timer runs out.

i tried a few methods but to no avail...........

1) negate the stats upon MY_DYING
problem: MY_DYING doesn't work when players unsummon them manually
s
2) negate the stats upon TALKED and TALK_SELECTED
problem: doesn't work either

so here's my question

1) what are the parameter that is passed in to MENU_SELECTED when players click unsummon? (maybe this method works?)

2) is there any other way around this?

any help appreciated... really.... i'm stucked for days... thanks in advance

Code:
class stat_inc_skills : default_npc
{
parameter:
	int	Stat = 0;
	int	Amount = 0;

handler:
	EventHandler CREATED()
	{
		myself->AddTimerEx(3000,1000);
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0,i1)
	{
		if( timer_id == 3000 )
		{
			i0 = Stat;
			i1 = Amount;
			myself->IncrementParam(myself.master,i0,i1);
                        despawn();
		}
	}

}
Code:
class 1 stat_inc_skills : default_npc
parameter_define_begin
	int Stat 0
	int Amount 0
parameter_define_end
handler 13 17	//  CREATED
	variable_begin
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_const 3000
	push_const 1000
	func_call 184680487	//  func[AddTimerEx]
	shift_sp -2
	shift_sp -1
handler_end

handler 12 540	//  TIMER_FIRED_EX
	variable_begin
		"timer_id"
		"i0"
		"i1"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	//  timer_id
	push_const 236
	add
	fetch_i4
	push_const 3000
	equal
	branch_false L12899
L12898
	push_event	//  i0
	push_const 260
	add
	push_reg_sp
	fetch_i
	push_parameter Stat
	assign4
	shift_sp -1
L12900
	push_event	//  i1
	push_const 264
	add
	push_reg_sp
	fetch_i
	push_parameter Amount
	assign4
	shift_sp -1
L12901
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  myself
	push_const 704
	add
	fetch_i	//  master
	push_const 552
	add
	fetch_i
	push_event	//  i0
	push_const 260
	add
	fetch_i4
	push_event	//  i1
	push_const 264
	add
	fetch_i4
	func_call 184746219	//  func[IncrementParam]
	shift_sp -3
	shift_sp -1
L12902
	push_event	//  myself
	push_const 704
	add
	fetch_i
	func_call 184549616	//  func[Despawn]
	shift_sp -1
L12899
handler_end

class_end
evern is offline