How could i make a npc imitate the players every move?Like if i lift my arm.He will lift his arm.Like if i jump.He will jump.

put a property PLAYER and STATE on the player.

when the player jump set the property -> STATE = “jump”

if collision with “PLAYER” :
if property of [player][“STATE”] == “jump” : => do jump

(supposing that player is a obj already present in the scene)

ah no, sorry ,you cannot do this from a sensor property
if property of [player][“STATE”] == “jump” : => do jump

with python:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner
player = own.scene.objects[“player”]
collision_player = cont.sensor[“Collision”]
if collision_player.positive and player[“STATE”] == “jump” : own.worldLinearVelocity.z = 5.0 #jump

This depends on how you structure the player and the NPC. And it depends on on what level this should happen.

A) you can make the NPC part of the player character like a second skin.

B) you can provide the NPC the same input as the player character. This way the NPC is a second player character.

C) you can make the player provide input to the NPC. This way the player character can add more input (e.g. player collision with a wall)

You know why i want to do this?I want to do this so that i can type in a name for what the player has done and then the npc can do what the player did.In fact the npc will remember by doing.

So it is a sort of “re-play”?

For simple objects you can use the TimeShift. It records the transformation of an object and plays it back “shifted in time”.

With your character you have similar choice as mentioned above:

  • Record the user input or
  • record player character signals.
  • You can even have other data (action name + frame number) or
  • a mix off all of that

“type in a name for what the player has done” is more a selection method how to access (and name) recorded data which is a topic of it’s own.