Modding Help Creating an Invasion type event

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

  1. theogre

    theogre Subatomic Cosmonaut

    Simply put I found no incentive to build a "home world" with cool walls and defenses because there's nothing to defend against. What I want to do I just create an object that, when placed, will spawn a large number of enemies.

    I've spent a lot of time working with the "spawner" object in vanilla assests and tried to mimic the lua into another object so it would behave similarly, but that hasn't worked.

    I've also tried this http://community.playstarbound.com/threads/lua-mod-tutorial-1-simple-spawner.44035/ however I believe it's outdated and doesn't work anymore, and my lua skills are zero to none so I don't know how to fix it.

    If someone could guide me on how to get my idea to work I'd appreciate it. It would be nice to be able to configure the spawner's parameters similar to how you can with the vanilla "spawner" object (stock, level, position, etc). Thanks.
     
  2. Cyel

    Cyel Scruffy Nerf-Herder

    As this is somewhat related, I've edited that spawner to add a limit to how much monsters are spawned at once:
    http://community.playstarbound.com/...-object-maximum-out-at-once-not-stock.132330/

    Some settings could easily be changed to fit an invasion-like event, but since you said that you "tried to mimic the lua into another object", why did you do that instead of using said spawner directly? What would you like to change from the default one? If just the settings, all you'd have to do is:
    - make a mod folder with a path like /mods/yourspawnermod/objects/spawner
    - copy the monsterspawner.object file and rename it to something different, and put it in your mod folder^
    - edit that file and change the objectName and other settings
    - /spawnitem <the objectName you specified>
     
  3. theogre

    theogre Subatomic Cosmonaut

    The thread you linked is interesting, and the file you created would be helpful for an invasion event. Would it be possible to have It spawn a certain mob last, say a boss mob? For example, after the stock of minions has depleted or reached a certain number, a boss mob would spawn.

    Also, could you somehow change the background music when it's placed and end when all the enemies are killed?
     
    Last edited: Apr 25, 2017
  4. Cyel

    Cyel Scruffy Nerf-Herder

    Yeah, that's doable, I'm currently playing with a system of defined (as in, the monster type, the number of them per wave, their level range, and a music to play when they are spawned) "waves" of sets of monsters, and I'll do more stuff with the stock count later (current draft is either have it spawn a specified monster when stock reaches 0, or, if stock is infinite, spawn a specified monster every X spawn)

    Do you think of anything else that could be fancy on this?

    Attached is mostly what you asked; the music will however currently only stop when the item's broken, and I think it'll just stop playing any music at all, instead of resuming back to the biome's musics; that I'm not sure how to fix
     

    Attached Files:

  5. theogre

    theogre Subatomic Cosmonaut

    It looks excellent, the music resuming back to the biomes default isn't something I'm worried about so you don't have to spend time on that if you don't want to. And as for icing on the cake how about changing the weather once placed? And again, I'm not too worried if the weather doesn't resort back to default after stock = 0
     
  6. Cyel

    Cyel Scruffy Nerf-Herder

    Sadly, weather isn't something we can take control of
     
  7. bk3k

    bk3k Oxygen Tank

    This might work best I think as an invisible quest. Not that I'm an expert on the quests quite yet. But you're talking about "after killing so many" I think a quest is the way to track that. And it could search for/send a message to an object such as a spawner. But I think the quests should be capable of spawning things. Objects though might give you better control over placement.

    edit:
    Then again my suggestion is probably a bit LUA intensive and you mentioned not being great with it. Unless you just want to play around with it to get better at it through practice, trial, and error. Your call.
     
  8. theogre

    theogre Subatomic Cosmonaut

    I'm fairly certain that quest-spawned monsters require their respective stagehands to indicate where/how they spawn. If you're thinking about a system similar to that in the glitch mission then I've actually already looked at it in Tiled and there is indeed extensive stagehand use in that instanceworld. So this of course doesn't work with what I'm trying to achieve because it would require the player be in a pre-build world whereas I'm trying to allow the player to bring the fight to the world of their choosing.

    I think i'll upload a demo of my progress so far in the near future. Thanks to Cyel I was able to use the "boss" mob code he provided and created a "miniboss" mob that would spawn in chosen intervals. My custom object sprite is also pretty much done and I think it looks pretty good

    I have encountered one issue however. If I wanted the mobs to spawn outside the player view, most of the time they would just sit there until the player aggro'd them. Anyone have an idea on how to make it so the mobs will automatically seek out the player right after spawning? It might require making specialized mobs and I'm ok with that, but I just need a base to go off of and I could replicate that and do the rest. Perhaps looking at the Erchius Ghost and seeing how one could replicate his persistent behavior?
     
  9. Cyel

    Cyel Scruffy Nerf-Herder

    The Erchius ghost is different compared to other monsters; instead of relying on a behavior defined in it's .monstertype file's behavior config to move around and attack, it's script handles it's movements (and the status effect's script handles the damages, I think), which is a straight line to it's target, bypassing blocks etc. The bossmonster script do also track players, but those seem to use "phases" instead of behaviors?

    Your simplest shot is probably to define a "targetQueryRange" in your monster parameters; For example, the arenas' JSON spawns the vanilla spawners with:
    Code:
    "monsterParams" : { "aggressive" : true, "behaviorConfig" : { "keepTargetInSight" : false, "keepTargetInRange" : 200, "targetQueryRange" : 50 } } 
    The guardianboss has a targetQueryRange of 200, I'm expecting it somewhat fits it's boss room's size. Using an absurdly high value will probably result in performances drop as the monster looks everywhere in said absurdly-high-value area at each tick for a target; but something like 500 is probably reasonable, if you're putting your spawner far away? You'll have to play with it

    The Lua script I modified spawns both the regular monsters and the boss monster with the monsterParams added to them, so that'd probably work pretty seamlessly
     
  10. theogre

    theogre Subatomic Cosmonaut

    Cool, thanks works perfectly. Is there a way to make it so it would only spawn monsters during a certain time of day? Or on specific biomes?
     
    Last edited: Sep 20, 2017

Share This Page