Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела

Notices

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 10.05.2007, 11:31   #1
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default universal NPC that charge you fee

Hi all
Im trying to create universal AI code that I can put into any AI NPC and it will charge player some fee and THEN do it something.. (something thats already in npc)

Im currently looking in public_wyvern AI code because its seems to be easies code but I dont know how to strip that AI code to have there simply the charge.

My idea is - I have NPC buffer, I have NPC that give you custom pet..
OK but what if I want ppl will be charged for this service? I want simply some AI code that will paste into AI of that service NPCS and it will simply charge people..

is this possible?

AI.code start
head of npc
--
AI that will charge you
---
AI that will provide some service

? If yes, can anyone give me here code that I can simply paste before AI code that provide some service?

I understand AI - but only a little.. I can read it.. but it seems to me its litle complicated.. full of jumps..etc.. Why its not continual like php..etc? I dont understand where to put that code in which part of NPC AI because I cant find where one thing start and second end..

maybe this part of code will work?

Code:
class 1 buffer_npc : default_npc
parameter_define_begin
	string fnHi "some-service-menu.htm"
        string fnYouAreChaotic "chaotic.htm"
        string fnNotEnoughAdena "adena.htm"
        string fnWait "wait.htm"
        int ItemBuff 57
        int Amount 50000
        int Delay 500
parameter_define_end

handler 13 11	//  CREATED
	variable_begin
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end

	push_event	//  myself
	push_const 704
	add
	fetch_i	//  i_ai0
	push_const 308
	add
	push_reg_sp
	fetch_i
	push_const 0
	assign4
	shift_sp -1
handler_end

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

	push_event	//  talker
	push_const 40
	add
	fetch_i	//  karma
	push_const 468
	add
	fetch_i4
	push_const 0
	greater
	branch_false L2
L1
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_parameter fnYouAreChaotic
	func_call 184680516	//  func[ShowPage]
	shift_sp -2
	shift_sp -1
	jump L3
L2
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_parameter fnHi
	func_call 184680516	//  func[ShowPage]
	shift_sp -2
	shift_sp -1
L3
handler_end

handler 32 134	//  MENU_SELECTED
	variable_begin
		"talker"
		"ask"
		"reply"
		"myself"
		"_choiceN"
		"_code"
		"_from_choice"
	variable_end
        
	push_event	//  ask
	push_const 160
	add
	fetch_i4
	push_const 201
        negate
	equal
	push_reg_sp
	fetch_i        
	branch_false L4
	shift_sp 1
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_parameter ItemBuff
	func_call 184680579	//  func[OwnItemCount]
	shift_sp -2
	push_parameter Amount
	greater_equal
	and
L4
	branch_false L5
L6
	push_event	//  myself
	push_const 704
	add
	fetch_i	//  i_ai0
	push_const 308
	add
	fetch_i4
	push_const 0
	equal
	branch_false L8
L7
	push_event	//  myself
	push_const 704
	add
	fetch_i	//  i_ai0
	push_const 308
	add
	push_reg_sp
	fetch_i
	push_const 1
	assign4
	shift_sp -1
	push_event	//  myself
	push_const 704
	add
	fetch_i
	push_event	//  talker
	push_const 40
	add
	fetch_i
	push_parameter ItemBuff
	push_parameter Amount
	func_call 184746114	//  func[DeleteItem1]
	shift_sp -3
	shift_sp -1
and now, original AI code can continue? ... code like
push_parameter fnHi
func_call 184680516 // func[ShowPage]
shift_sp -2
shift_sp -1
handler_end
class_end


so this will charge player for showing him page? (this is only dumb example)..
rodier is offline  
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 20:43.