FIrst Person adventure

  • #20, by esmeraldaSaturday, 22. August, 23:20 A month ago
    Welcome!

    A simple way to position texts is to use "display narration text". (found in the miscellaneous tab) This way you can position the text by giving the x and y coordinates.

    In a dialog (using the built in dialog system)  you can use the narration text by ticking the box for the alternative text, leaving the answer empty and writing your dialog in the dialog-action-window. (clicking on the little yellow arrow right on the "execute action" field.


    Nigec mentioned a while back a way to positon the text by using a dummy character. Not the transparent one, but I forgot what he said, sorry. (I don't make first person games) Maybe he is around in a bit...


    You can trap the invisible character in a tiny wayborder. Else it is moved to the upper left corner.

    Great Poster

    389 Posts


  • #21, by afrlmeSaturday, 22. August, 23:24 A month ago
    Damn, nice necro.

    I believe what you want is a script to force the text position to a specific part of the screen.

    function adaptedTextPosition(text)
    if text.Owner:getId().tableId == eCharacters then
    text.Position = {x = game.WindowResolution.x / 2, y = 100}
    return true
     end
    return false
    end

    registerHookFunction("setTextPosition", "adaptedTextPosition")
    1
    2
    3
    4
    5
    6
    7
    8
    9

    Add this script to the script section of the editor. Set as "definition" type script. Feel free to edit the x & y positions in the text.Position line of the script. The example I've shared (providing you have set the alignment of display text (character text) as centered, it should center the text horizontally on the current viewport & offset the text by 100 pixels from the top of the screen.

    Also, please feel free to join our discord server (https://discord.gg/g5zFejW) where we are a lot more active than on the forum. wink


    Imperator

    6842 Posts

  • #22, by retinaSunday, 23. August, 11:01 A month ago
    Thanks both esmeralda and afrlme,

    The script from you afrlme worked directly and I think the script is the smoothest way.

    Edit: Now, the dialog part text of the NPC is also positioned in the same place. I would like to leave it above the NPC.
    Edit2: Hey, i added the following text to script, like you mentioned earlier in this Thread, and it worked:
    and text:getLink(VTextOwner):getName() == game:getLink(VGameCurrentCharacter):getName()

    Thanks a lot

    Newbie

    4 Posts

Write post