Jump to content
  • 0

Nasc Ai Functions


tk422

Question

Greetings, Again!

 

Finally got things up and running thanks to Xel.

 

Anyways, I've started the dive into AI modifications. I haven't done this in a long time and when i did, it was EXTREMELY basic edits and without a this wonderful compiler.

 

The syntax for NASC seems amazingly simple. I know exactly what's going on syntacticly but not what is happening in terms of functionality and for each method call.

 

For example, I edited the Gremlin class from blank to this:

(i copied the handler from the superClass)

class 1 gremlin : warrior_passive
{
handler:
  EventHandler MY_DYING( always_list, c1, code_info, i0, i9, last_attacker, lparty, member, random1_list, target )
  {
    myself::Say( "SAYING SOMETHING!!!" );
    myself::Shout( "SHOUTING SOMETHING!!!" );
  }
}

My understanding is that the EventHandler is exactly that: A bit of code that sits around and waits for it to be called and then executes. I'm ASSUMING the MY_DYING event handler is triggered when the Gremlin has or is about to die. This code though seems to do nothing and never gets executed.

 

So, This brings me to some questions:

-Is there a guide with comments and examples somewhere? Like a directory of all the functions and what they do?

- The arguments passed in to the handler, what do these mean?

- The ::'s, are these like C++ class namespaces?

- Is myself similar to this in C++ or self in Obj-C?

- BOOL seems to be non-existant. Is that true? (Doesn't matter, is just odd)

- Are there any FOR / WHILE / DO WHILE loops?

- In code like this:

if( target.alive == 0 && target.is_pc == 0 ) {}

Why is the syntax not

if (target.alive && target.is_pc) {}?

- Can you define your own functions and handlers?

 

Thanks in advance to anyone that answers. :)

 

 

 

 

 

 

 

 

Edited by Universe
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

1. Args are gloval vars for that npcmaker instance. For normal mobs that means nothing - but ability for scriptevents and big bosses to store variables and use them later in other handlers is a big must

 

2. namespaces\class is - pseudo definition. but that is sort of the idea.

 

3. myself is the defintion handler\class for the npc instance in l2npc (The gremlin thats being killed by you in this scenario) - that's having it's handler executed by the npcmaker instance that spawned it.

 

4.  I don't think so - can't remember - search for bool in a decompiled c4 ai and see. Either way there's int returning 1 so.. live with that.

 

5. FOR and Switch ...can't remember about while - very doubtful since it's threaded execution that needs to return asap.

 

6. Ask NCSoft - syntax does not support it if i remember correctly.

 

7. You can code it and extend it - but i doubt you'll ever learn\get that far. Requires some significant time investment sadly.

Edited by mcbigmac
Link to comment
Share on other sites

  • 0

1. Args are gloval vars for that npcmaker instance. For normal mobs that means nothing - but ability for scriptevents and big bosses to store variables and use them later in other handlers is a big must

 

2. namespaces\class is - pseudo definition. but that is sort of the idea.

 

3. myself is the defintion handler\class for the npc instance in l2npc (The gremlin thats being killed by you in this scenario) - that's having it's handler executed by the npcmaker instance that spawned it.

 

4.  I don't think so - can't remember - search for bool in a decompiled c4 ai and see. Either way there's int returning 1 so.. live with that.

 

5. FOR and Switch ...can't remember about while - very doubtful since it's threaded execution that needs to return asap.

 

6. Ask NCSoft - syntax does not support it if i remember correctly.

 

7. You can code it and extend it - but i doubt you'll ever learn\get that far. Requires some significant time investment sadly.

 

Hey!

 

Thanks for getting back to me. I've had my head buried in a custom control panel last few days, haven't had time to play with AI much.

 

This is great info though and i'll def use it when i start on AI again.

 

If you can think of any function documentation that exists please do link it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...