Post Pacific  

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

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 27.03.2006, 07:05   #1
Met45
Архивный участник
 
Join Date: Jan 2006
Posts: 281
Default [Share]How to make NPC's "Aggro"

Hi ppl,

I don't know if this was postet before, but I will give some new ppl a hint how they can make their NPCs defending themselve...

here we go:

u have to edit the superclass, for this example i choose the teleporter super class...

Code:
class teleporter : default_npc
parameter_define_begin
	string ShopName ""
	string fnHi "thi.htm"
	string fnYouAreChaotic "tcm.htm"
parameter_define_end
property_define_begin
	telposlist_begin Position
		{"<left>"; -84169; 244693; -3729; 0; 0 }
	telposlist_end
property_define_end

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

handler 1	// ATTACKED
	variable_begin
		"attacker"
		"damage"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	shift_sp 1
	push_event	// attacker
	push_const 36
	add
	fetch_i
	push_const 0
	push_const 2000
	func_call 2	// func[AddAttackDesire]
	shift_sp -3
	shift_sp -1
handler_end

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

handler 3	//  TALKED
	variable_begin
		"talker"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	//  talker
	push_const 32
	add
	fetch_i	//  karma
	push_const 412
	add
	fetch_i
	push_const 0
	greater
	branch_false L768
L767
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_parameter fnYouAreChaotic
	func_call 43	//  func[ShowPage]
	shift_sp -2
	shift_sp -1
	jump L769
L768
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_parameter fnHi
	func_call 43	//  func[ShowPage]
	shift_sp -2
	shift_sp -1
L769
handler_end

handler 28	//  TELEPORT_REQUESTED
	variable_begin
		"talker"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
	push_property Position
	push_parameter ShopName
S73.	""
	push_string S73
S74.	""
	push_string S74
S75.	""
	push_string S75
	func_call 45	//  func[Teleport]
	shift_sp -6
	shift_sp -1
handler_end

class_end
u have to add the ATTACK handler 1, then ur NPC's hit an attacker back

I hope this "guide" will help a few ppl

thx MEt45
Met45 is offline  
Old 27.03.2006, 07:19   #2
-=KIRALEX=-
Архивный участник
 
Join Date: Mar 2006
Posts: 17
Default

It is old as the world
or
Ist wie die Welt{Frieden} alt
-=KIRALEX=- is offline  
Old 27.03.2006, 07:27   #3
Met45
Архивный участник
 
Join Date: Jan 2006
Posts: 281
Default

sry I only want to sharre something ^^
Met45 is offline  
Old 27.03.2006, 07:44   #4
-=KIRALEX=-
Архивный участник
 
Join Date: Mar 2006
Posts: 17
Default

For kids nask

NPC Answers attack
Code:
	EventHandler ATTACKED(attacker,	damage)
	{
		AddAttackDesire(attacker, @AMT_MOVE_TO_TARGET, 2000);
	}
NPC Sees karma and beats the player
Code:
	EventHandler SEE_CREATURE(creature)
	{
		if(creature.karma > 0)
		{	
			AddAttackDesire(creature, @AMT_MOVE_TO_TARGET, 1500);
		}
	}
-=KIRALEX=- is offline  
Old 27.03.2006, 07:52   #5
Mark20
Архивный участник
 
Join Date: Jan 2006
Posts: 54
Default

Quote:
Originally Posted by -=KIRALEX=-
For kids nask

NPC Answers attack
Code:
	EventHandler ATTACKED(attacker,	damage)
	{
		AddAttackDesire(attacker, @AMT_MOVE_TO_TARGET, 2000);
	}
NPC Sees karma and beats the player
Code:
	EventHandler SEE_CREATURE(creature)
	{
		if(creature.karma > 0)
		{	
			AddAttackDesire(creature, @AMT_MOVE_TO_TARGET, 1500);
		}
	}

but i think with this AI , NPC run behing player, with Met45 only attack, if think is best only attack, i don't want my gatekeepers running for the city
Mark20 is offline  
Old 27.03.2006, 07:53   #6
Met45
Архивный участник
 
Join Date: Jan 2006
Posts: 281
Default

that's right mark ^^
Met45 is offline  
Old 27.03.2006, 07:56   #7
Megatronpt
Архивный участник
 
Join Date: Jan 2006
Posts: 584
Default

Well... for efficient damage.. you could try using Baium skills!
That way.. even if the player runs away.. it won't go far..
Megatronpt 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 18:15.