NPC inventory & AI manipulation

Discussion in 'General Modification' started by Livonya, Oct 25, 2007.

Remove all ads!
  1. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    I got a little side tracked tonight, and will have to release all this AI stuff tomorrow.

    Things I added tonight, that KotB may or may not want.

    1) I wrote a script routine for NPCs to identify area effect spells.

    I didn't write any scripts to do anything with this info, but if a scripter wants to use one of these routines then they can at least have a way to determine if an NPC is in the area of effect or if one is close by.

    2) I changed Silence so NPCs can cast it directly onto a PC. Before this was only available as a static area effect for an NPC. PCs could cast it either way, and now NPCs can as well.

    It does make more sense for an NPC to cast it directly onto a spell caster in most situations.

    3) I changed Dispel Magic so that Dispel Magic can dispel area effect spells.


    Thus enemy NPC casters with Dispel Magic can now detect area effect spells and they can dispel them with Dispel Magic.

    I still have to write in a targeting system for NPCs to directly target the area effect spells, but that won't be hard. And I need to make sure spider web can't be dispelled but that won't be hard either.

    I love tinkering with this stuff.

    Anyway, I am going to bed.

    - Livonya
     
  2. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,740
    Likes Received:
    374
    Heh, I was going to PM you about a way to detect area effect spells: that will go right in for something I've got planned :mrhappy:

    Can't wait to use all this stuff!
     
  3. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    The system I came up with definitely works, but it definitely has problems as well.

    I have three script calls that can do the following:

    1) detect the closest area effect spell
    2) detect the closese specific area effect spell
    3) determine if an NPC is in a specific area effect

    There are some things that can screw it up. But it works relatively well, at least it is better than never knowing anything... and it is a start. Maybe someone can improve on it.

    I actually have about a half dozen scripts that save a lot of time.

    For instance I wrote some utilities scripts that can be called from a dialog line to determine if an NPC talker is present, and then switch to that talker by line number.

    It allows dialog scripters to script for NPC banter without ever writing any script of any sort. They just assign all the information directly from the dialog line. It makes banter extremely easy to write.

    So I just have to package all this stuff up with some instructions and then post it.

    I still have a few ideas that I want to implelement first, but I am real close to being done.

    The AI system I have could use another few months of additions, as it will always be a system in progress, but it is definitely ready to go. There is only one part of it that has to be managed collectively by all scripters working on the strategy.tab but that shouldn't be hard.

    Blah, blah, blah...

    I really hope to upload that all tonight once I get home from work and finish the evening rituals of food and family.

    - Livonya
     
  4. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Beta: AI & Equipment handling

    BETA VERSION 1.0

    Okay, well, here goes.

    I think I have everything properly included, but who knows. I am the only one that has ever tested any of this... anyway, we all know how that goes...

    The strategy.tab is NOT the same strategy.tab that comes from KotB. Sorry about that. I think there are maybe 5 strategies for the KotB version that are not in my version. I added 50 new AI tab entries, so it will be easier to move yours to mine. Again, sorry about that, but I didn't realize that the one I was using was different than the KotB one until it was too late.

    Besides all of the strategy entries are going to need line entries anyway if you want dynamic AI control....

    There are extensive instructions in the following files:

    1) Instructions for AI swaping (this is the important one!!!)
    2) Instructions for area effect
    3) protos.tab changes (this is really only for Shiningted)
    4) strategy.tab secrets (just some notes that I have made)

    Please remember the :tombstone warning :tombstone about the equipment tagging from my earlier post!!!

    The only thing that is plug and play is the new command system for Druid/Ranger pets. That is ready to go.

    Everything else will require importing/scripting to get it working in KotB.


    The file called "Livonya" has all of my scripts. They are remarked and many have notes on use.

    Note that I left in my float message system in "def get_melee_strategy(npc):" for testing purposes. If you use this script with an NPC then the NPC will tell you each round what AI strategy they choose for that round. Very useful for testing new triggers and such, but not something you want to leave in for final version.... you can add new float tags in the skill_ui.mes file... if you take a look you will understand.

    The spell files allow for an area effect tag.... see instructions.

    Dispel Magic now dispels area effect spells. I am not sure if I like it, but it can easily be taken out. Give it a try. Only works when you target Dispel Magic near the center of an area effect spell. Must be targeted on ground and not on a NPC.

    There are also a couple of example scripts, just to show how to access these main scripts.

    The file called "py00XXX_sample_melee_script" is a sample script that will allow you to add in all my melee AI changes.


    Things included in the Protos.tab

    1) A Concentrated Search Tool. You can spawn this into inventory by any method that you choose. It will never show up, and it doesn't matter what slot it goes into. Makes no difference. Players can't touch it, see it, or what not, but it does allow them to use Concentrate Search (working) from the radial menu.

    Currently it does nothing, look at the script for Spell764 - Looking for Livonya.... you just have to add your secret door checks in there... I kind of did it, but I never tested it... you will get the idea....

    2) A holy symbol. This shows up, but it could be made to not show up. Just look at how the Concentrated Search Tool works to see how to make it not show up. It allows Paladin's to cast Detect Evil 10 times per day.

    3) A Potion of Dispel Magic (this does not get rid of area effect spells)

    4) Druid/Ranger pets can now be given minor instructions.

    I guess that is it... nothing here is without user effort.... this package is really meant for modders/scripters. Once everyone gets a handle on how the AI swap system works, and how the strategy.tab line entries must be ordered then I suspect major, major AI improvements will begin.

    At the very least every single spell caster in KotB should get at least 5 different AI strategies that they randomly choose from for each round... the replay value is worth it alone.

    At the very best every monster/NPC can have a very, very unique and dynamic AI pattern that changes every round depending on how the battle is going...

    Have fun!

    - Livonya

    PS: At the last minute I decided to write one more script.

    target_for_silence(attachee, type)

    This script will find a good target for Silence. It will look for the highest level caster if you use type 0. If you want to find the highest level Bard use type 5, etc, etc...

    The script then records the target, and passes it to Silence.

    So if you then cast Silence then Silence will ignore the targeting system from the strategy.tab and will automatically target the target that the original script called for.

    It doesn't cast this as an area effect spell, but casts it directly onto the spell caster. So if the spell caster moves then so does the spell area. Very nasty.
     

    Attached Files:

  5. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,740
    Likes Received:
    374
    Thankyou Liv! :clap: I'll give all of this a go as soon as I can.
     
  6. Lord_Spike

    Lord_Spike Senior Member Veteran

    Joined:
    Mar 25, 2005
    Messages:
    3,151
    Likes Received:
    1
    Re: Beta: AI & Equipment handling

    Excellent! That's how it's supposed to work. One question, though - Does the target get a saving throw? They should be allowed one. If they make the save, then the spell affects an area of 15' r. that is centered behind the targets head.
     
  7. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Re: Beta: AI & Equipment handling

    It works just as when the PC player casts Silence onto the NPC.

    If they make the 1st save then the spell fails. If they fail the first save then the spell is centered on them.

    They then get a 2nd save to see if they are silenced for that round.

    I suppose I could change it so that if they make the first save then the spell is an area effect spell rather than cenetered on them, but currently it doesn't work like that.

    It did seem strange to me that the spell just ends if the target makes the first save, but that was how Troika did it.

    I could change that if people wanted.

    - Livonya
     
  8. maggit

    maggit Zombie RipTorn Wonka

    Joined:
    Oct 20, 2005
    Messages:
    1,945
    Likes Received:
    0
    Rule compliance is one of the chief rules of Co8,
    so go ahead. ;)
     
  9. Shiningted

    Shiningted I changed this damn title, finally! Administrator

    Joined:
    Oct 23, 2004
    Messages:
    12,740
    Likes Received:
    374
    Yeah, if its meant to work as Lord Spike said by the rules, then please change it.

    Btw, I have added all your changes (except the new strategy.tab, my next job) to KotB. Gotta love Agetian's proto import/export tool - I don't know how we lived without it!
     
  10. Half Knight

    Half Knight Gibbering Mouther

    Joined:
    May 16, 2007
    Messages:
    2,148
    Likes Received:
    1
    Re: Beta: AI & Equipment handling

    Don't want to be a pain the a$$, but as i can see in the PHB 3.5 , that's the way it works...

    if the spell is centered on a character, then you get a save. if aproved, there is no silence; but if the spell it's centered on the ground next to him, there is no save since the spell isn't centered on the character, you are soundless ti'll you get out of the area...no second saves neither

    I suppose you are implementing house rules...old rules

    Well if that isn't the case, just give me a coup of the old, nice STFU :coffee:
     
    Last edited: Nov 7, 2007
  11. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Re: Beta: AI & Equipment handling

    I didn't look it up, I was just reporting how Troika did it.

    All I did was change it so that NPC's can use both methods.

    I would rather leave it as is, as that doesn't require more work, so if you are saying that it should remain as is... then great, less work for me!

    - Livonya
     
  12. Half Knight

    Half Knight Gibbering Mouther

    Joined:
    May 16, 2007
    Messages:
    2,148
    Likes Received:
    1
    Yep, it's pretty simple. :yes:

    A little question:

    i've read that stunned characters drop whatever they carry in their hands... it does work in ToEE?
    It could be great that stunned characters have their weapons unequipped if they are stunned (the equipment appearing in the inventory), and gives a lot more sense to the stunning attack of monks, not to mention lots of monsters abilities and spells...:dizzy:
     
  13. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    This could be done. But before I add this I would want to make sure that everyone agrees that this should happen and...

    The other thing to know. NPCs get to transfer their equipment as a free action. So there really isn't any advantage to adding this.

    You would stun an NPC, they would uneuip then when they were ready to attack they would equip. So the routine would be visual only.

    Not sure if it would be worth the effort, though it would be an easy script to write.

    - Livonya
     
  14. Half Knight

    Half Knight Gibbering Mouther

    Joined:
    May 16, 2007
    Messages:
    2,148
    Likes Received:
    1
    Aaaah, i see. As if every Npc having the quick draw feat.Crap.
    But it's still useful unequip a shield...any attack after the stunning one would have better chances to hit, because the stunned creature also have a -2 penalty to armor...
    Or a monk stunning an opponent with a reach weapon could give the chance to other character approach or leave safely at least for that round...

    Anyway, i don't want to add more troubles, you're already too busy :wave:
     
  15. maggit

    maggit Zombie RipTorn Wonka

    Joined:
    Oct 20, 2005
    Messages:
    1,945
    Likes Received:
    0
    I don't think that's a good idea... think of a PC who has
    his pack fully loaded and gets stunned... Say bye, bye
    to your equipment lad/lass. That wouldn't be fun. :(
     
Our Host!