Login / Registrieren
DE EN FR ES IT CZ
Zurück Nach oben

Change distance parameter to NPC / Entfernungsparameter zum NPC ändern

  • #1, by thomas-frings 4 years ago Zitieren
    When interacting with an NPC character, the main character runs to that NPC and automatically keeps a distance from the NPC. Probably this is a set parameter in the engine.

    Is it possible to override this via Lua script so that the main character does not keep a distance to the other person and stands very close, for example?

    Deutsch:
    Wenn man mit einem NPC-Charakter interagiert, läuft der Hauptcharakter zu diesem NPC und hält automatisch einen Abstand zum NPC. Vermutlich handelt es sich um einen eingestellten Parameter in der Engine.

    Kann man per Lua-Script dies überschreiben, dass der Hauptcharakter keinen Abstand zur anderen Person hält und zum Beispiel ganz nah steht?
  • #2, by afrlme 4 years ago Zitieren
    A'llo, unfortunately the wiki is currently down so I can't be sure, but I believe it's the ActionDestPosition data structure table you need to edit.

    Characters["Tom"].ActionDestPosition = {x = 100, y = 100}


    Alternatively you could offset from their current position instead if you don't want to use absolute coordinates (maybe for dynamic purposes).

    local char = Characters["Tom"]
    
    local pos = char.ActionDestPosition
    
    char.pos = {x = pos.x + 100, y = pos.y + 100}


    The example above should offset the interaction position to be 100 pixels to the right of & 100 pixels below the specified characters current position on the scene - position is based on the animation center you assign to each of the characters animations.

    Quick note: If your npc are always in a fixed position in a single scene, then you could actually set the default interaction position for the character inside of the properties section for the character via position for executing an action.
  • #3, by thomas-frings 4 years ago Zitieren
    Thanks for the quick reply!

    I changed the code a little bit, because the error "Unknown data-field "pos" for object (0,1)" appeared with the code.

    Here is the changed code, with which it works:

    local char = Characters["Tom"]

    local charPos = char.Position

    local pos = char.ActionDestPosition

    Characters["Tom"].ActionDestPosition = {x = charPos.x + 100, y = charPos.y + 100}