Rendering PC unable to interact with/attack objects while remaining able to move around


#1

Question: Does anyone know a way to take away PCs’ ability to use/attack other objects, without disabling mobility entirely (i.e., cutscene mode / SetCommandable(FALSE))? Think “astral projection mode”; walking around as a ghostly version of oneself that can look at but otherwise not interact with the environment.


#2

nwnx has OnAttack event, there you can block it


#3

Probably nothing you don’t already know, but here goes…

Single or multi-player?

If SP and “look at” means “see” but not “examine”, SetUsableFlag will disable placeables.

The plot flag will protect creatures from attack.

AFAIK all other cases require scripting - for example, OnConversation and transition scripts that do nothing if the player is a phantom.

The default transition script is nw_g0_transition. It’s good to have one conversation script, too, to facilitate this sort of thing.

Not sure how you could prevent interaction with items, short of not placing any on the ground, and blocking drops in the unacquire event.


#4

Thanks, you two. :heart:


#5

Would the dazed condition be of use? Maybe with a persistent AoE on the character that sets the useable flags of placeables to false on enter, and sets it back to normal on exit.


#6

Good idea, but sadly placeables don’t trigger OnEnter/OnExit AOE events. You’d need to run a constant, low latency Get*ObjectInShape check. While it would be immersive for a ghost to see placeables being barred from them in real time as they approach, but it’s probably better (read: safer and faster) to just scan whole area on enter and disable all placeables when you become “ethereal”.

Dazed creatures can also still pick and drop inventory items.


#7

Running a loop on the body-severed characters is a nice thought. Clearing the action queue if the current action is anything other than ACTION_MOVETOPOINT might do the trick, if that can tick fast enough to catch all undesirable actions. I’ll test that and report what happens.

edit:
Initial result: Confirming. The PC may still click on enemies, emit battle-cries, and make initiative rolls, but they are no longer able to complete the action, thereby initiating combat mode (and ridding themselves of their Sanctuary and Invisibility effects) even when they are standing directly beside the enemy. 0.3 seconds seems to be a safe tick speed to prevent combat and item pick-up, but not item dropping, but that can be prevented by temporarily flagging all items undroppable.

:drooling_face::+1:


#8

Try combining that with EffectDaze, as per @Wendigo211’s suggestion. It will prevent entering combat state (but not initializing conversations, though that can be prevented via scripting). The wobble animation can probably be circumvented. Adding EffectHaste() counters the movement reduction, but looks a bit silly.

Combining that with your idea of making all inventory undroppable, you can fill the inventory up with “ethereal blockers”. Preventing equipping is also easy.