Jump to content

Stop NPC Mannequin from being pushed by player


Recommended Posts

I'm working on an NPC mannequin that I'd like to stay put.
It does not move on it's own but somebody is complaining that they can push it around the room.
I added code to reposition to editors location every second.
That person still is not satisfied and deleted that code - they complain that when they push it "jumps" back.

There is no actual need to push, Activate works from the usual distance - I could simply reduce the delay to 0.05 seconds if there is no other solution.

 

The original code was...

 

 

	if isActorsAIOff == 0
		setActorsAI 0
	endif

	if getIsGhost == 0
		setGhost 1
	endif

 

 

  • NPC does not move.
  • Weapons make no contact.
  • Player makes no contact other than Activate (can walk through the NPC).

The problem is that EquipItem and UnEquipItem fail - removing "setActorsAI 0" solves that.

EDIT: I tried using setActorsAI 1 just before calling the Equip/Unequip function but it made no difference.

 

I replaced the setActorsAI with setUnconscious 1...

 

 

 

	if getUnconscious == 0
		setUnconscious 1
	endif

	if getIsGhost == 0
		setGhost 1
	endif

 

 

  • NPC does not move.
  • Weapons make no contact.
  • Player makes contact as well as Activate (can push the NPC around).

The final code to allow for player accidentally bumping into the mannequin but still support EquipItemNS/UnequipItemNS...

 

 

begin gameMode
;if activated call equip function here
;endif
		let fDelay += getSecondsPassed
		if fDelay > 1
			let fDelay := 0
			if fX + fY + fZ + fAngleZ > 0
				setPos x, fX
				setPos y, fY
				setPos z, fZ
				setAngle z, fAngleZ
			endif
		endif

end

begin onLoad

; Initialize variables to editor positioning
	if fX + fY + fZ + fAngleZ == 0
		let fX := getStartingPOS x
		let fY := getStartingPOS y
		let fZ := getStartingPOS z
		let fAngleZ := getStartingAngle z
		let fX += 0.1 ; DoOnce == true
	endif
  
	if getDisabled == 0
		setPos x, fX
		setPos y, fY
		setPos z, fZ
		setAngle z, fAngleZ
	endif
	

	if getUnconscious == 0
		setUnconscious 1
	endif

	if getIsGhost == 0
		setGhost 1
	endif

end

 

 

 

Is there another way to achieve requirements?

Link to comment
Share on other sites

Having reduced the delay to 0.1 I can now see the problem.

The NPC 'settles' after OnLoad - using the editor position on GameMode results in the NPC vibrating up and down.

 

I've coded a working solution that waits 2 seconds for the 'settling'.

There is a switch that enables/disables male/female versions of the mannequin.

The solution had to incorporate the disable/enable with a delay.

 

The problem now is that if I use the switch 4-7 times in a row it can crash the game.

 

To be honest, if it were my mod I would be listing the 'push NPC' as a Know Issue - that is unless there is an alternative to SetUnconscious.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...