Change name object with condition

  • #1, by emanuele-barontiSaturday, 06. February, 02:40 A month ago
    Ciao a tutti, vorrei sapere come poter cambiare il nome ad un oggetto con una condizione.
    Come in monkey island se non hai ancora interagito con l'oggetto si presenta prima un punto interrogativo e poi il nome dell'oggetto.

    Hi everyone, I would like to know how I can change the name of an object with a condition. I want to name them with "?" before having examined it


    5 Posts

  • #2, by afrlmeSaturday, 06. February, 13:42 A month ago
    1. Add this function as a definition type script to the script section of the editor:

    function updateName()

    local n = game.CurrentObject.Name.TextLanguages

    for i = 1, #n do

    n[i].text = game.CurrentObject.Values["name"].String


    game.CurrentObject.Name.TextLanguages = n


    2. Now what you need to do for any objects you want to change the name for is create a value on the object, character, etc & rename it to "name" & add the name you want it to display on mouse over if a condition is met.

    3. Create a on mouse enters action & do something along the lines of this:

    if conditions "example" is true
     execute a script >

    end if

    & what should happen is that if the condition you query is true that it should change the name of the object, character, etc to the name inside of the "name" value you should have created.

    Quick note #1: names do not get stored in the savegame data, so this is the only viable solution for dynamic names.

    Quick note #2: objects can be a little more complicated, especially if you plan on translating your game into multiple languages as you will need to use tables or multiple values instead.


    6935 Posts

  • #3, by esmeraldaSaturday, 06. February, 17:31 A month ago
    The method AFRLme described is pretty easy to implement and works great.

    If it is only one object you want to change the name for (and only one namechange) and you are not keen using lua, you could also do this by using two objects. Copy your object, give it the changed name and assign the condition to both objects, check the negate conditon box one one of them. So one object is active when the condition in true, the other when the condition is false.

    Great Poster

    412 Posts

  • #4, by emanuele-barontiSunday, 07. February, 17:16 3 weeks ago
    Thank you so much!


    5 Posts

Write post