Aller au contenu

Photo

creature AI and special abilities


  • Veuillez vous connecter pour répondre
12 réponses à ce sujet

#1
Quilistan

Quilistan
  • Members
  • 111 messages
What is neccessary to get creatures set with special abilities, potions, or scrolls to use them?

expample: Bombardier Beetles should spit acid mine never use the ability

I also have kolbolds with tanglefoot bags who never use them

is there a script or variable that needs to be set? Is it an inteligence or wisdom thing? I have messed with it a bit and can't quite figure it out.

Please help!

#2
The Fred

The Fred
  • Members
  • 2 516 messages
AFAIK, the AI will actually use all of these things by itself. However, it often doesn't. The only real fool-proof way I can think of doing is to script each creature to do it with custom AI, so as to force a desired course of action. For this the best way is probably to use the HotU AI override system - I think there are example scripts in the game which you can look at.

#3
MasterChanger

MasterChanger
  • Members
  • 686 messages

The Fred wrote...

AFAIK, the AI will actually use all of these things by itself. However, it often doesn't. The only real fool-proof way I can think of doing is to script each creature to do it with custom AI, so as to force a desired course of action. For this the best way is probably to use the HotU AI override system - I think there are example scripts in the game which you can look at.


Yes, there are some ideas having to do with the relative weight given to different tactics in the AI. I wish that Tony K's came with NSS as well as NCS files so that we could see the details, but alas it doesn't. I've found that if I give a dragon a fire breath ability, it'll use it almost every time, but if it's frost, it will use it extremely rarely (but not never).

I'm pretty sure that what The Fred is refering to ("the HotU AI override system") is what is defined in nw_i0_generic. There's a constant defined:

const string VAR_X2_SPECIAL_COMBAT_AI_SCRIPT     = "X2_SPECIAL_COMBAT_AI_SCRIPT";

...and a local string with this name is then retrieved by DetermineCombatRound:

    string sSpecialAI = GetLocalString(OBJECT_SELF, VAR_X2_SPECIAL_COMBAT_AI_SCRIPT);
    if (sSpecialAI != "")
    {
        SetLocalObject(OBJECT_SELF, VAR_X2_NW_I0_GENERIC_INTRUDER, oIntruder);
        ExecuteScript(sSpecialAI, OBJECT_SELF);
        if (GetLocalInt(OBJECT_SELF, VAR_X2_SPECIAL_COMBAT_AI_SCRIPT_OK))
        {
            DeleteLocalInt(OBJECT_SELF, VAR_X2_SPECIAL_COMBAT_AI_SCRIPT_OK);
            return;
        }
    }


I've used this system a bit and it works very well. All you have to do is attach a local string to the creatures in question with the name "X2_SPECIAL_COMBAT_AI_SCRIPT".

#4
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
We have the nss files, the SOZ expansion uses tonyk's ai.

A lot of it is inside the henchspells.2da in a packed bit, and the other provided 2da's. I think these abilities need to be redone as feats to let the AI know they are there, and also so a player can use them when shapechanged. I am still trying to figure out the data format, which bit means what in the stored values.

#5
kevL

kevL
  • Members
  • 4 070 messages
Did you guys look in his erfsource? it seems to me the uncompiled scripts are all there.

if so, bravo Tony

#6
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi,

I was going to post on the same subject .... Image IPB

Will check this out later.

Lance.

EDIT: (It's later.) OK, I have tried attaching a basic magic missile special ability to a creature and it does not use it at any time as far as I can see. However, if I give the same creature a wizard level and give it the spell that way, then it will use the spell in combat.

However, I was hoping to just be able to attach monster abilities as opposed to give additional classes to make them use the ability. Is there any known way to force these abilities to be used, like they are in the case of having classes added?

Is it anything to do with the talent functions? (Although I just read in the Lexicon that TalentSpell does not work. :unsure:)

Thanks in advance.

Lance.

Modifié par Lance Botelle, 17 mars 2011 - 11:10 .


#7
MasterChanger

MasterChanger
  • Members
  • 686 messages

kevL wrote...

Did you guys look in his erfsource? it seems to me the uncompiled scripts are all there.

if so, bravo Tony


That has the NSS files for the GUI scripts, not the nw_c2_default* scripts that are of greatest concern to me.

painofdungeoneternal wrote...

We have the nss files, the SOZ expansion uses tonyk's ai.


My understanding was that some aspects of Tony's work were not included with SoZ, though some were. Specifically, I seem to recall him talking about item usage. While I don't care about item usage for companions (if my companions ever use items without me telling them to I get very cranky) I certainly do care about item usage for monsters.

#8
kevL

kevL
  • Members
  • 4 070 messages

MasterChanger wrote...

That has the NSS files for the GUI scripts, not the nw_c2_default* scripts that are of greatest concern to me.


mine does *shrug

All 9 of 'em. Load up 'compmonai.erf' in Tanita's packer ..

#9
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
I have all of his files, my refactored AI is using his scripts, and it includes support for some of kaedrins PRC's. Most of them are actually in the official SOZ codebase, from what i remember some options in the character screen were not added in.

#10
MasterChanger

MasterChanger
  • Members
  • 686 messages

kevL wrote...

MasterChanger wrote...

That has the NSS files for the GUI scripts, not the nw_c2_default* scripts that are of greatest concern to me.


mine does *shrug

All 9 of 'em. Load up 'compmonai.erf' in Tanita's packer ..


You're totally right. I think I must have been lazy since I think erf's are so icky. Being able to load them up in NWPacker rather than the TS makes it much easier, though.

I've started digging through the various hench_i0* and hench_o0* scripts to look at how Tony handles special abilities and usable items. It's possible that his changes in these particular areas only affect henches and not monsters (I know that other parts of his AI do affect monsters).

#11
Morbane

Morbane
  • Members
  • 1 883 messages
I posted on the old forums asking a similar question about ability usage - such as feats and special abilities - while there are more answers after all this time - there are still alot of maybes and I dont knows. Confusing - but I will be checking both posts for possible ways of scripting creature AI - or at least pseudo ai where scripting might be the answer.

#12
painofdungeoneternal

painofdungeoneternal
  • Members
  • 1 799 messages
I am working on a completely refactored AI in the AI and core folders. You can refer to the AI functions here _SCInclude_AI.nss which are again stock functions but i added a prefix to them all. Might want to look at what i am working on since i've already refactored enough issues to know it's going to be very hard to fix what is delivered with the game with superficial fixes. This is technically the TonyK AI, but it's all organized together in one file, and a lot of sanity checks on loops, and i redid the functions which look up the creatures effect, spell and item properties so it caches better.

Note that i am not changing the AI, i am just recreating functions in it, making it more organized and trying to reduce a lot of redundant dead weight, and while i am not testing it in the OC, unless i added errors it should work fine there. From testing it seems to really make creatures think better and allows more creatures as seen in this very old screen shot where i am testing how things work with hundreds of creatures at once. ( not recommended to go this far but you can do a lot more without causing lag issues )

A lot of the issues relate to the special abilities being hard to access in the engine, there is no function to iterate a creatures spells, feats, and special abilties, which is also why the AI has to do so many loops. I am pretty sure a lot of the followers not listening issues are where the AI hits a loop and just dies. Fixing issues like this seems to help.

Right now my focus in on henchspells.2da. Make sure that is available. If a spell is not in that, the AI won't use it. However it's impossible to read, using shifted bits, masks, and bitwise operations to pack a LOT of data into what looks like big integers. I am developing an editor so i can review it, and from what i see so far, the values are all over the place, either blank, wrong, or just could be a little better. The example is pretty simple but all those check boxes in effect type define the number above them. Quite a few of the values for rows are just plain nonsense, or not even touched.

The issue here is these are so hard to read they are only understood by programmers, and those who are better at vetting rules like this cannot read these values.

We still need to approach the core issue, that special abilities are a short cut for doing feats. If a monster is done like a class, with feats and the like, then the AI and tools, not to mention shapechanging/shifters could use those abilities too. These abilties don't have icons/descriptions for the most part, are assumed a player will never use them, even though it is desired by most players to be able to magically become monsters with abilities. If you treat them as equal in setup to what you'd give the players, it would actually improve them without needing to do a custom AI for each monster, the henchspells and feats would be able to notice them, and you'd be able to do custom ui's based on the AI code to show the "feats" the monster now has. This is basically a long term goal with my various projects.

#13
Quilistan

Quilistan
  • Members
  • 111 messages
Wow that does look like quite the large undertaking!

A lot of what you said is over my head, and that is where I trust you guys. Would you say your refactored AI in its current state is better than the stock SoZ AI? If so what would one need to do to impliment it? It is compatible with HCR2?