Lua Ideas?

Results 1 to 5 of 5
  1. #1
    Account Upgraded | Title Enabled! Janebug is offline
    MemberRank
    Sep 2020 Join Date
    floridaLocation
    325Posts

    Lua Ideas?

    Anyone know why this lua would not work in game ?

    Code:
    -- MirrorWorld 224 
    function lua_smallMoveAttack()
            local OwnerID = 106487
    --How far, how often do you move, and how far you move at a time
            SetRandMove( OwnerID(), 15, 15, 15)
    end
    No matter what i add it just does not work , sometimes it crashes client also ?
    Its like SetRandMove is not working, i know its in there i check lua in source ...

    Code:
            LuaRegisterFunc( "OwnerID"            , int()                                    , OwnerID               );
            LuaRegisterFunc( "TargetID"            , int()                                    , TargetID                );
    
            LuaRegisterFunc( "Rand"                , int(int)                                , Random                );
            LuaRegisterFunc( "RandRange"        , int(int,int)                          , RandRange                );
    
            LuaRegisterFunc( "SysPrint"            , void(const char*)                     , SysPrint                );
            LuaRegisterFunc( "MoveTarget"        , int(int,int)                            , MoveTarget            );
            LuaRegisterFunc( "Move"                , int(int,float,float,float)            , Move                    );
            LuaRegisterFunc( "MoveDirect"        , int(int,float,float,float)            , MoveDirect            );
    
            LuaRegisterFunc( "SetRandMove"        , void(int, int, int,int)               , SetRandMove            );
    
    and everything looks ok ?
    
        void SetRandMove( int ID , int Range , int Freq, int Dist )
        {
            BaseItemObject *OtherClass    = BaseItemObject::GetObj( ID );    
            if( OtherClass == NULL  )
                return;
    
            NPC_RandomMoveStruct& RandomMove = OtherClass->Role()->TempData.RandomMove;
    
            RandomMove.Active = __max( 1 , Freq );
            RandomMove.CenterX = OtherClass->Role()->Pos()->X;
            RandomMove.CenterZ = OtherClass->Role()->Pos()->Z;
    
            RandomMove.CountDown = 0;
            RandomMove.MaxRange  = (float)Range;
            RandomMove.Dist      = (float)Dist;
    
            RandomMove.Enable    = true;
    
            return;
        }


    Janebug


  2. #2
    Enthusiast fht is offline
    MemberRank
    Dec 2016 Join Date
    37Posts
    Variable OwnerID is declared but never being used (you call OwnerID() which gets you the ID of the object that runs the plot). I think I can help you there, but you need to give me some more information about what‘s supposed to happen.

  3. #3
    Account Upgraded | Title Enabled! Janebug is offline
    MemberRank
    Sep 2020 Join Date
    floridaLocation
    325Posts
    It should have the NPC walk around a small area 15 x 15. after 15 sec

    Its been standard ingame for awhile however its just does not work no matter how i add it even

    Code:
    function lua_smallMoveAttack()
    --How far, how often do you move, and how far you move at a time
            SetRandMove( OwnerID(), 15, 15, 15)
    end
    should work , how ever it does not?

  4. #4
    Enthusiast fht is offline
    MemberRank
    Dec 2016 Join Date
    37Posts
    I just did a quick test spawning a wolf cub and it works like intended.




    Code:
    function LuaS_Testing0915()
        local RoomID = ReadRoleValue( OwnerID() , EM_RoleValue_RoomID ) 
        local X = ReadRoleValue( OwnerID() , EM_RoleValue_X )
        local Y = ReadRoleValue( OwnerID() , EM_RoleValue_Y )
        local Z = ReadRoleValue( OwnerID() , EM_RoleValue_Z )
        local Dir = ReadRoleValue(OwnerID() , EM_RoleValue_Dir )
        local wolf = CreateObj( 100054 , X , Y , Z , Dir , 1 )
            SetModeEx( wolf , EM_SetModeType_Strikback, true )
            SetModeEx( wolf , EM_SetModeType_SearchenemyIgnore, false )
            SetModeEx( wolf , EM_SetModeType_Obstruct, false )
            SetModeEx( wolf , EM_SetModeType_Mark, true )
            SetModeEx( wolf , EM_SetModeType_Move, true )
            SetModeEx( wolf , EM_SetModeType_HideName, false )
            SetModeEx( wolf , EM_SetModeType_ShowRoleHead, true )
            AddToPartition( wolf , RoomID ) 
            SetRandMove( wolf , 15 , 15 , 15 )
    end

  5. #5
    Account Upgraded | Title Enabled! Janebug is offline
    MemberRank
    Sep 2020 Join Date
    floridaLocation
    325Posts
    Thanks @fht

    How ever this will create a buddy after you spawn in 100054, If i understand this correctly and yes it does work correctly.

    Code:
    function lua_smallMoveAttack()
    --How far, how often do you move, and how far you move at a time
            SetRandMove( OwnerID() , 15, 15, 15 )
    end
    This here is suppose to allow the npc you spawn in and after adding lua_smallMoveAttack to "Inital plot"
    should also do the same thing to just the single 100054, with out it creating another.




    See when i created the Mobs for most of the instances i used them.. But ill have to fix a lot of them to work.

    Janebug


    It works just does not work in Dungeons.



    Last edited by Janebug; 16-09-22 at 12:50 AM.



Advertisement