Jump to content

Photo

Make an NPC mirror the player's movement?

scripting ai

  • Please log in to reply
3 replies to this topic

#1
Radioactivelad

Radioactivelad

    Faithful poster

  • Supporter
  • PipPipPipPip
  • 1,050 posts

I was wondering if it would be possible to do an old-school trick for "reflections" by having a mirror image of a room on the other side of an invisible wall.

 

As the title implies, the biggest hurdle for selling this illusion is having an NPC mirror the player. Copying their appearance and equipment is pretty easy, but I'm not so certain on the movement.

 

Any ideas?



#2
madmongo

madmongo

    Faithful poster

  • Members
  • PipPipPipPip
  • 1,383 posts

You can make an invisible marker and have your reflection NPC always move to that marker. Then it's just a matter of calculating where to move the marker to on the other side of the "mirror" and which way to have it facing, both of which are easy to calculate (especially if you orient the "mirror" in either the X or Y direction).

 

I don't see any way to have the NPC mimic the player's animations though. If there is a way to force the game engine to do that, I don't know what it is.



#3
IntenseMute

IntenseMute

    Old hand

  • Supporter
  • PipPipPip
  • 506 posts

If a working mirror is what you desire I'd recommend learning the ProjectExtraCamera and AttachExtraCamera functions (These functions allow you to project a point of view from any location onto the surface of an object).

Can't really help you on how to get these functions working since the last time I tried to use them was several months ago but I do warn you, if you choose to go this route you might have to deal with problems involving occlusion culling.

 

Edit: Also, I should mention this note as seen on the wiki page: "This function should be considered EXPERIMENTAL, and may change considerably (or be scrapped, altogether) in the future."


Edited by IntenseMute, 01 December 2021 - 05:19 AM.


#4
clanky4

clanky4

    Enthusiast

  • Members
  • PipPip
  • 217 posts

I'd suggest checking the scripting used in one of those "controllable" creature type mods. The frontier has some and hopper made a were-claw mod that also has one:

https://www.nexusmod...egas/mods/60946

 

There are script functions within these that play a certain animation for a creature when the player presses a certain button. That might be what you are looking for.







Also tagged with one or more of these keywords: scripting, ai

IPB skins by Skinbox
Page loaded in: 1.106 seconds