Modding Help Advanced modding ( scripting, implementing new game mechanics, etc. )

Discussion in 'Starbound Modding' started by Hooligan, Jan 14, 2014.

  1. Hooligan

    Hooligan Space Spelunker

    I am currently designing a mod to implement fishing into the game but to do this i would have to create some new scripts for new tools and the "fish.monster" file would have to implement a new ".lua" file . Though i am experienced in logical programming my experience with object-oriented language is next to nothing and after reading through some of the files for scripting i found myself stumped. Any help provided would be appreciated and would likely help others.
     
  2. Denesta

    Denesta Subatomic Cosmonaut

    The scripting in this is pretty limited right now. We can't do much out side of the preset functions they have set up.
     
  3. Hooligan

    Hooligan Space Spelunker

    there should be a way to create new functions
     
  4. mangobyte

    mangobyte Space Hobo

    Hooligan,
    It seems to me that basically all of the behavior for fish-type monsters are contained in:
    "/monsters/swimming/swimmingMonster.lua",
    "/scripts/util.lua",
    "/scripts/vec2.lua",
    "/scripts/stateMachine.lua",
    "/monsters/flocking.lua",
    "/monsters/swimming/scatterState.lua",
    "/monsters/swimming/fleeState.lua",
    "/monsters/swimming/investigateState.lua"​
    You could add some behavior via new functions inside these files, or implement a new .lua file and include it in the baseParameters within fish.monstertype

    Additionally, it looks like the stateMachine script (in "/scripts/stateMachine.lua") actually parses script files by their name and saves the list of available stateNames (starting on line 291 in stateMachine.lua), so you might putter around in that file for a bit to see what's what.

    I expect this will involve a lot of trial and error; I use the following line to sort of eval different states/behaviors:
    world.spawnProjectile("flare", entity.toAbsolutePosition({ 0.0, 1.0 }))​
    It just generates a flare at the current entity's position. Alternately, you can spawn "zbomb" for a little more fun :p

    As far as the fishing pole itself goes, I expect most of your scripting is going to be centered on the projectile... possibly through some sort of custom damagetype or status effect. It sounds ambitious in any event, and I hope some of the info above is helpful : \

    Best of luck!
     

Share This Page