Forum Discussion

11 Replies

  • Madlios's avatar
    Madlios
    Start Member

    Im afraid u gotta grind through the freely available docs, tutorials etc. took me 3 days to learn all aspects of horizon worlds from 0. It is not impossible but require intense focus and dedication

  • Were you able to find the Talking Pirate public asset in the asset library?

    • B5L1P57R3AM's avatar
      B5L1P57R3AM
      Start Member

      Yes I did but I dont think he is programmable in the sense that I need him (or any NPC) to be programmed. I dont think that now, because I have made quite a few attempts, but lack of knowledge and ultimately patience stopped that. I am sure there is a way to get NPC to speak through TTS script (like a play script, not typescript, script) Just havent found it yet....I've not been on for a few days as ive been enjoying the basic javascript online training. MoneyMitch26​ suggestion of codecademy is great, seem s more user-friendly so on with that right now. It'll all come together :)

  • So, i've had a good play around with the Talking Pirate and found a pretty useful guide on the forum.

    Talk to Them: LLM NPCs slide deck | Meta Community Forums - 1346530

     

    I have tested both 2D and 3D and I am now able to have a conversation with my NPC but only in 2D. I have tried with my headset but he is not speaking when spoken to.  Any ideas on how to fix this?

    Also I think this might be what I need in order to give the NPC a transcript but cant seem to find where I would apply this, again any help would be appreciated :)

    ● Use add Response(player: Player, transcript: string) to 'force feed' a conversation 
    from a player into the LLM's memory, as though the player had actually spoken it to the NPC
    ● Use elicitResponse() with no instructions to cause the NPC to respond to the synthetic 
    conversation.
    ● Listen for OnNpcFullResponse event from the Npc Gizmo to get the full text response, or  call 
    setSpeechBubbleTarget() to retarget the speech bubble output to a specific debugging 
    TextGizmo

    Think im getting close! :]

    • SeeingBlue's avatar
      SeeingBlue
      MHCP Mentor

      That is great news that you got the conversation working in 2D. That means your logic and the NPC setup are correct.

      As to why it doesn't work in 3D may come down to just a Meta bug, but make sure you're stepping into the activation trigger and looking at the NPC when you speak.

      You are looking at TypeScript methods. You need to write a small script file.

      Where to put the code:

      1. Create a new Script in your world (e.g., named NPCManager).
      2. Attach that script to your NPC object (or a separate object that references the NPC).
      3. You would call these functions inside the Start method of your script or a Trigger event.

      Example Structure: Here is a simplified idea of how that code looks inside a script. This  is an untested example:

      // You need to import the NPC type
      import { Npc } from 'horizon/npc';
      
      class NPCManager extends Component<NPCManager> {
      
        // Create a property to drag-and-drop your NPC into
        static propsDefinition = {
          myNPC: { type: PropTypes.Entity } 
        };
      
        start() {
          // 1. Get the NPC component from the entity you attached
          const npcComponent = this.props.myNPC.as(Npc);
      
          if (npcComponent) {
            // 2. FORCE FEED THE MEMORY (The Transcript)
            // This makes the NPC "remember" a fake conversation happened
            npcComponent.addResponse(this.entity.owner, "Hello, are you the Wizard?"); 
            
            // 3. MAKE IT TALK
            // This forces the NPC to reply to the history you just added
            npcComponent.elicitResponse(); 
          }
        }
      }

       

      • addResponse: Use this to seed the memory. For example, if you want the NPC to act like you just insulted him, you addResponse of you insulting him, then elicitResponse to make him react.
      • OnNpcFullResponse: You would put this inside a connectCodeBlockEvent or similar listener if you wanted to capture the text of what he says (e.g., to put it on a text board).

      Hope this helps you connect the dots!




  • Hiya mate, i really want to say to you it does make sense, and from spending the last week on Codecademy learning JS a lot of it is now becoming familiar. What i don't understand is the structure of the coding and knowing that correct punctuation and spacing is critical. If i miss this attention to detail and it doesnt work, i will automatically assume it is my level of ability not a semi-colon i've missed somewhere. 

    Ive scoured the database, found some helpful stuff, found some documents wont allow me access. Ive used AI with varying degrees of success and failure, mainly failure as AI doesnt seem to "read" Desktop Editor well, and insists to me that I should carry out certain actions, when those actions simply dont exist in what I am looking at. 

    What I need help with and perhaps a more simplified explanation is as follows:

    1. Know that I am using the correct NPC. On my DE I can only select NPC from the Gizmo on the build bar.
    2. Be able to assign the following (very basic) transcript to the NPC:
      NPC [Scarecrow]"Pardon me, that is a very nice way." Me [Dorothy] "Who said that" NPC "But that way is nice too] Me "That's funny, wasn't he pointing the other way?"
    3. Preview and interact with the NPC each of us saying our part of the transcript to each other. 

    I am thinking if I can get help with this and see it actually working I can reverse-learn having seen that it is possible, that I am not going mad and do have the right tools for the job (Not according to AI!) Keeps telling me Im in Studio and not editor.... 

    Ant :] 

    • SeeingBlue's avatar
      SeeingBlue
      MHCP Mentor

      Don't miss my AI workshop tomorrow. Should help you with some of your prompting for Horizon.

      AI Coding Agents | Meta Community Forums - 1360721

      1. There is only 1 AI-enabled NPC gizmo. You're using it.
      2. With the LLM powered AI NPCs you can't really script a specific respond in the way you are describing. You could instruct an AI to take on the Scarecrow persona, but he's going to reply however he wants within the guidelines you set.
      3. You've already successfully done this if you've used the Talking Pirate NPC.



       

      • B5L1P57R3AM's avatar
        B5L1P57R3AM
        Start Member

        Just to clarify on point 2, are you saying it cant be done that way?
        If its a no, then I get that, ill just have to adjust my approach and perhaps make it more of a direct learning tool i.e. two players enter the world and practice the scene as their own respective Avatars? Going to need to think of a different scene though as Im not playing Dorothy anymore 😆

  • Ok so after a ton of reading, a ton of trial and error and a few arguments with AI. I think i am making actual progress. I have managed to create a working (Preview 2D mode) transcript and this is the steps I took:


    1. Dragged NPC Gizmo into world

    2. Clicked on NPC Gizmo to access properties

    3. Changed conversation tab to AI

    4. Changed Default push toggle talk button to on

    5. Set audio to 3D

    6. Changed character name to Wizard

    7. Opened character builder

    8. On the left hand side personality tab I clicked into Instructions

    9. In the box below I entered the text below exactly:

    When you hear the words "Who are you" say "I am the great and powerful Wizard of Oz".  When you hear the words "We have come a long way to see you"  say "You are? I don't believe you"

    10. Then save it. You can then have a practice text conversation in the right hand panel.

    11. Go into preview mode and approach the NPC. click the letter E and speak clearly "who are you" the NPC should respond verbally with "I am the great and powerful wizard of Oz"

    So that seems to work fine, although the voice recognition is poor. I am from Yorkshire so my elocution isnt fantastic so undoubtedly that doesnt help, but I would have thought it would of been better. The problem I am facing now is although I can have a scripted conversation in the 2d world, i can't seem to do it in VR (3D) ChatGPT says press the right controller trigger when facing the NPC to trigger the conversation but thats not working. I feel really close, can someone help get me across the line and slam dunk this???