FIrst Person adventure

  • #20, by esmeraldaSaturday, 22. August 2020, 23:20 3 years 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.

    Key Killer

    513 Posts


  • #21, by afrlmeSaturday, 22. August 2020, 23:24 3 years 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")

    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

    7278 Posts

  • #22, by retinaSunday, 23. August 2020, 11:01 3 years 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