AI update

Discussion in 'General Modification' started by Livonya, Feb 28, 2005.

Remove all ads!
  1. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    Q_Critter_Is_Poisoned
    Q_Prone
    Q_Critter_Is_Stunned

    Anything else? ;-) (perhaps not so obviously, supply those to obj.d20_query())

    I don't know about the movement.

    I'd try obj.runoff(loc) to see what it does.

    -- dulcaoin

    P.S. Livonya, I don't know if you noticed, but I sent you a private message on the board earlier while we were both on. You might read it, perhaps respond, just to clear that out.

    Also, if you could post or e-mail me your findings / a tutorial on AI scripting and AI changes, I'd really appreciate it.
     
    Last edited: Mar 16, 2005
  2. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Dulcaoin -

    I tired doing the

    attachee.d20_send_signal(S_EndTurn) after the attachee.d20_send_signal(S_BreakFree) but that didn't help.

    The problem is that 98% of the AI for combat needs to be controlled by the Strategy.tab file... you can only do so much with the start_combat script.

    I don't even have a way to issue a move command... I can just do very simple tasks in the start_combat script and most of what I am doing involves re-building the Strategy.tab (98% done now)

    It really messes things up if you skip the Strategy.tab during a round... for instance if you end the start_combat script with return SKIP_DEFAULT then time gets all messed up... the event that take place via the start_combat script will NOT occur before the next NPC/PC turn if you use return SKIP_DEFAULT... so it is a really bad idea to skip the Strategy.tab run through... And if you assign an action in the start_script and use return RUN_DEFAULT then most of the time the action you assigned gets over-written by the Strategy.tab

    So I rarely use the start_combat script.

    However, attachee.d20_send_signal(S_BreakFree) works because it is in addition to anything in the Strategy.tab which is why the NPC gets a small cheat.

    - Livonya

    PS: I will try to come together with some scripting info when I get a chance... busy as hell testing...
     
  3. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0

    do you mean san_start_combat?

    I see that there are: san_start_combat, san_end_combat, san_enter_combat, san_exit_combat

    Is it well known what they all do? I'd almost hope that enter_combat would happen every combat round, no?

    -- d
     
    Last edited: Mar 16, 2005
  4. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    D -

    Q_Prone is amazingly helpful.

    I was able to fix it so that enemy NPCs will no longer cast the same spell over and over on a prone character. So now if one of my NPC casters uses a Tashas Hideous Laughter, Command (fall), or Sleep, or Deep Slumber then on their next casting they will choose a different target. Very nice.

    I basically wrote a re-targeting script that I have to manually add to something like 400+ spells so that when an NPC casts the spell the spell will look to see if the target is a good choice, and if it isn't a good choice it will pick a better target. This give the illusion that the NPC makes smart choices.

    That is a huge improvement. Kind of bulky, I have to add 20 to 30 new lines per spell script to make it work, but it makes a huge difference.

    No longer will a spell caster waste some powerful spell on a prone/unconcious character.

    My main goal right now is to figure out a way to check for Silence....

    Once I figure that out I can pretty much wrap things up.

    Thanks for the help with the new scripting terms!

    - Livonya

    PS: Sans_Enter_Combat happens when combat begins, and Sans_Exit_Combat is for the end of combat. Sans_Start_Combat happens at the beginning of a NPC's round, and Sans_End-Combat is at the end of the round... but again be warned... anything you put in the Sans_Start_Combat will be in ADDITION to whatever the AI descides to do that round... which is why Break_Free gives the NPC an extra event in their round. You can by-pass the NPC's round but doing so causes strange problems where events will happen out of sequence... also the animations will be all out of whack.
     
  5. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0

    You should try adding your routine to utilities.py, and then at the top of every spell that needs it, add

    from utilities import *

    I recall having some difficulty figuring out silence myself
    try obj.d20_query(Q_Mute) and see if that gets what you need.

    -- d
     
  6. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    I can't add the spell targeting routine to the utilities.py file because every spell has slightly different conditions, ranges and targeting issues... they have to be done one at a time. A pain in the butt, but not that hard once the templet is created... which I am pretty much done with.

    I have written a lot of new sub-routines for the Utilities.py but sometimes that is more effort then it is worth...

    I will try try obj.d20_query(Q_Mute) though I am pretty sure this in an indicator for the Obj_flag Mute which is a special NPC trait like NO_FLEE.

    - Livonya
     
Our Host!