PDA

View Full Version : Trying to learn AI


zcold
02.03.2006, 10:38
Hi everybody!

I have some questions to AI coders :) And I'll be happy if you answer them :)

Ok, first is:
In AI.obj code:
push_const 271873
push_const 1
push_const 0
push_const 1000000
func_call 10 // func[AddUseSkillDesire]

Is 271873 - skill_id? How to calculate it from skilldata?

or that part:

push_event // skill_name_id
push_const 120
add
fetch_i
push_const 536577
equal
branch_false L42258

Is 536577 - skill_id? How to know what number this skill have in skilldata?

Can somebody describe this parts of code by steps?
Something like:
push_event // put value of event (handler?) on stack. What is event in that case (push_event)?
push_const 120 // put 120 on stack
add // add event+stack
fetch_i // get result on top of stack
push_const 536577 // put 536577 on stack
equal // compare: equal=true, not equal=false
branch_false L42258 // if false - jump to label L42258

Is my understanding of that part is correct?


Can somebody give any information about using NASC or making NASC-scripts?
I want to learn, want to make scripts, but haven't enough information :(

Radmin
02.03.2006, 11:25
skillid =
skill_id+skill_lvl*256

or try to see : skill_pch.txt %)

zcold
02.03.2006, 11:58
Thanks, I see skill_pch.txt :)
And must correct your formula a little: skillid=skill_id*256+skill_lvl
:) Thanks for hint ;)

zcold
02.03.2006, 12:28
One more question:
If there is no handler in sub-class, but there is handler in super-class, will this handler act?

I mean, if I have something like:

class superclass: default_npc
handler 2
...
handler_end
class_end

class subclass: superclass
handler 1
....
handler_end
class_end

If handler 2 called in subclass, will act handler 2 in superclass?