Skip to content

Scripted AI for boss battles?

Will it be possible in the re-release to create more scripted boss battles, to go in tandem with the D&D mechanics?

Comments

  • ShadooowShadooow Member Posts: 402
    It is already possible to do that. Read https://neverwintervault.org/article/tutorial/tutorial-vanilla-community-patch-ai-depth especiall the making custom AI paragraph
  • Dark_AnsemDark_Ansem Member Posts: 992
    I mean more sophisticated conditions, such as HP value.
    Thanks for sharing that patch, I had no idea it existed. will the fixes be merged with the new release?
  • ShadooowShadooow Member Posts: 402

    I mean more sophisticated conditions, such as HP value.

    Again that is possible to do already :smile: . You can code that very easily - there is a way how to make special AI for single creature (as shown in the cleric AI example) and there is a way how to determine HP to trigger something. It will look like this:

    if(GetCurrentHitoints() < 500)
    {
    Do Something
    }

    Thanks for sharing that patch, I had no idea it existed. will the fixes be merged with the new release?

    It is already available for NWN:EE here https://forums.beamdog.com/discussion/68131/community-patch-1-72-for-nwn-enhanced-edition/p1?new=1
  • ShadowMShadowM Member Posts: 573
    Give us some examples of what you need.
  • BalkothBalkoth Member Posts: 161
    edited January 2018
    You might want to look at this module I made: https://neverwintervault.org/project/nwn1/module/siege-heavens

    The final boss in this module is also heavily scripted, with some minor scripting on some earlier battles: https://neverwintervault.org/project/nwn1/module/peremptory-summons
  • Dark_AnsemDark_Ansem Member Posts: 992
    ShadowM said:

    Give us some examples of what you need.

    Basically, something along these lines:

    - barrier change boss (Magus from Chrono Trigger would be a perfect example)
    - when reduced to 0hp, transform into something else with full HP
    - lose X% of your health: teleport away/become invincible, summon enemies then return to field once summoned monsters are destroyed
  • ShadowMShadowM Member Posts: 573
    1. The barrier one with only one type of damage would be interesting to script a custom function on it. Would have call per round or health level etc.. or whatever parameter you want to fire the new barrier.(so have to look into this one more) Watching the video (omg been so long since I played it) So is he immune to all energy types except one and weapon damage or can the weapons still damage him? Just make sure I understand the mechanics.
    2. I have a sub-routine call on death that can fire all sorts of things just have to call for a spawn monster/form after the first form dies(hiding the body so it does not look like it died) and give some xp for completing the first stage of the boss or use SetImmortal and fire the change when they down to 1.
    3. I been meaning to put in a sub-routine in the on-damage/heartbeat for percentage HP or exact Hp fire event. I see if I can get it into the next base update.
  • Dark_AnsemDark_Ansem Member Posts: 992
    edited January 2018
    ShadowM said:

    1. The barrier one with only one type of damage would be interesting to script a custom function on it. Would have call per round or health level etc.. or whatever parameter you want to fire the new barrier.(so have to look into this one more) Watching the video (omg been so long since I played it) So is he immune to all energy types except one and weapon damage or can the weapons still damage him? Just make sure I understand the mechanics.
    2. I have a sub-routine call on death that can fire all sorts of things just have to call for a spawn monster/form after the first form dies(hiding the body so it does not look like it died) and give some xp for completing the first stage of the boss or use SetImmortal and fire the change when they down to 1.
    3. I been meaning to put in a sub-routine in the on-damage/heartbeat for percentage HP or exact Hp fire event. I see if I can get it into the next base update.

    Aw thank you so much for this!
    1) Magus is healed by all elemental damages except the barrier one (so, fire barrier: fire damages). Weapon hits still work BUT every time he is hit by a weapon he changes barrier type via counter. Does scripting allow for immediate counters / free actions?
    2) that sounds pretty much it. Would it work with a sort-of polymorph effect?
    3) thanks a lot!

    4) can scripting allow for "routinary" AI behaviour? Something ala: cast spell, wait one round, teleport, rinse and repeat til defeat without moving? Would that require waypoints?
    PS: was it rounds or turns? I'm a bit mixed up about how Combat works.
  • ShadooowShadooow Member Posts: 402

    1) Magus is healed by all elemental damages except the barrier one (so, fire barrier: fire damages). Weapon hits still work BUT every time he is hit by a weapon he changes barrier type via counter. Does scripting allow for immediate counters / free actions?
    2) that sounds pretty much it. Would it work with a sort-of polymorph effect?

    4) can scripting allow for "routinary" AI behaviour? Something ala: cast spell, wait one round, teleport, rinse and repeat til defeat without moving? Would that require waypoints?

    1) yes all of this is easily possible to do, the only specific of AI scripting is that it requires lots of time consuming play-testing :smile:

    2) could, but it is better to just spawn new creature - you can immediately destroy original creature so the body disappears fast and if you also spawn some visual effect such as VFX_POLYMORPH you can hide that scripting substition completely.

    4) Yes. Yes you would most likely want to prepare waypoints, it would be possible to do that without them, but it can lead to stuck/bumping issues. If you want to make the teleport very randomized, just prepare many waypoints and choose random one.

    tl'dr AI scripting is already very powerfull in nwn. I can't think of anything we would need from BeamDog maybe just some solution to dashing/kicking/knocking away. Currently, such movement actions requires quite ugly workaround. You can see this in community patch, special ability Dragon Wing Buffet which knocks away in BG2 dragon style.
  • Dark_AnsemDark_Ansem Member Posts: 992
    Shadooow said:

    1) Magus is healed by all elemental damages except the barrier one (so, fire barrier: fire damages). Weapon hits still work BUT every time he is hit by a weapon he changes barrier type via counter. Does scripting allow for immediate counters / free actions?
    2) that sounds pretty much it. Would it work with a sort-of polymorph effect?

    4) can scripting allow for "routinary" AI behaviour? Something ala: cast spell, wait one round, teleport, rinse and repeat til defeat without moving? Would that require waypoints?

    1) yes all of this is easily possible to do, the only specific of AI scripting is that it requires lots of time consuming play-testing :smile:

    2) could, but it is better to just spawn new creature - you can immediately destroy original creature so the body disappears fast and if you also spawn some visual effect such as VFX_POLYMORPH you can hide that scripting substition completely.

    4) Yes. Yes you would most likely want to prepare waypoints, it would be possible to do that without them, but it can lead to stuck/bumping issues. If you want to make the teleport very randomized, just prepare many waypoints and choose random one.

    tl'dr AI scripting is already very powerfull in nwn. I can't think of anything we would need from BeamDog maybe just some solution to dashing/kicking/knocking away. Currently, such movement actions requires quite ugly workaround. You can see this in community patch, special ability Dragon Wing Buffet which knocks away in BG2 dragon style.
    I miss Skyrim dragons.
  • ShadowMShadowM Member Posts: 573
    edited January 2018
    Dark_Ansem
    4) can scripting allow for "routinary" AI behaviour? Something ala: cast spell, wait one round, teleport, rinse and repeat til defeat without moving? Would that require waypoints?
    PS: was it rounds or turns? I'm a bit mixed up about how Combat works.

    Yes, bioware does custom AI by calling a script. I jump in and grabbed it by string and runs each by the string lookup and runs a function(s) in one file. I only done a few samples and if they not in the sample script it goes to the other script. Look in sp_combat_ai script and function WizSample that show how to control every action each round of the NPC/caster. The sample has the wizard cast/act each round for the first 7 rounds(whatever spell or action) then it kick back to the standard AI. So you could use this or make couple different ones for custom wizards/creatures and script there action/spells each round (you could use multiple string calls inside the function for different caster. You can do calls of move away from enemy or if you want more specific locations the waypoints works great.
    It the orc wizard in Area 001 for testing.

    It round(s).
  • Dark_AnsemDark_Ansem Member Posts: 992
    ShadowM said:

    Dark_Ansem
    4) can scripting allow for "routinary" AI behaviour? Something ala: cast spell, wait one round, teleport, rinse and repeat til defeat without moving? Would that require waypoints?
    PS: was it rounds or turns? I'm a bit mixed up about how Combat works.

    Yes, bioware does custom AI by calling a script. I jump in and grabbed it by string and runs each by the string lookup and runs a function(s) in one file. I only done a few samples and if they not in the sample script it goes to the other script. Look in sp_combat_ai script and function WizSample that show how to control every action each round of the NPC/caster. The sample has the wizard cast/act each round for the first 7 rounds(whatever spell or action) then it kick back to the standard AI. So you could use this or make couple different ones for custom wizards/creatures and script there action/spells each round (you could use multiple string calls inside the function for different caster. You can do calls of move away from enemy or if you want more specific locations the waypoints works great.
    It the orc wizard in Area 001 for testing.

    It round(s).

    I'm not sure I understood this correctly, but thank you.
  • BalkothBalkoth Member Posts: 161
    Short answer: yes, but it's complicated. Like Shadooow said, the biggest problem coding problem is forced/quick movement like dashing/knocking away. Took me hours to get something that approximated a dash which didn't bug out most of the time...but it's still hardly ideal.
  • Dark_AnsemDark_Ansem Member Posts: 992
    Balkoth said:

    Short answer: yes, but it's complicated. Like Shadooow said, the biggest problem coding problem is forced/quick movement like dashing/knocking away. Took me hours to get something that approximated a dash which didn't bug out most of the time...but it's still hardly ideal.

    what could improve that?
  • ShadowMShadowM Member Posts: 573
    edited January 2018
    Ok here a sample video on damage percentage and lower do custom action and on death do custom action. Fire action when 40% and under.
    LINK
    Post edited by ShadowM on
  • Dark_AnsemDark_Ansem Member Posts: 992
    edited January 2018
    ShadowM said:

    Ok here a sample video on damage percentage and lower do custom action and on death do custom action. Fire action when 40% and under.
    LINK

    Fantastic! Thank you!
    Post edited by Dark_Ansem on
  • BalkothBalkoth Member Posts: 161
    edited January 2018
    Fixing the dash/knockback would have to be some engine fixes that are beyond scripting.

    Here are two videos from that Siege of the Heavens module with more advanced boss scripting:

    Charion the Untamed.

    Selenoth the Hungerer.
  • Dark_AnsemDark_Ansem Member Posts: 992
    Balkoth said:

    Fixing the dash/knockback would have to be some engine fixes that are beyond scripting.

    Here are two videos from that Siege of the Heavens module with more advanced boss scripting:

    Charion the Untamed.

    Selenoth the Hungerer.

    Wow, those HP values...
    Although, this one is in a way a lot more advanced than what I had in mind!
Sign In or Register to comment.