1. Please be advised of a few specific rules and guidelines for this section.

RELEASED Altered Turrets: currently outdated 1.1

I have altered the turrets... pray I do not alter them further.

  1. bk3k

    bk3k Oxygen Tank

    bk3k submitted a new mod:

    Altered Turrets - I have altered the turrets... pray I do not alter them further.

    Read more about this mod...
     
  2. LoPhatKao

    LoPhatKao Space Kumquat

    an idea/challenge for further modification
    search the lua for isValidTarget
    fix targeting so it doesnt attack npc's (and possibly non-hostile mobs) - this was always my main irritation with vanilla turrets
    why have defences if they just kill your tenants/villagers ? ;)
     
  3. bk3k

    bk3k Oxygen Tank

    I do remember that in the past they did kill everything that wasn't you. But turrets currently don't kill tenants. I'll should go place them in a village though and see what they do. I should look into this in any case.

    I don't want them shooting any NPCs, but I do want them shooting up non-hostile mobs because that means more loot. I suppose some people might not prefer this for other reasons, and might want an option there.
     
  4. LoPhatKao

    LoPhatKao Space Kumquat

    from vanilla standingturret.lua
    Code:
    
    function potentialTargets()  
      --Gets all valid npc targets + all monsters
      local npcIds = world.entityQuery(getBasePosition(), self.targetRange, { includedTypes = {"npc"} })
      local monsterIds = world.entityQuery(getBasePosition(), self.targetRange, { includedTypes = {"monster"} })
    
      for i,npcId in ipairs(npcIds) do
        if entity.isValidTarget(npcId) then
          monsterIds[#monsterIds+1] = npcId
        end
      end
      return monsterIds
    end
    
    id say easiest way to fix would just be to set npcIds to nil and comment out the entityQuery
    no more npc shooting ;) (obviously ive investigated problem before, just never did anything with info heh)
     
  5. bk3k

    bk3k Oxygen Tank

    I have accomplished getting it to stop shooting NPCs. The part you quoted is indeed the important part. I didn't bother turning anything to nil, but rather I just commented out the part where it add all the entities from npcId into monsterIds. It still returns the monsterIds.

    It is a simple fix that does the job for now. Later I will probably change this to still attack NPCs once they go hostile (once I find out how to determine this). Before that point I might make it not shoot NPCs if unwired, and shoot them if wired(and receiving input). That way people have a choice if they want the guns to exterminate the NPCs.

    I'm basically just figuring out what is happening by looking at the code, but I probably should read the actual LUA documentation. I have more fun figuring this stuff out myself without instructions, but could accomplish more by biting the bullet.
     
  6. bk3k

    bk3k Oxygen Tank

    bk3k updated Altered Turrets with a new update entry:

    Altered Turrets 1.1

    Read the rest of this update entry...
     
  7. TempTemp

    TempTemp Star Wrangler

    If you are looking for an uptodate mod with power generators check out Frackin' Universe. Power was just added in the test version of the mod.
     
    bk3k likes this.
  8. bk3k

    bk3k Oxygen Tank

    Thanks for letting me know. I don't use that one, so I didn't know.

    I'll duplicate a clean starbound folder and check it out. I don't want to go so far as to make something major like that a requirement of this mod, but I could make an optional patch to integrate for those that do.

    As a separate matter, I have been playing around and found that I can add additional slots to the turrets, but the turret only checks for guns in the first slot and ignores all else. I looked into it and found it only checks the first slot(the only one it expects to exist), meaning if I add slots I can purpose them to my needs. For example I could have it check the 2nd slot for batteries. And that is only one example of what might be possible. I believe could make custom craftable(and perhaps expensive) items that when plugged in increase the damage/rate of fire/etc multiplier - probably at the expense of increased energy needs. In fact I could probably have these items themselves affect turret behavior if so inclined.

    I'm also wondering if it is possible to add functional spotlights etc.
     
  9. TempTemp

    TempTemp Star Wrangler

    You might want to chat with sayter (the guy who runs FU) about some of that stuff. FU's power system comes from an older mod so you can likely use most of it yourself if it suits your needs. FU also has the Bees! mod mixed in which uses an effect somewhat like what you want to do with the turrets. You add drones, a queen, and frames into slots in the hives to get them to work. Depending on which race of bees, and if it is mixed race there will be differnet outputs. The frames boost things like honey output, or kill mites. Some of that code might be helpful to look over for your project.
     
  10. bk3k

    bk3k Oxygen Tank

    Now that the forums are back, I am aware that this mod is currently broken. It doesn't stop Starbound from loading, but the turrets are dead because of changes made to both the object and the underlying LUA code. I recommend to remove it for now. It doesn't do anything that useful yet anyhow. Your current turrets should return to life.

    Also I have become aware of another active turret mod that I wasn't aware of before. That said I'll issue a working version soon of this mod. It won't be modifying vanilla assets anymore, but rather adding in a new turret so there will be no interference.
     
  11. TempTemp

    TempTemp Star Wrangler

    You know I had an idea for a new type of turret that could be added. What about one that would traget anything even friendly players and NPCs? The idea is that it would be someone to ensure that NOTHIING AND NOBODY will enter an area. So say you have a base set up and you want to keep your NPCs out of (or trap in for the eviler landlords) without walling it off. You could setup one of this turrets to keep them out with an off swtich to allow you to safely pass.
     
  12. bk3k

    bk3k Oxygen Tank

    I'm not sure it would be popular as it would shoot you too, but yes I can do this easily.
     
  13. TempTemp

    TempTemp Star Wrangler

    Well it would not be for everyone of course. I was just thinking of a new type of turret that isn't already ingame.
     

Share This Page