Author Topic: NPC's equiping items, 2 questions  (Read 373 times)

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
NPC's equiping items, 2 questions
« on: September 04, 2011, 05:36:55 am »


               Hi!

I finally got my random item generator to work for my NPC's.
I am able to spawn in X random items, add random properties to them and get them to equip the stuff for combat.

However, the only 2 things I  can verify that they are equiping are shields and weapons. I  cannot tell if they are equiping belts, jewelry, boots, etc. How can I tell if the NPC is equiping this stuff?


Secondly, the NPC will regularly change weapons or shields during combat since they are liable to have multiple of each. How can I get the NPC to just use what he first equips?

On perception I  have
    ClearAllActions();
    ActionEquipMostEffectiveArmor();
    ActionEquipMostDamagingMelee();
    ActionEquipMostDamagingRanged();
    ActionDoCommand(ActionAttack(oPC));

I tried adding a do once statement, but that forced 2 of the test npc's to just sit there and the first one still swapped the equipment in and out.

Thanks!
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #1 on: September 04, 2011, 06:00:23 am »


               

Zeidae wrote...

 I  cannot tell if they are equiping belts, jewelry, boots, etc. How can I tell if the NPC is equiping this stuff?

Well,   If you do not tell them to equip them they will not. 


Zeidae wrote...
Secondly, the NPC will regularly change weapons or shields during combat since they are liable to have multiple of each. How can I get the NPC to just use what he first equips?

On perception I  have
    ClearAllActions();
    ActionEquipMostEffectiveArmor();
    ActionEquipMostDamagingMelee();
    ActionEquipMostDamagingRanged();

    ActionDoCommand(ActionAttack(oPC));


If this is what you have in your script.  you are telling the NPC to equip a melee weapon then equip a ranged weapon. The AI at that point may be switching them back to melee weapons.    You could probable just leave the standaed perception script in place and let the AI handle the weapons.
               
               

               
            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #2 on: September 04, 2011, 06:07:20 am »


               The NPC's have started with ranged weapons but then they quickly jump to melee combat and don't go back to the ranged weapons. But they will swap out melee weapons.

How do I tell the NPC's to equip belts, boots, etc? I had the standard script executing from this one but it gave me an error when I tried to compile. But that's another story '<img'>

thanks
               
               

               
            

Legacy_Baragg

  • Sr. Member
  • ****
  • Posts: 496
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #3 on: September 04, 2011, 01:19:27 pm »


               Do a loop thro the items they have in their bag, determine the item type then run a switch in the loop telling them if this is a belt_item put it in the belt slot...........and so on and so forth. Once you have done the loop equipring all the stuff, then run another loop destroying whatever is left in their bag.
               
               

               
            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #4 on: September 05, 2011, 12:42:53 am »


               Thanks for the replies so far. I have been able to get the monsters to equip some loot without any loop statements.

What I still need to know is how to get them to not change weapons during combat. Is there any easy way to delete an inventory, minus what they have equiped? And minus ammo. I could not find any easy way to do that.

Thanks '<img'>
               
               

               
            

Legacy__Guile

  • Hero Member
  • *****
  • Posts: 1308
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #5 on: September 05, 2011, 04:07:52 am »


               Why not just give them like 3 - 6 items with random properties on them and have them equip all of the items regardless?

If you want archers, then just give the archers ranged weapons only & melee fighters only melee weapons.  I don't see how you could randomize a caster other than making them shoot random spells, though, as it is explained in XP2, random spells may make you enter situations where the spells they cast may be completly inappropriate or useless to the situation.

Makes sense to make random items for mobs, but randomizing too much may be bad, some Item &/or Properties on those items may not be effective or too effective.

Because you need more consistency to get a solid challenge, you don't want to overwhelm the PCs nor Underwhelm them, and a system that is too random is threatening to do one or the other, unfortunately.
               
               

               


                     Modifié par _Guile, 05 septembre 2011 - 03:12 .
                     
                  


            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #6 on: September 05, 2011, 04:38:27 am »


               i'm not randomizing casters. All NPC's get random armor, melee weapons, ranged weapons and ammo.

as for some items being not or too effective, that is sort of the idea. '<img'> I'm not looking for cookie cutter battles where it's the same damn thing against the same mob. Variety is the spice of life.
I am not worried about items being too strong, though, cause if it's too high a level, the npc CAN'T USE IT. All of the NPC gear is on par with the players gear only I had to remove over half of the properties. So instead of having a chance of AC 1-14 its 2, 4, 6, 8, etc.

And the PC's will be able to fill all of their slots with equipment and CHOOSE what to use. The NPC's will only be getting a handful of equipment. Lots of empty slots. So I am definitely not worried about the NPC's being too tough.

But I would still like it if the NPC did not try to equip other weapons in their inventory once they have chosen a weapon. And I believe the best way to accomplish that is to delete their inventory. But I don't know how to easily do that.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #7 on: September 05, 2011, 05:43:44 am »


               

Zeidae wrote...

i'm not randomizing casters. All NPC's get random armor, melee weapons, ranged weapons and ammo.

But I would still like it if the NPC did not try to equip other weapons in their inventory once they have chosen a weapon. And I believe the best way to accomplish that is to delete their inventory. But I don't know how to easily do that.


If you are just going to delete the remainder anyway, then why not have the script decide their weapon for them and only create that item.

e.g.
If zen archery and wisdom is greater than dex and str: use range
Else if weapon finesse and dex is higher than strength: 50% range 50% melee
Else if dex is higher than strength: range
Else: melee
               
               

               
            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #8 on: September 05, 2011, 05:50:38 am »


               because that is a heck of a lot of complicated scripting for a non scripter to do '<img'>
I have to use lilac's for the majority of what I create. Anything it can't do, I come here '<img'>

And because it's random, create A could get 3 exotic weapons that he can't equip the first time you meet him, making him easy because he has to hit you with his fists, and the next time he could get that scimitar he really likes and hurt you a bit. Random. A ranger could get a crossbow or a longsword. Random. I would just prefer that once the monster has chosen a weapon that the rest of the items gets deleted.

I already have the random item creation script. Instead of trying to make something complex, a (hopefully easy) deletion script would seem the simplest option to do what I need. It isn't a deal-breaker having the monsters swap weapons, but it does look odd. But hey, maybe one weapon is real nice and the other crappy and you'll be sitting there hoping that he DOES switch! '<img'>
               
               

               
            

Legacy_Zeidae

  • Jr. Member
  • **
  • Posts: 72
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #9 on: September 05, 2011, 05:52:08 am »


               double post
               
               

               


                     Modifié par Zeidae, 05 septembre 2011 - 04:52 .
                     
                  


            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #10 on: September 05, 2011, 07:31:25 am »


               You could just use the functions EquipMostDamaging Melee/Ranged. Usually what I do, or at least part of it, is too have the npc use a range weapon if the Target, most likely a PC, is farther away say > 10 meters then at less than that switch to their most damaging melee weapon and attack.  There's a bit more to it than that, that's fairly basic.
So that way no worries about them switching weapons and you could always delete any weapon that was not in the category of most damaging.
               
               

               


                     Modifié par ffbj, 05 septembre 2011 - 06:34 .
                     
                  


            

Legacy_Xovian

  • Full Member
  • ***
  • Posts: 158
  • Karma: +0/-0
NPC's equiping items, 2 questions
« Reply #11 on: September 11, 2011, 04:23:08 am »


               You may have already gotten what you wanted or needed for your module, but I have a new version of my scripts and such for henchman/npc's in my starter module. The original AI concept comes from Tony K's AI, but I modified it to accomplish a few more tasks that generally were not being done by NPC's and Henchman alike. An example of this is, clerics that are high enough level actually casting resurrection on other Henchman, or friendly players.

Might not be what you want, as there's a lot more to it then just that, but if you find yourself hitting a wall, it might be worth checking out for ya.
               
               

               


                     Modifié par Xovian, 11 septembre 2011 - 03:29 .