Modding Help Ways to remove items/pixels other than recipes?

Discussion in 'Starbound Modding' started by Denesta, Jan 1, 2014.

  1. Denesta

    Denesta Subatomic Cosmonaut

    Okay, so my eventual goal is to make a space casino mod. For that I need games and the easiest to start with seemed to be a slot machine type game.

    I started with pretty much no knowledge on this stuff but I have got to the point of figuring out how to make an object do a random 100 roll and spit out items depending on the number rolled using a LUA script. Right now you walk up to it, press E, and it spits out a random prize.

    I need to make it take something from the player when you use it though. Like 10 pixels per try or a game token you buy/craft. That is where I am stuck. Not much of a gambling game if you don't have to risk anything.
     
  2. Denesta

    Denesta Subatomic Cosmonaut

    Hmm, maybe this is something we will have later or are the scripting functions pretty much set already?
     
  3. Nightmares

    Nightmares Scruffy Nerf-Herder

    I made something similar. The work around I used was a cost for crafting it and making it a one time use. That way you can stack them up to 100 or something and make them cost 10 pixels to craft
     
  4. Denesta

    Denesta Subatomic Cosmonaut

    Yeah, that was my second idea but I was hoping I could make it where it removes pixels on interaction to make it take less steps. Maybe they will add scripting functionality for that later down the line.
     
  5. bluecollarart

    bluecollarart Big Damn Hero

    Can you access the quest system with lua? Quests can take items. The in-game quests actually take & replace the items they require for completion (matter manipulator, cooked meat, etc). You could try playing around with that.
     
  6. Nightmares

    Nightmares Scruffy Nerf-Herder

    Good idea, but we don't have that level of control over quests yet. There's probably a way to do it that hasn't been shown to us yet, though.
     
  7. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    I think the biggest problem you'll run into is (AFAIK) no way to generate random outputs.

    If I'm wrong about that, I'd love to know.
     
  8. Nightmares

    Nightmares Scruffy Nerf-Herder

    You can have random outputs from objects, not recipes
     
  9. Nightmares

    Nightmares Scruffy Nerf-Herder

    check out Smiley's gambling chest mod
     
  10. AndrewSeven

    AndrewSeven Void-Bound Voyager

    Could you base it on a forge and change what the button does?
     
  11. Nightmares

    Nightmares Scruffy Nerf-Herder

    The reason that's not feasible is there's no way to remove the pixels from the inventory
     
  12. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    Interesting, I will give that a look (since I was looking for some source of random output).

    Edit: Eurgh, yeah, okay, that isn't anywhere near feasible for what I was trying to do. Damn.
     
  13. HeroIcarus

    HeroIcarus Void-Bound Voyager

    Perhaps you could make it like a crafting station-
    You buy tickets with pixels from a merchant.
    You spend tickets in front of the slot machine to get a 'wrapped prize', thus allowing you to use more at once for better/more prizes.
    Using the wrapped prize unwraps it into a random item from a list of potential prizes (including more tickets).
    Voila, you have an addicting gambling mechanism to waste your pixels on.
     
  14. Denesta

    Denesta Subatomic Cosmonaut

    Yeah, looks like that is what I am going to have to do until they add more scripting functions. If they do anyway.

    I guess now I just have to figure out the best way to get the loot out of the prize box in the least steps possible. I was thinking making it a throwable item that has an instant damageless projectile to drop it at your feet but I can't see a way to add scripts to those for the random loot gen.

    The only other thing I can think of is a placable object that instantly smashes its self and and spews out your prize as soon as you place it on the ground. Seems a bit of an annoying way to have to do it though.
     
  15. Nightmares

    Nightmares Scruffy Nerf-Herder

    That's really the way to do it. Look at the ironbeacon. Instead of spawning the boss, spawn a random object. Here's what I did for random npc, monster, item.

    I never tested it though so it probably won't work first try
     

    Attached Files:

  16. HeroIcarus

    HeroIcarus Void-Bound Voyager

    Yeah. That seems like the best option. I didn't know you couldn't just have it be 'eaten' and replaced with an item.
    Starbound's modding capabilities are shockingly limited at times...

    Anyway, I'm excited for this mod! It looks like the perfect thing to satiate my latent gambling addiction!
     
    Nightmares likes this.
  17. The | Suit

    The | Suit Agent S. Forum Moderator

    Well this is just a thought.
    But there is an option to check what the player is holding actively.

    So if you used pixels to say craft a Casino Token.
    When Player is holding Casino Token and uses said machine.
    Make it spit out item.

    But so far I haven't seen anything which "removes" the item from the players hand. Just detects what it is.
    But if such a piece of code does exist, and you find it. You have your solution.
     
  18. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    What is that command, out of curiosity? I wanted to build something very similar to the Extractionator from Terraria, and that functionality would be invaluable.
     
  19. The | Suit

    The | Suit Agent S. Forum Moderator

    Code:
      --- Gets an item descriptor for the item held in the entity's hand
      -- Only valid for entities that can hold items (npcs, players)
      --
      -- @param entityId entity to get hand item of
      -- @param hand Name of the hand to check, accepts: "primary" or "alt"
    
    
    entityHandItem = function(entityId, hand) end,

    Right now - as far as I know. There is no way to remove it. Just find out what it is.
     
    Kyrosiris likes this.
  20. Kyrosiris

    Kyrosiris Scruffy Nerf-Herder

    That's still better than I'd hoped. I can use that to check for the valid items I'd like to use (namely, fine sand and gravel). It at least gives me a launching pad. Thanks a ton.
     

Share This Page