Skip to content

Script a creature to pick up an item and equip it - how?

chimericchimeric Member Posts: 1,163
I'm looking for a way to script a creature to look around for usable items, on the ground, get them and equip them. Is that possible?

Comments

  • CamDawgCamDawg Member, Developer Posts: 3,438
    This is a classic 'this should be simple, but is actually damn near impossible' aspect of the IE. I'm pretty sure this one is actually impossible--except under incredibly controlled circumstances, like you already know the ground piles and their contents, not the on-the-fly way you seem to be describing this--but I'll let one of the more experienced AI scripters confirm that and crush your dreams definitively.
  • ArdanisArdanis Member Posts: 1,736
    You can pick a specific item, and only if it's within actor's LoS (otherwise they'll stutter in place).
    What I suspect you have in mind, unfortunately, is exactly as CamDawg says.
  • chimericchimeric Member Posts: 1,163
    No, it's good that it has to be within LoS. Limits it nicely. And the other limitation is handy too, in this case. I'm looking for a way to make just-killed creatures brought back by my new Animate Dead spell to reequip themselves with the items they just dropped. They wouldn't be too useful flailing their fists. So what's the code? Can I put an item type in it instead of a concrete item? How about some kind of "on acquire type then equip" function?
  • ArdanisArdanis Member Posts: 1,736
    edited June 2017
    So just like I said, "what I suspect you have in mind" :)
    The only action I'm aware of is PickUpItem() which requires exact item code, so everybody would need a custom script to pick up their personal set of equipment.

    The issue with range is that if the corpse's sword has been picked up and another one dropped somewhere else, he'll likely be stuck in place trying to get the second one. The action will sense an item anywhere on map and attempt to execute itself, but the execution part only works correctly when item is within actor's LoS. And you can't exactly check the distance to the nearest item on the ground - unless you can somehow detect the ground pile's container entry, which I'm unaware if possible, - so it's a problem.
  • chimericchimeric Member Posts: 1,163
    edited June 2017
    Ardanis, which action number is this? PickUpItem()? It's not in the updated G3 guide.

    Speaking of limitations here, I can probably script the creature to only try and pick up that sword if it's got nothing equipped already etc.

    Oh, wait. It's in the guide.
Sign In or Register to comment.