Aller au contenu

Photo

Blocking a Companion's Inventory Completely


  • Veuillez vous connecter pour répondre
18 réponses à ce sujet

#1
Dann-J

Dann-J
  • Members
  • 3 161 messages
Is there a way of blocking a companions inventory completely, so that you can't give them anything?

I've switched off selectability of a companion, so you can't open their inventory the usual way, but I can still drag and drop items from the PCs inventory onto the companion's portrait.

I wrote a script that should fire when their inventory is disturbed, that automatically cycles through the inventory and drops each item encountered (with the exception of healing potions), but it doesn't seem to fire at all when you give them items by dragging them onto the companion's portrait.

Any suggestions? Since you can't access this companion's inventory the usual way, if you drag-and-drop heavy items onto them there's a chance they could be slowed, with nothing the player can do about it (except perhaps casting bull's strength on them at regular intervals). You would also lose those items permanently.

#2
MasterChanger

MasterChanger
  • Members
  • 686 messages
What you're describing sounds more like a henchman than a companion. When you say you switched off selectability, did you mean that they cannot be directly controlled by the character, only commanded? Sounds like a hench to me.

Mind you, I don't know anything about the differences between hench's and companions from the perspective of scripting. I just wanted to bring up the distinction.

#3
Morbane

Morbane
  • Members
  • 1 883 messages
I think what MC said about a Henchman is the way you should go - afaik henchmen do not have an inventory at all - but i could be wrong

#4
Shallina

Shallina
  • Members
  • 1 011 messages
you seems to want a henchman, they just got a different set of script, and behave as you want.

#5
The Fred

The Fred
  • Members
  • 2 516 messages
A henchman would be better, but apparently this is the case:

Quoting 0100010, social.bioware.com/forum/1/topic/164/index/3120333 ...
AddHenchman
Attempting to exit to the main menu while a henchman (not a companion) is added
crashes the client
Workaround: Don’t do it


Modifié par The Fred, 14 janvier 2011 - 11:49 .


#6
PJ156

PJ156
  • Members
  • 2 982 messages
I had this issue. A henchman cannot be tampered with but also when they die they dissappear.

What can you do if you want a henchman who uses the companion on death script I tried copying scripts across but to no avail. In the end I had to make the henchman with a very high ac so he survivied a key fight. I wouod rather for balance reasons have the henchman come back like a companion would?

PJ

#7
The Fred

The Fred
  • Members
  • 2 516 messages
It should be possible to disable the inventory through the UI files. Like, run a script when the inventory panel is opened, and if the "henchman" is selected, close it again. You would probably also need to hide it when it's already open, if the henchman is switched to. Making a henchman who can't be controlled directly looks like an issue, though.

#8
Shallina

Shallina
  • Members
  • 1 011 messages
Take exemple on Slan on the OC, the lizard man. He do'esn't deasapear when he die.

#9
MasterChanger

MasterChanger
  • Members
  • 686 messages
There's an "immortal" flag that might help. I think the hench probably still leaves the party when they're KO'ed, but  don't disappear.

#10
Dann-J

Dann-J
  • Members
  • 3 161 messages
What I really want is all the benefits of being a companion (like waking up after being incapacitated), but with some of the aspects of being a henchman or animal companion.

This particular companion is non-selectable, which means you can't possess them or open their inventory, which is all good. It's just the drag-and-drop onto the portrait that is the problem. It functions as an inventory 'back door' that seems to bypass inventory disturbed checks. You can't drag-and-drop onto summoned creature portraits - but then again, they disappear when killed.

In other words; I want my cake, and I want to eat it.

Is there an event number for a character becoming encumbered? If so, then I could force the companion to drop their entire inventory if it gets too heavy for them. It's not a very strong companion, so it wouldn't take much to encumber it.

Or is it possible to remove the inventory completely from a companion?

Modifié par DannJ, 16 janvier 2011 - 09:55 .


#11
Dann-J

Dann-J
  • Members
  • 3 161 messages
I suppose another possibility is to give it a heartbeat script that checks if there are any valid items in the inventory, and them drops everything. I'd prefer to avoid a HB script though. Do they run even if the creature is busy doing something else (like attacking)?

I could always modify the HB interval so that it runs once a minute rather than once every six seconds. If you encumber the companion, you may have to wait up to a minute for it to "disgorge" though.

A SetHasInventory function would be useful, if it existed.

Modifié par DannJ, 17 janvier 2011 - 02:19 .


#12
Dann-J

Dann-J
  • Members
  • 3 161 messages
After some experimenting;

The 'drop all' script originally cycled through the companion's inventory and dropped everything, but I found that it crashed the game when magic bags were involved. I've found that the GiveAllInventory function works better.

The script works fine when executed from the companion's conversation, however it seems that companion heartbeat scripts don't always fire very predictably. It's probably because companions frequently have actions queued up. It will work a few times, then stop firing at all until the companion's actions are cleared in some way (talking to them, transitioning to a new area, etc). So it sort of half-works.

It's a disappointing work-around. It'd be so much better if an inventory disturb event was triggered when you drag-and-drop items onto a portrait. It'd be even better still if you could completely block this inventory back-door, which summoned creatures somehow manage to do.

Modifié par DannJ, 17 janvier 2011 - 09:30 .


#13
Guest_Chaos Wielder_*

Guest_Chaos Wielder_*
  • Guests
I thought there was a local into you could set on a henchman/companion to disable the inventory screen completely. I'll try and find it.

Edit:

Set  X2_JUST_A_DISABLEEQUIP =1

Modifié par Chaos Wielder, 17 janvier 2011 - 10:11 .


#14
Dann-J

Dann-J
  • Members
  • 3 161 messages
SetIsCompanionPossessionBlocked stops the companion being possessable, and also prevents the inventory screen opening. However you can still drag-and-drop items to the companion's portrait - which is the main problem I'm having.

#15
The Fred

The Fred
  • Members
  • 2 516 messages
I wondered if you might be able to hack the companion GUI to prevent that, but I'm not sure if there's any way of differentiating between "real" companions and those you don't want to get items. Of course, you might be able to turn it off completely, which might be a better solution than non at all.

#16
Dann-J

Dann-J
  • Members
  • 3 161 messages
I've experimented with adding a henchman (using the Slaan scripts from the first campaign rather than the default ones). The behaviour is exactly what I want (complete blocking of inventory - even drag-and-drop), however they certainly do leave the party when they die.

It's possible to make them resurrectable though, after which you can talk to them and have them rejoin, but that's not very desirable.

Now I'm thinking of giving them a modified troll script, which makes them fall down when reduced to 1HP, but removing the fire/acid vulnerability. This particular companion regenerates slowly anyway, so the troll script shouldn't need to be altered very much.

The challenge will be in making enemies ignore the fallen henchman. Perhaps some sort of sanctuary effect would do the trick. More to experiment with...

Modifié par DannJ, 18 janvier 2011 - 09:53 .


#17
Dann-J

Dann-J
  • Members
  • 3 161 messages
After nearly perfecting a troll-like knockdown script for an 'immortal' henchman, I've realised the full implication of The Fred's bug warning.

'While a henchman is added' doesn't mean the game will crash if you happen to exit to the main menu *while* the henchman is being added - the game crashes at any time *after* a henchman has been added if you try to exit to the main menu. I can't be bothered finding out why Slaan didn't do this in the first campaign (maybe he did?).

After all these increasingly complicated scripting experiments, a simple solution suddenly occured to me. I can fill the non-possessable companion's inventory with non-droppable, non-stackable, zero-weight custom items, so that any attempt to transfer items to it will fail due to lack of inventory space. No scripting required.

D'oh! Posted Image

Modifié par DannJ, 19 janvier 2011 - 09:16 .


#18
The Fred

The Fred
  • Members
  • 2 516 messages
If the henchman is only there for, say, one fight, the bug shouldn't be more of an issue than an annoyance, since nobody will be saving and exiting during a fight anyway. Furthermore, a crash when exiting the game is the least bad kind of crash. However if someone then wanted to start a new module etc. they'd have to load up the game again. Still, that's no worse than a lot of "known issues" that many commercial games ship with - you could just warn people first.



It seems that the inventory-filling approach might work, though, given that you can't view their inventory anyway. Make sure they're not going to want to, say, switch weapons, though, since that could mess things up.

#19
Dann-J

Dann-J
  • Members
  • 3 161 messages
This particular companion only has creature weapons, and nothing else equipped, so thankfully there won't be any equipment swapping. It also won't fall victim to disarming, which would have been another onion in the ointment (to quote Grampa Simpson).

I've now given it 128 cursed keys (the lightest non-stacking item type I could find). Any attempt to drag-and-drop items onto its portrait fails, with the item in question simply remaining in the PCs inventory. So much for complex scripting solutions...

The moral of the story appears to be; when all scripting attempts fail, just cram it full of keys. Posted Image

Modifié par DannJ, 20 janvier 2011 - 09:30 .