![]() |
ai.obj coding question
Hello
I'm new in ai coding. For example, I take elpy with class warrior_flee I want , that after each kick (attack) , elpy say random some phrases... So, I modified ai code: Code:
class warrior_flee : warriorCode:
class 1 warrior_flee : warrior |
what is it? :confused:
1) Code:
shift_sp 1Code:
shift_sp -12) Code:
push_event |
wish i knew AI dude. i'd be honored to help you out... :(
best way i can say is to just test it. |
I would like to help you but I need some important Information
your AI code seems to be from C1 AI but with C4 handler/func so? It should be C1 AI? or C4 AI? @HF the shift_sp 1 is correct for C1 because there it was the same like now the push_event/myself |
Quote:
I used nasc for c1 , and then , manually changed functions for C4 Is this wrong way ? I found only one good tutorial here (https://postpacific.loc-online.com/f...ead.php?t=2367) , but now , I think this for C1 ai. |
The NASC syntax looks like C1... isnt using objects (myself, gg) but in the compiled code is using C4 ids, and in some functions use objects and others not... looks like he was trying to do a mix or whatever...
For those who try to learn... here the correct code.. C1 NASC Code:
class warrior_flee : warrior {C1 AI.OBJ Code:
class warrior_flee : warriorC4 NASC Code:
class warrior_flee : warrior {Code:
class 1 warrior_flee : warrior |
Quote:
|
Quote:
Tell me please, where I can found information about objects ? I understand, for example, what mean myself and attacker, but what mean gg ? Another question. Can I use my own vars in nasc code ? For example : Code:
class warrior_flee : warrior { |
yea, to use your own vars you specify them on the parameters section on the class in the AI it looks like this
Code:
parameter_define_beginVarType VarName DefaultValue and with that i will "try" to do your if statements in AI See my next post for proper code remember this is just an example to show how to set a variable and then check it with an IF |
You cant modify the value of a parameter declared before the handler. If you want to modify a param use some as i0, i1, i2 ... or c1, c2, c3.... depend of the type of data (i = int, c = creature ...)
|
hmm didnt know that. In that case just remove the parameter section and change myvar to i0 or what ever is not in use and i assume add it to the variable list.
here is what i came up with for an example Code:
class 1 test : (null)Code:
class test : (null)Also thought about another method you could use that NCSoft uses, and that is to change he random number to like 100 and then do a few ifs to see if its <20 or >50 this way you get a slightly more random seeming system anyway hope this helps, sorry to have kinda hijacked your topic but i learned a few things from this topic that i wasn't expecting :) |
Thanks !
This is very good information :) So , I little changed my task. If attacker's level > 10 , there will be "text 1" message, and else, "text 2" message. ai code: Code:
class 1 test : (null)One another question, what difference between fetch_i4 and fetch_i ? If I change fetch_i4 at fetch_i , the result of decompiler as the same: Code:
|
( attacker + 1092 ) ??
attacker.level |
Quote:
|
Tell me please , can I use in NASC string variable ?
For example, something, like this: Code:
i0 = ( gg->Rand(10) ); |
Look at this... is an example i found in AI.
Code:
s0 = fnHi + RoomIndex + ".htm"; |
Quote:
|
| All times are GMT. The time now is 15:24. |