AI update

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

Remove all ads!
  1. Livonya

    Livonya Established Member

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

    I don't think this works:

    game.party[0].has_spell_effects(spell_web)

    this always returns 0 regardless of what effects are in place.

    I am not sure what the problem is but you get the same result regardless of the spell effects that are actually in effect.

    Maybe I am doing something wrong?

    - Livonya
     
  2. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    Because of the "recent" loss of web from the spiders in the grove, I was actually unable to test spell_web on a character; though I tried. When I tested it, I cast a different spell (I'm thinking blindness, but don't hold me to it) on party members, and got the call to work.

    I'm at work now, but will check back in a couple/three hours with a more consistent answer (one I've been able to test first). But try casting a spell on a party member, and then using game.party[X].has_spell_effects(spell_YYY), and you should get 1 as the result (in the console) on only party member X (X+1, really, but you knew that) :)

    -- dulcaoin
     
    Last edited: Mar 16, 2005
  3. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Yeah, I tired that over and over again.

    I could never get a positive number to show.

    The spells I tried were web, silence, bull's strength, mage armor, and some others... but those are the ones I remember...

    If you get it to work let me know. It would be really helpful actually.

    - Livonya
     
  4. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    I have a party in the moathouse dungeons, right after Lareth has joined the party.

    I used my wizard (slot 4) to cast resistance on my dwarf (slot 1)

    game.party[0].has_spell_effects(spell_resistance) returns 1

    I then used her to cast daze on the dwarf, after which

    game.party[0].has_spell_effects(spell_daze) returns 1
    game.party[1].has_spell_effects(spell_daze) returns 0

    I also tried (after that)
    game.party[1].has_spell_effects(spell_resistance) returns 0

    Note that it's best to enter combat mode as quickly as possible after casting, to prevent the spell from wearing off (casting daze on the dwarf did this automatically, of course)

    I am imagining that web MIGHT have been cast as an area spell (if the spiders did it), so maybe the individual characters wouldn't show the effects (though that sounds odd).

    I could try boosting my people to handle web, I guess...



    Some updates: This weekend I worked out the entire (as far as I can tell so far) game and party[] hierarchies as far as member functions and variables are concerned. I haven't worked out the parameter lists for functions that were not already posted here on the site yet, though (just a few I'd already worked out on my own, such as .has_spell_effects() or .condition_add_with_args()

    I worked a bit on a protos editor. If anyone would like to suggest things they don't get from ProtoEd or the Mod Studio, please let me know, and I'll see about fitting them into what I'm working on.

    -- dulcaoin
     
  5. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    OK... Web does not last long, so this has to be done carefully....

    I select my wizard, who is capable of casting web.
    I press C to put us in Combat mode
    I cast web on party member "0" (randomly, those who fail a saving throw are affected)
    I bring up the console.
    Now game.party[X].has_spell_effects(spell_web) returns 1 for everyone affected...


    VERY strange part... Lareth returned 1 for this no matter what, even after the spell wore off (go out of console, press space to skip turn on the wiz, the spell wears off immediately, go back to console and check, everyone is now 0, except for me, Lareth stays at 1 for that call -- and he was NOT affected during the cast, either -- no flag on his portrait :-/).


    HTH,
    -- dulcaoin
     
  6. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Either you aren't explaining what you are doing correctly, or there is something seriously wrong.

    Every single time I use game.party[0].has_spell_effects(spell_###) it returns 0.

    I have tried it in combat and out of combat. I have tried it with tons of different spells on a ton of different characters... they all return 0 no matter what.

    I just don't see how you are getting this to work. I have also tried to use it in scripts and it always returns 0.

    - Livonya
     
  7. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Well, I went and spent another half hour messing with this. It just doesn't work for me.

    I am either an idiot, you are forgetting a step in your explanation, or it is just really buggy.

    It appears to me that this routine is unuseable as it simply does not give consistant results... or in my case no results at all.

    I know I am typing it in correctly as it is giving me a 0 value. If I had a typing error then it would come up as an error.

    Totally frustrating...

    - Livonya
     
  8. dulcaoin

    dulcaoin Established Member Veteran

    Joined:
    Mar 10, 2005
    Messages:
    213
    Likes Received:
    0
    Frustrating from this end as well.

    I'm not horsing around, there's no point in that.

    And it can't be that I'm missing a step
    a) I'm keeping it simple. I load the game, load my save game, and perform steps
    b) It works so clearly and consistently for me, that there's no point in being overly specific (other than having to be in combat for web, because web doesn't last long outside combat)

    The one thing that bugs me is that Lareth seems to return 1 for me no matter what spell I try...

    -----

    crap. this makes it even WORSE:

    I just tried it with a completely different party, and with the sleep spell. I AM getting a 1 for the PC (only one was affected), but I get a one no matter what parameter I give the call (spell_sleep, spell_web, or even 0)

    So, you might be right. It LOOKS like a useful call, but only seems to indicate whether a PC is under the influence of some spell in some way.

    Darnit.

    -- d
     
  9. dulcaoin

    dulcaoin Established Member Veteran

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

    New information. Solid information. 5-6 hours of head-banging-on-wall...

    the call is properly .has_spell_effects(). There's no way to parameterize it. It tells you that a PyObjHandle object (PC, NPC, Critter, etc.) has a spell affecting it at the moment. That's all. That doesn't help with web. (It's good to know, but it's not specific enough for the issue here).

    I can't find a way to specifically decide whether an object is webbed or not; that may or may not come yet (I've tried, hard, I'm not sure it's doable).

    THAT my friend is the bad news. Here's the good; a code snippet to get you what we've been after. It tested as well as I could, now it's your turn to put it in a script. :)

    if obj.d20_query(Q_Is_BreakFree_Possible) :
    obj.d20_send_signal(S_BreakFree)

    Let me know how that works. With luck, it won't upset the TOEE event model. It has the nice side-effect of not "just" working with web, it'll work anywhere the npc should be trying a break-free. (Obviously, you might want to add more conditions to the if, so that a trapped npc doesn't do nothing else but work on getting free constantly, that's too easy a distraction for the player to impose on an NPC)

    Both calls worked well from the console on a webbed PC. I even had to submit the S_BreakFree signal repeatedly until the roll allowed for a proper break (otherwise, I got "Webbed" every time, as if I'd chosen the action from the radial menu).

    It's a start, I hope.

    -- dulcaoin
     
    Last edited: Mar 15, 2005
  10. Livonya

    Livonya Established Member

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

    Hot damn!! This works!!

    if obj.d20_query(Q_Is_BreakFree_Possible) :
    obj.d20_send_signal(S_BreakFree)

    Unfortunantly, I have to add it manually to every single script. There is no way to add it to AI.

    But it works, and it works really well. Web will no longer be a total show stopper!! It even follows the rules so that if they do break free they only have half a movement left.

    What other spells besides web allow a break free attempt?

    How did you discover this code?

    - Livonya
     
    Last edited: Mar 16, 2005
  11. Gaear

    Gaear Bastard Maestro Administrator

    Joined:
    Apr 27, 2004
    Messages:
    11,038
    Likes Received:
    42
    Can you break free from Entangle?
     
  12. Livonya

    Livonya Established Member

    Joined:
    Sep 25, 2003
    Messages:
    773
    Likes Received:
    0
    Okay, I wrote a script for it but there are a few problems.

    Break Free will work, and the NPC will try it, which is a huge advantage.

    However, it doesn't count as a Standard Action for an NPC, but instead as a Move Action.

    This means that an NPC can attempts to break free and also do a full attack or cast a spell. If they break free and choose to move then they only get a half move.

    When one of your characters attempts to break free it counts as a Standard Action, which means that you can't also cast a spell or attack.

    This gives a slight advantage to the NPCs but on the flip-side it means that the NPCs won't do dumb things like try to break free when they could be attacking...

    I don't think this is a big deal. Web will no longer be over-powered, but it will still keep creatures trapped (unless they can break free).

    Any ideas on this?

    - Livonya
     
  13. Livonya

    Livonya Established Member

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

    Here are some things I would like to be able to check for... I am sure these are possible, but don't know how to check for them...

    if obj is prone --- there must be a way to check for a condition... such as poisoned, prone, stunned, etc...

    also I need a way to move NPCs... for example obj.d20_send_signal(S_move, XX) would be great... just some way to force something to move from A to B other than obj.move(location_from_axis(647, 497)) which causes instantaneous movement.

    Like I said a short list... both of these would be extremely useful...

    - Livonya
     
  14. dulcaoin

    dulcaoin Established Member Veteran

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

    I really hoped it would. I was afraid after the last debacle that you wouldn't waste time on another potential mess-up from me :)

    Like I said, I've been spec'cing out the object hierarchy for all the Python TOEE objects, and so started trying out all the queries against a webbed PC in my party. I actually found the BreakFree signal BEFORE figuring out the right query (I REALLY wish there was a way to query for Webbed, and perhaps we'll figure it out some day, but I do NOT Think it's done with d20_query())

    And, as mentioned, I believe entangle is another break-free spell

    I can't find anything on it in the manual, which supports my theory that it was added late in development (and hence, no direct query for Web)
    -- dulcaoin
     
    Last edited: Mar 16, 2005
  15. dulcaoin

    dulcaoin Established Member Veteran

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

    Try to issue an obj.d20_send_signal(S_EndTurn) after the obj.d20_send_signal(S_BreakFree), that might simulate it being a full action.

    If it does work, then you have maximum flexibility, you can either leave it as-is to give the NPCs an edge, or add the S_EndTurn (or perhaps another Move action followed by S_EndTurn) to simulate "the rules"

    Don't ask me how to signal a 5-foot step; I don't know if it's even possible (yet). :)

    Edit: "Break free" isn't an action in the 3e rules (don't have 3.5 to check), under Combat, and the Web description says the action is a full-round action. So I'm back to having it signal the EndTurn right after the BreakFree, if you're shooting for rules adherence. Also, it's the same deal with Entangle.

    -- dulcaoin
     
    Last edited: Mar 16, 2005
Our Host!