Post Pacific  

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

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 15.09.2005, 14:19   #1
Metalmurphy
Архивный участник
 
Join Date: Feb 2005
Posts: 766
Default Trying to learn AI.obj and in need of help

Im trying to do a simple NPC that when a player clicks on a
Code:
<a action="bypass -h talk_select">Link</a>
it checks the level of the player and if level >= 30 show one html, if not show another. After searching a while i think this is the right code for it:

Code:
L####1
	push_event	//  talker
	push_const 32
	add
	fetch_i	//  level
	push_const 888
	add
	fetch_i
	push_const 30
	greater_equal
	branch_false L####2
L####2
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
S###1.	"IS_LVL_30.htm"
	push_string S###1
	func_call 43	//  func[ShowPage]
	shift_sp -2
	shift_sp -1
	jump L#####
L###4
	shift_sp 1
	push_event	//  talker
	push_const 32
	add
	fetch_i
S###2.	"IS_NOT_LVL_30.htm"
	push_string S###2
	func_call 43	//  func[ShowPage]
	shift_sp -2
	shift_sp -1
I think its correct but if somone finds errors in it please tell me. Anyway what i want to know is, since this is a complete new NPC (it has no AI.obj) what do i have to put in the rest of the AI so that when a player clicks on that "Link" it shows either 1 html or the other.
Metalmurphy is offline  
Old 15.09.2005, 16:51   #2
Alien003
Архивный участник
 
Join Date: Jun 2005
Posts: 143
Default

I have a similar question about the AI.obj

when we do

Code:
   push_event   //  talker
   push_const 32
   add
what happens exactly? what value stays in stack?
Alien003 is offline  
Old 15.09.2005, 16:58   #3
Livid
Архивный участник
 
Join Date: Apr 2005
Posts: 314
Default

Pointer to talker structure afaik.
Livid is offline  
Old 15.09.2005, 18:06   #4
HF
Архивный участник
 
Join Date: Aug 2005
Posts: 1,531
Default Re: Trying to learn AI.obj and in need of help

Quote:
Originally Posted by Metalmurphy
Im trying to do a simple NPC that when a player clicks on a
Code:
<a action="bypass -h talk_select">Link</a>
it checks the level of the player and if level >= 30 show one html, if not show another. After searching a while i think this is the right code for it:
...
I think its correct but if somone finds errors in it please tell me. Anyway what i want to know is, since this is a complete new NPC (it has no AI.obj) what do i have to put in the rest of the AI so that when a player clicks on that "Link" it shows either 1 html or the other.
why are you need Html to finish? You found good code for some old npc, who use check to level. Example, Learn Masters and... new C3 "Newbie Guide", who cast newbie buffs So, use cast skills to players (in defined levels range) to finished talking.
HF is offline  
Old 15.09.2005, 18:12   #5
Metalmurphy
Архивный участник
 
Join Date: Feb 2005
Posts: 766
Default

Well thats exactly what im trying to do. The C3 newbie buffer, but the others npcs with quests have alot of other code (to check if its a one time quest and stuff) that confuses me alot. Im new to this AI.obj stuff and still dont get most of it.
Metalmurphy is offline  
Old 15.09.2005, 21:54   #6
Metalmurphy
Архивный участник
 
Join Date: Feb 2005
Posts: 766
Default

Well no one knows how to do this? Ive seen ppl do much harder stuff common im pretty sure this is an easy thing. Give this man some help
Metalmurphy is offline  
Old 16.09.2005, 00:01   #7
flakka
Архивный участник
 
Join Date: Mar 2005
Posts: 1,143
Default

I agree. If we can get the breakdown of AI.obj and how it works (with a sticky as well when we get it), it would help immensely. :wink:
flakka is offline  
Old 16.09.2005, 04:24   #8
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default

hmm do u know how to check item attribute via ai.obj? I have some code for mymyu that can change hatch to strider.. but it totally lag server when u run that (player click on that html menu)
rodier is offline  
Old 16.09.2005, 11:00   #9
Metalmurphy
Архивный участник
 
Join Date: Feb 2005
Posts: 766
Default

You must have done it wrong then (maybe u inserted the code in the wrong place). I have the same code but it doesnt lag at all.

(still awating for somenoe to awnser my question)
Metalmurphy is offline  
Old 16.09.2005, 14:24   #10
Aikeleer
Архивный участник
 
Join Date: Jun 2005
Posts: 374
Default

Hmm, let me try to make a 'newbie guide' for ai. :P In the AI all the 'pieces' are linked. I.e, you make a new merchant, that you call Gon.

It'll be like
class gon : merchant
class_end

What happens here is, you define a new class called 'gon' and you load all the 'merchant'-class ai aswell. If you look in the ai.obj and you look for 'merchant :', you'll see what all the merchant AI is. Overall, for a thing like a level-check, 'citizen' will be appropiate.

Let's keep the idea of Gon, but make it a citizen that checks your level:

class gon : citizen

Every part has handlers. All the handlers are written down somewhere, you can find it with the search. There are handlers for being attacked, being talked to, or being asked. In this case we work with talk select. This is handler 4.

Let's start:

handler 4 // TALK_SELECTED
variable_begin
"fhtml0"
"i0"
"quest_id"
"talker"
"myself"
"_choiceN"
"_code"
"_from_choice"
variable_end

If you search through the ai.obj, you'll see that talk_select things always start with a check if it's from choice. So:

push_event // _from_choice
push_const 332
add
fetch_i
push_const 0
equal
branch_false L1

Ok, the first part is ready. If it's not from choise there shouldn't be done anything. L1 will be at the bottom, so nothing gets loaded anymore. Let's continue with your part
L2
push_event // talker
push_const 32
add
fetch_i // level
push_const 888
add
fetch_i
push_const 30
greater_equal
branch_flase L4

Ok, what we have above is fairly simple. The player is push_const 32. With the fetch_i push_const 888 command you get his level. This should be greater, or equal, to the value '30'. If it's not, then you should go to L4, otherwise continue.
L3
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S1. "IS_LVL_30.htm"
push_string S1
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
jump L1

Ok, obvious. It should show the page and after this it shouldn't parse any more code. The L1 is the empty label at the end. Ok, if we're >= 30, you get a page and the rest isn't parsed. So, if you're < 30, the ai should have a code to show you a page. So:
L4
shift_sp 1
push_event // talker
push_const 32
add
fetch_i
S2. "IS_NOT_LVL_30.htm"
push_string S2
func_call 43 // func[ShowPage]
shift_sp -2
shift_sp -1
L1
handler_end
class_end
Aikeleer is offline  
Old 16.09.2005, 15:43   #11
Metalmurphy
Архивный участник
 
Join Date: Feb 2005
Posts: 766
Default

Finaly my pleas where heard. xD your help is very very much apreciated, and im sure alot more ppl other then me will apreciate this

My code was pretty correct afterall, i just switched the htmls pages (and now that i look at it i dunno why i made that mistake couse i did understood the branch_false , probably wasnt paying attention. But your guide allowed me to understand the rest i was missing.

Again many thanks
Metalmurphy is offline  
Old 16.09.2005, 16:55   #12
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

woot!
thats nice. really helpful. mods plz sticky this sumwhere!
thx a lot aikeleer. u r the man

and now a lil quest for u my young apprentices XD lol im talkin trash...
find the mistake.
Quote:
branch_flase L4
correct it if u like or leave it as it is
toolpunk is offline  
Old 16.09.2005, 18:23   #13
flakka
Архивный участник
 
Join Date: Mar 2005
Posts: 1,143
Default

Awesome!

I'll make a note of this topic so I can put it in a sticky forum.

Now all I have to do is sift through all of the [Tutorial] topics and move them into one place.

Thanks a bunch, Aikeleer! :thumbup:
flakka is offline  
Old 16.09.2005, 18:35   #14
An@BoL
Архивный участник
 
Join Date: Sep 2005
Posts: 7
Default

Unfortunately I've posted my request in wrong topic. Hope to find answer in this one. That's why I'll "copy/paste" my question here. =)
Quote:
On my way to understanding ai.obj I've found, that somewhere exists a tool "NPC AI Script Compiler". Does any1 know smth about it or maybe where to find it?
This tool helps to translate ai.obj into more understandable thing afaik.
An@BoL is offline  
Old 16.09.2005, 18:38   #15
flakka
Архивный участник
 
Join Date: Mar 2005
Posts: 1,143
Default

Yeah, it's called NASC. I'm sure it's here on the forum. Only problem is that it only supports C1 and it's really old and obsolete I believe.
flakka is offline  
Old 16.09.2005, 18:40   #16
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

afaik its a compiler.
means u enter source code. more logic than this pseudo assembler crap and compile it 2 get the pseudo asm crap.
kinda easier, better, faster and more efficient.
i think it worx on sina only...
or was it meifu?
toolpunk is offline  
Old 16.09.2005, 19:59   #17
An@BoL
Архивный участник
 
Join Date: Sep 2005
Posts: 7
Default

That's exactly the thing I need for my Sina C1. The problem is I couldn't find it neither on this forum nor somewhere else. Can somebody post the link?
An@BoL is offline  
Old 16.09.2005, 22:52   #18
flakka
Архивный участник
 
Join Date: Mar 2005
Posts: 1,143
Default

Here.

http://zupload.com/download.php?file...&filepath=6800
flakka is offline  
Old 17.09.2005, 07:53   #19
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

so does it still work in c3?
i mean basically the structure of ai n scripts r still the same as back in c1.
only heavily modified files r the exes...

[off-topic]
woot! sum1 is usin the hosts i posted.
im kinda happy now rofl^^
[/off-topic]
toolpunk is offline  
Old 17.09.2005, 16:41   #20
An@BoL
Архивный участник
 
Join Date: Sep 2005
Posts: 7
Default

There I've found "AIEditor.zip". But I've already had that crap. Just wanted to try NASC.

P.S. Thanks any way. ;-)
An@BoL is offline  
Old 20.09.2005, 23:03   #21
Anubisan
Архивный участник
 
Join Date: Jul 2005
Posts: 50
Default

I have been trying to get NASC to work for some time as well. I am trying to add a very simple kill monsters and collect items quest, but it seems far too difficult to do just in AI.OBJ. The way everything is organized and numbered in there is confusing as hell.

Unfortunately, it seems that the version of NASC that we have is not compatible with the servers that we have. Our NASC version produces an AI.OBJ with the following version information before crashing with a syntax error:

SharedFactoryVersion 294
NPCHVersion 177
NASCVersion 105
NPCEventHVersion 76
Debug 0

Whereas our working AI.OBJ has the following version information:

SharedFactoryVersion 324
NPCHVersion 210
NASCVersion 133
NPCEventHVersion 82
Debug 0

Unless we can find NASC version 133, it appears we won't be able to modify the AI.OBJ any easier than we currently are.... which really sucks, because I doubt I will be able to figure it out enough to add the quests I was hoping to add.

- Anubisan
Anubisan 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 16:12.