Modding Help Weapons consuming ammo?

Discussion in 'Starbound Modding' started by Ertas10, Nov 1, 2016.

  1. Ertas10

    Ertas10 Void-Bound Voyager

    I would like to know if it's possible to make weapon consume some sort of ammo instead of energy, and if so how could I achieve it (besides making the weapon stack and consuming the weapon instead of ammo itself). Also, I'd like to know if it's possible to change the effects of the gun based on the ammo it fires, assuming it's possible to do the first part.
     
  2. IHart

    IHart Scruffy Nerf-Herder

    this is a great idea. it would probably require you to make another stat, like health
     
  3. bk3k

    bk3k Oxygen Tank

    I'm not sure off hand if weapons have access to the required functions. What you're looking for is in the player table. Probably
    player.hasCountOfItem()
    player.consumeItem()
    Would be all you need... but I don't think you have access from the weapons.

    That'd be the most logical way if not for the missing player table. There may be some crazy way involving the messenging system to talk to something with this access... but nah.

    IHart is right. Add a status upon equip and use clips(items)etc that add ammo of a certain type... essentially another status checked by the first.

    Now I have been thinking of ways to subvert access problems like this though. A mod for other mods that hooks various aspects to provide access to these functions. I get tired of having ideas I then realize can't work... or at least can't work how I want. Well before even considering that I should map what different aspects have access to what functions. And that isn't difficult but I always put it off anyhow.
     
  4. Ertas10

    Ertas10 Void-Bound Voyager

    How should I do that? As a complete noob to modding in general, the only thing I can actually do is copy and paste code and try to figure it out, I don't believe I'm able to do that, but if you tell me the basics I can work around that.
    Thanks btw, both to you, bk3k, and IHart, for stopping by and helping this poor soul.
     
  5. bk3k

    bk3k Oxygen Tank

    Well doing that is beyond what you can do with copy/paste. You're gonna need to expand your skill set and that probably means starting smaller and coming back to making a ammunition system later.

    You'll want to know about JSON standards(not too much to them) and learn to code in LUA. Plenty of tutorials are floating around here, and countless more on the internet. Now for me tutorials aren't what I needed. I needed to play around with real code, make mistakes, etc while occasionally looking at documentation as a reference. I can do it now, but my first mod was simply adding some glow to platforms which is amazingly simple. My first attempt at lua was just minor tinkering with existing code. I worked my way up.

    I'm afraid there's no shortcut around that. Start small, work your way up. Probably taking an actual LUA course(which I did not) might get you there a bit faster but you won't really improve until making real code.

    Now there check the mod section for I think it was "mad dr's experiments" or something like that - it might help you out. They do some basic stuff to show you what's possible and how to do it. I think one is about status too.
     
  6. IHart

    IHart Scruffy Nerf-Herder

Share This Page