Modding Help sendEntityMessage in Dreadwing dieState.LUA

Discussion in 'Starbound Modding' started by projectmayhem, Apr 21, 2017.

  1. projectmayhem

    projectmayhem Aquatic Astronaut

    I'm trying to do a quest where you have to kill an NPC, and I'm trying to use the dreadwing quest as a guide. However, I don't understand this part in the dieState.LUA for dreadwing

    world.sendEntityMessage(playerId, "dreadwingDeath")

    This is vital to the quest, because it let's the instance.LUA know the mob has been killed right? But what is the actual message? I can't find anything anywhere about dreadwingDeath message. Or is there no actual "message" and this is more of a "flag" to let the other LUA know the mob is dead?
     
  2. Sparklink

    Sparklink Orbital Explorer

    I think may be leftovers from a previous version, in earlier versions it would suddenly pop up a message immediately as you beat him saying some thing like... "I beat Dreadwing, I should bring some of the wreckage back as proof". It stopped being use probably because the pop-up would get in the way of your fighting stragglers.
     
  3. bk3k

    bk3k Spaceman Spiff

    Found your string in
    /quests/outpost/penguin1.questtemplate
    Code:
    "triggerMessage" : "dreadwingDeath",
    String searches answer many questions.
     
  4. projectmayhem

    projectmayhem Aquatic Astronaut

    Yeah, I found that too.

    "goalTrigger" : "message",
    "triggerMessage" : "dreadwingDeath"

    The instance.lua looks for a goalTrigger, and triggerMessage. I was trying to find if there is another file somewhere, like in the Radio Messages that has an actual message for Dreadwing's Death.

    This LUA stuff is hurting my head lol. I can't seem to get the quest to register the fact that I am killing the NPC
     
  5. Cyel

    Cyel Star Wrangler

    From instance.lua (the pingu mission's quest script)
    Code:
    [...]
      elseif self.goalTrigger == "message" then
      self.triggerMessage = config.getParameter("triggerMessage") -- here "dreadwingDeath"
    
      message.setHandler(self.triggerMessage, function()
      storage.stage = 3
      end)
    That message is sent via the boss's death script (eg. /monsters/boss/penguinUfo/dieState.lua)

    Stage 1 is from the beginning of the quest, up to when the player's warped to the instance via the defined warpEntity;
    Stage 2 is from when the goalEntity is found up to when it's killed in case of goalTrigger=message (pingu missions), or when the required position is met if goalTrigger=proximity (arena missions)
    Stage 3 is from the goalTrigger to turnIn

    Basically all you have to do is change penguinX.questtemplate to what you need, and make your target send the triggerMessage you've defined?
     
  6. bk3k

    bk3k Spaceman Spiff

    Note that instance.lua has
    Code:
    require "/scripts/util.lua"
    require "/quests/scripts/questutil.lua"
    require "/quests/scripts/portraits.lua"
    
    That's 3 more scripts to check, but I think your answer is in questutil.lua under questutil.questCompleteActions()

    This function seems to handle much of the useful things you can do after a quest by checking the .questtemplate file.
     
    projectmayhem likes this.
  7. projectmayhem

    projectmayhem Aquatic Astronaut

    Thank you both, I'l get to checking into those files today.

    *Edit*

    Hmmm...been browsing all the files and I thought I had everything pretty set, but when I went to test it...
    the mission gets stuck on the Warping part. After I warp to the Youngling Temple, the quest still tells me to warp there.

    I'm reading over the util.lua and I assume it's this part...

    Code:
    function util.uniqueEntityTracker(uniqueId, interval)
      return coroutine.wrap(function()
        while true do
          local promise = world.findUniqueEntity(uniqueId)
          while not promise:finished() do
            coroutine.yield(false)
          end
          coroutine.yield(promise:result())
          util.wait(interval or 0)
        end
      end)
    end
    So I'm wondering, does an "entity" have to be an object or monster? My goalEntity is a hostile NPCTYPE. Is that why it stays on the warpEntity part of the quest? Because it doesn't recognize the NPC as an "entity" and doesn't update? I really thought warping to the Youngling Temple would complete stage 1 and move the quest to stage 2.

    Adding the files as an attachment if anyone wants to look at them. It's really just a copy/paste of the penguin1 quest for Dreadwing. I just can't figure out what part of warping to Dreadwings Lair makes the quest move to step 2. As soon as load into dreadwings lair, the quest updates to the next stage. Is there an object near the zone in that is is tagged with the uniqueId Dreadwing?
     

    Attached Files:

    Last edited: Apr 21, 2017
  8. projectmayhem

    projectmayhem Aquatic Astronaut

    Ok, I found what I needed. My Temple is a JSON file, but dreadwings lair is a Dungeon file. And in its dungeon file it has

    {
    "value" : [200, 55, 15, 255],
    "comment" : "penguinUfo npc",
    "brush" : [ [ "npc",
    {
    "kind" : "monster",
    "typeName" : "penguinUfo",
    "parameters" : { "uniqueId" : "dreadwing" }
    }
    ] ]
    }
    ]

    So that uniqueId is what I'm missing.

    *edit**

    I opened Tiled and added uniqueId to the younglingmaster, but it still doesn't update the quest. Do I need to make a dungeon file instead of json?

    {
    "height":8,
    "id":1127,
    "name":"",
    "properties":
    {
    "npc":"human",
    "typeName":"younglingmaster",
    "uniqueId":"younglingmaster"
    },
    "propertytypes":
    {
    "npc":"string",
    "typeName":"string",
    "uniqueId":"string"
    },
    "rotation":0,
    "type":"",
    "visible":true,
    "width":8,
    "x":1512,
    "y":568
    }
     
    Last edited: Apr 21, 2017
  9. projectmayhem

    projectmayhem Aquatic Astronaut

    I tried working with the penguinmission1 dungeon file, removing all the npc, replacing them with my own, building a small building. However, when I use the warpEntity to warp there, it does the animation, switches to the cutscene where your a beam of light teleporting down, then it puts me back where I was. This is the only error I can find in my log relevant.


    [11:02:46.506] [Error] UniverseServer: error during world create: (JsonException) No such key in Json::get("younglingtemple1")
     
  10. projectmayhem

    projectmayhem Aquatic Astronaut

    I tried starting over. I used penguinmission2, changed as little as I could, basically renamed the files and changed the monsters to NPC's.

    It still wont recognize that I am in the instance. My quest stays stuck at Travel to the Youngling Temple, even once I get teleported there.

    I'm going to attach my mod to this post, if anyone can give it a look over, I'd appreciate it. I can't figure out why it isn't updating the quest.

    I'n order to start the quest quickly...

    /admin
    /spawnitem kybercrystal

    This gives you the quest to go to the jedi temple. Once the whole chain is working, it'll require your SAIL working correctly for teleporting.

    /warp instanceworld:jeditemple to go to the temple
    Turn in the quest and it gives you a lightsaber recipe

    A new quest appears below from the Zabrak Sith

    Once you accept it, the fountain has a blue "?" to teleport you to the younglingtemple.

    After that, it gets stuck and doesn't update. But you are suppose to go inside, kill him, then report back to the Zabrak Sith.
     

    Attached Files:

  11. bk3k

    bk3k Spaceman Spiff

    Look for Tiled in search. There are threads that cover this, and other threads that link them. I recommend this because I'm recalling other people have had better luck with some older builds of Tiled, but I can't tell you off the top of my head which ones... and that's where those threads come in. Plus other probably useful info.
     
  12. projectmayhem

    projectmayhem Aquatic Astronaut

    Thank you, I'll look into some of these post this weekend when I get off work. If I can't figure it out, I'll just have to change the way the quest works or something.
     
  13. magewish4

    magewish4 Big Damn Hero

    instance.lua is used for a bunch of missions and its pretty flexible. All three floran arena quests, the penguin quests, and a few others - they just have different .questtemplates. You might want to try using the floran arena missions as a base for your quest.

    I tried out the mission and messed with the script a bit. There is something WONKY going on. I'm not sure what IS wrong (sorry!) but I'm pretty sure it ISN'T:
    • the uniqueId - it's on the npc correctly
    • the questtempate - it's formatted correctly and the script it reading it fine.
    • the fact that its on an npc - I moved the uniqueId to an object and it still doesn't work
    • using an older dungeon image instead of a Tiled file - the penguin missions use instance.lua and they have the old image/json file dungeons
    I'll keep looking at this - it looks awesome!
     
  14. magewish4

    magewish4 Big Damn Hero

    Attached Files:

  15. projectmayhem

    projectmayhem Aquatic Astronaut


    Thank you, I'll check it out Friday when I'm off work. But you were able to load into the area and have the quest update from Step 1 to Step 2?
     
  16. projectmayhem

    projectmayhem Aquatic Astronaut


    When I enter your placeholder dungeon, the quest still doesn't update from Step 1, using the fountain to teleport to the temple. Guess I'll redo the quest to need an item drop from him. Seems like it would be easier.
     

Share This Page