Author Topic: Question about potions for AI battles  (Read 483 times)

Legacy_apunyfly

  • Jr. Member
  • **
  • Posts: 60
  • Karma: +0/-0
Question about potions for AI battles
« on: February 04, 2016, 05:47:31 pm »


               

Hello all.


 


First off, I'm amazed my login still works after three years or so of inactivity. And happy to see people still be here talking about my favourite game ever (although the forum seems slower and less reponsive for some reason -is it just me or is it clunkier than it was ?).


 


I've never been a really active member of the community, learning about it in 2010 or so, and then being distracted by other stuff... 


 


I remember having an idea a while back, but never talking about it. Searching the current forums yielded nothing similar. So here it is.


 


I recall finding in the old forums a discussion about script battles. Essentially, both contestants of such a battle had to kill the other's character by using scripts. It seemed like a fun idea, and I don't remember the full details but I do remember it quickly maxed out (one of the posters had written a script that the other simply couldn't recover from).


 


The idea I had in mind was a little different.


 


AI battles. I don't know if anyone's ever thought of it. Build a character, write scripts to determine its behaviour, pit it against somebody else's character.


 


Here's an idea of what it could be like : 


 


Build a character, drop him on a map, and then have him look for a weapon. After that, how to fight, which spells to use, when to flee, etc. depends on your AI skills.


 


Here's the thing though. I don't have the toolset available so can't directly check, but I seem to recall (in 1.69) that there wasn't any function available for drinking a potion. Is this true ? Is it impossible to force an NPC to drink a potion in its inventory ?


 


I'm not sure if this is the correct place to discuss it, but does anyone think this AI battle system is a good idea ? Any extra ideas ? Like perhaps limiting spells to non-targeted spells to make positioning and movement more important ? Have multiple AIs ? What do you think ? I don't know that much about building good characters or the D&D rules and guidelines, so don't know what problems might arise.


 


Anyways, thanks to you all for being here, I love this game.



               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Question about potions for AI battles
« Reply #1 on: February 04, 2016, 06:32:42 pm »


               

Potion drinking goes through the talent system.  This system also includes spells and special abilities without a way to distinguish between them.  If you are able to locate a potion that you wish to use, then you would find the spell it casts through its cast spell item property and then feed that spell ID into the talent commands.  However, if the creature already has an identical spell prepared, it may use that instead.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Question about potions for AI battles
« Reply #2 on: February 04, 2016, 06:55:26 pm »


               


Potion drinking goes through the talent system.  This system also includes spells and special abilities without a way to distinguish between them.  If you are able to locate a potion that you wish to use, then you would find the spell it casts through its cast spell item property and then feed that spell ID into the talent commands.  However, if the creature already has an identical spell prepared, it may use that instead.




there is a way how to distinguish between potion and normal spell/ability


 


check the GetCreatureTalentBest on lexicon which I severely improved and explained


 


its impossible to distinguish between wand/scroll/potion though, but you can get some of the potion through TALENT_CATEGORY_BENEFICIAL_ENHANCEMENT_POTION, TALENT_CATEGORY_BENEFICIAL_CONDITIONAL_POTION,  TALENT_CATEGORY_BENEFICIAL_HEALING_POTION or TALENT_CATEGORY_BENEFICIAL_PROTECTION_POTION.


               
               

               
            

Legacy_apunyfly

  • Jr. Member
  • **
  • Posts: 60
  • Karma: +0/-0
Question about potions for AI battles
« Reply #3 on: February 04, 2016, 09:42:35 pm »


               

OK, thanks for the replies. 


 


Seems odd to me that such a basic action is implemented in a slightly more abstract way than most of the functions used concerning equipment, but i guess I need to delve back into scripting more.


 


Do you see any other scripting issues linked to this idea or should I discuss it in another subforum ?



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Question about potions for AI battles
« Reply #4 on: February 05, 2016, 04:31:35 am »


               

Well AI battles are more suited into rts games, in nwn most vanilla creatures will work basically the same no matter of AI because they dont have enough abilities and because of the round engine. It would have to be really powerfull creature to start with with lots of different abilities.


 


But I like the idea, will try this with available AIs on vault. Still all of them are generic and if you are creating a boss its always better to use a custom AI specifically for that creature.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Question about potions for AI battles
« Reply #5 on: February 05, 2016, 11:11:18 am »


               

Tried to compare vanilla, CPP and TonyK, but it won't work like this.


 


All three AIs are very generic and solve every creature, its extremely hard to test which is better because while TonyK can do better in specific case, CPP can do better in other case.


 


I was using a 40 lvl wizard with heal potion, 5 igms scrolls and 3 MD scrolls. Also I gave him gaze: death special ability. other than that the spells were selected by creature wizard + I gave him see invisible and true seeing.


 


All three AI had very big problem with invisible creatures. When I put vanilla AI against CPP AI, both wizards started with improved invisibility, then spell mantle and then because they didnt see eatch other they did nothing. In repeated test I had to gave them true seeing on staff to avoid this issue.


 


When I put TonyK vs CPP it was even worse. TonyK ai decided to start with Timestop which is good idea as it allows to strike the enemy before he puts defensive spells. However, CPP started with improved invisibility and after Timestop was in effect, TonyK AI wizard lost LoS from CPP wizard, walked into his last spot and did nothing until CPP AI wizard casted all defenses and attacked him (which happened after like 20 rounds lol).


 


So kind of all three AIs failed '<img'>



               
               

               
            

Legacy_apunyfly

  • Jr. Member
  • **
  • Posts: 60
  • Karma: +0/-0
Question about potions for AI battles
« Reply #6 on: February 05, 2016, 12:25:39 pm »


               

That's pretty interesting. Was it fun seeing them fight against each other ?


 


My idea was more like having people write their own AI and then have contests to see which one wins. I was expecting problems to pop up, and the need to impose rules.


 


The AIs you mentioned don't react to invisibility well, but a smart AI scripter would have to take that into account, I guess.


 


The thing that would need to be decided though, is what rules to set. Being able to poll for enemy player position when they are not visible or applying that their weapon or spell doesn't have would have to be out of the question.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
Question about potions for AI battles
« Reply #7 on: February 05, 2016, 02:04:42 pm »


               


That's pretty interesting. Was it fun seeing them fight against each other ?


 


My idea was more like having people write their own AI and then have contests to see which one wins. I was expecting problems to pop up, and the need to impose rules.


 


The AIs you mentioned don't react to invisibility well, but a smart AI scripter would have to take that into account, I guess.


 


The thing that would need to be decided though, is what rules to set. Being able to poll for enemy player position when they are not visible or applying that their weapon or spell doesn't have would have to be out of the question.




It was fun and it revealed to me two new issues that my AI doesn't fixed yet. Also TonyK is able to summon epic dragon and epic mummy and if the NPC wizard I tested with didnt have ac 40 then that would be deciding factor - but since mummy couldnt hit, my AI won because of that stupid start of TonyK I mentioned.


 


As for visibility its a bit issue, I was working on this is past and the problem is that invisible creature/player doesnt trigger OnPerception - you can't hear him. Obviously, you can cheat - AI does look only for enemies it can see, but you can change this so if nobody is seen or heard, you can then look for invisible/GS creatures and cast on their position, but thats not really legit much. Idk.


 


Definitely a good way to improve AI, I was looking for some new improvements after my polymorh AI feature in last 1.72beta and this showed me some.


               
               

               
            

Legacy_apunyfly

  • Jr. Member
  • **
  • Posts: 60
  • Karma: +0/-0
Question about potions for AI battles
« Reply #8 on: February 05, 2016, 02:23:30 pm »


               

Ok, nice. It's good that it helped you out a little as well.


 


I would think that if no creatures are seen or heard, spellcasters could dispel magic


 


I'll try experimenting with it a little, and try and get a good ruleset (perhaps some of the combat rules would have to be changed a little, or other constraints need to be added, no idea how to do that, and some of the old links are dead), but I am currently moving houses. And then I have to get back into the toolset, which might take a little while as well. But at the very least I've mentioned the idea, for now, anyway. 


 


Thanks for the feedback.


 


1.72 ??? Last time I was here you were making patch 1.70.


And when I played I played casually, I wasn't too worried about optimising AC and stuff, I feel like a primary school student talking to Terence Tao.