Modding Help How to make projectile fire based on way you're looking?

Discussion in 'Starbound Modding' started by ImHereForTheMods, Mar 1, 2017.

  1. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    Aight, well, I'll mess with it, and see what I can do.
    Thanks again.
     
  2. bk3k

    bk3k Oxygen Tank

    If you feel like pulling your hair out, that means you're near your "moment of triumph". Don't retreat.

    Playing with code is the best thing. Nothing fosters coding ability like repeated failure... besides maybe proper classroom instruction(yeah right).
     
    ImHereForTheMods and MetaFace like this.
  3. MetaFace

    MetaFace Guest

    You still needing help? If you got anything then I wouldn't mind taking a look.
     
    ImHereForTheMods likes this.
  4. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    Yeah, I'd say so, I'm completely useless at this whole lua thing...

    Just replaced that and... :
    Code:
    [11:16:45.432] [Error] Exception while invoking lua function 'update'. (LuaException) Error code 2, [string "/items/active/weapons/weapon.lua"]:110: [string "/items/active/weapons/weapon.lua"]:171: [string "/luas/controlprojectile.lua"]:142: attempt to perform arithmetic on a nil value (global 'fireDirection')
    stack traceback:
        [C]: in ?
        [C]: in function '_ENV.error'
        [string "/items/active/weapons/weapon.lua"]:110: in method 'update'
        [string "/items/active/weapons/staff/staff.lua"]:25: in function <[string "/items/active/weapons/staff/staff.lua"]:24>
    [0] 7ff6e4103763 Star::captureStack
    [1] 7ff6e41024ee Star::StarException::StarException
    [2] 7ff6e40d7091 Star::LuaEngine::handleError
    [3] 7ff6e469b67e Star::LuaEngine::callFunction<float,Star::String,bool,Star::MapMixin<std::unordered_map<Star::String,bool,Star::hash<Star::String,void>,std::equal_to<Star::String>,std::allocator<std::pair<Star::String const ,bool> > > > >
    [4] 7ff6e469cf76 Star::LuaFunction::invoke<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData>,float,Star::String,bool,Star::MapMixin<std::unordered_map<Star::String,bool,Star::hash<Star::String,void>,std::equal_to<Star::String>,std::allocator<std::pair<Star::String const ,bool> > > > >
    [5] 7ff6e469cde5 Star::LuaBaseComponent::invoke<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData>,float,Star::String const & __ptr64,bool & __ptr64,Star::MapMixin<std::unordered_map<Star::String,bool,Star::hash<Star::String,void>,std::equal_to<Star::String>,std::allocator<std::pair<Star::String const ,bool> > > > & __ptr64>
    [6] 7ff6e469df40 Star::LuaUpdatableComponent<Star::LuaStorableComponent<Star::LuaWorldComponent<Star::LuaBaseComponent> > >::update<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData>,float,Star::String const & __ptr64,bool & __ptr64,Star::MapMixin<std::unordered_map<Star::String,bool,Star::hash<Star::String,void>,std::equal_to<Star::String>,std::allocator<std::pair<Star::String const ,bool> > > > & __ptr64>
    [7] 7ff6e469de7b Star::LuaActorMovementComponent<Star::LuaUpdatableComponent<Star::LuaStorableComponent<Star::LuaWorldComponent<Star::LuaBaseComponent> > > >::update<Star::Variant<Star::Empty,bool,__int64,double,Star::String,Star::LuaTable,Star::LuaFunction,Star::LuaThread,Star::LuaUserData>,float,Star::String const & __ptr64,bool & __ptr64,Star::MapMixin<std::unordered_map<Star::String,bool,Star::hash<Star::String,void>,std::equal_to<Star::String>,std::allocator<std::pair<Star::String const ,bool> > > > & __ptr64>
    [8] 7ff6e46aea3d Star::ActiveItem::update
    [9] 7ff6e4550020 Star::ToolUser::tick
    [10] 7ff6e43e5610 Star::Player::update
    [11] 7ff6e45ccff8 <lambda_9fc580ae40b93070d912cafafa15880e>::operator()
    [12] 7ff6e423a197 Star::EntityMap::updateAllEntities
    [13] 7ff6e45e3418 Star::WorldClient::update
    [14] 7ff6e455e427 Star::UniverseClient::update
    [15] 7ff6e404dad7 Star::ClientApplication::updateRunning
    [16] 7ff6e404c3bf Star::ClientApplication::update
    [17] 7ff6e47bd401 Star::SdlPlatform::run
    [18] 7ff6e47bd5bd Star::runMainApplication
    [19] 7ff6e404f4d6 WinMain
    [20] 7ff6e49a4573 __scrt_common_main_seh
    [21] 7fffa5bb8364 BaseThreadInitThunk
    [22] 7fffa64370d1 RtlUserThreadStart
    
    Pretty much sums up my experience with lua... haha.
    Attached the latest version I got below, maybe you can figure something out, I may try a few things too.
     

    Attached Files:

  5. MetaFace

    MetaFace Guest

    Yeah I'll take a look.
     
  6. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    Thanks, I'll of course give credit, if you can give it working, when I do the update. =)
     
  7. MetaFace

    MetaFace Guest

    Almost there, took a whack at it today and ran into a small snag where I can't fix the y velocity. I'll try to fix it tomorrow.
     
  8. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    Awesome! Glad to hear you could at least figure part of it out, that's beter than I could've done... Especially in this time. Haha.

    Hope you can figure that other problem out as well!
     
  9. MetaFace

    MetaFace Guest

    Spent like twenty minutes trying to post my code, but my phone isn't letting me.
     
  10. MetaFace

    MetaFace Guest

    Let's try that again. This time better...
    Name this whatever you want, place it into your luas folder and reference it in the staff's primary ability as "/luas/*name*.lua" and do the same in the weaponability file (the plasma spawner ability for example). Good luck.
     

    Attached Files:

    ImHereForTheMods likes this.
  11. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    Alright, I will try that! Thank you soooo much! I will give that a shot, once I get a moment! I'll let you know how it works out!
    Thanks again!
     
    MetaFace likes this.
  12. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    It worked! THANK YOU SO MUCH!!
    Now I can finally fix the remaining 3 staves and release an update! =D
    Thanks so, so much!
    It looked like a lot of script!
     
    MetaFace likes this.
  13. MetaFace

    MetaFace Guest

    Not that much actually, when working off a few bases you only gotta piece them together, there was a few spots that required some thinking and a little custom code, but that wasn't too bad once I realized I was being dumb.
     
  14. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    Aight, well, I'll take your word for it, I know nothing of the stuff.... Haha.

    Thanks so much!
     
    MetaFace likes this.
  15. MetaFace

    MetaFace Guest

    you're welcome.
     
    ImHereForTheMods likes this.
  16. ImHereForTheMods

    ImHereForTheMods Cosmic Narwhal

    MetaFace likes this.

Share This Page