Results 1 to 5 of 5

Thread: OnStart() not being overriden anymore?

  1. #1

    OnStart() not being overriden anymore?

    I havent made any code changes.

    and since one update or another my OnStart when entering laning mode does not get called.



    I can tell because I have some variables I am initialising in there.

    Everything that tries to access them fails because they are nil

    (Also Ive put a print in OnStart and nothing appears in console)

    This is at the very start of the game, therefore it's the first chosen mode, possibly it is now only calling OnStart when it switches to a from a different mode to this new mode?
    https://github.com/ThePianoDentist/t...dentistdotabot Lina bot which pulls small camp when 'laning' (Aim to work on pulling and stacking bots initially)
    https://github.com/ThePianoDentist/dotabots-ml-tools Parsing data from bot games

  2. #2
    Code:
    ----------------------------------------------------------------------------------------------------
    
    _G._savedEnv = getfenv()
    module( "mode_generic_laning", package.seeall )
    
    ----------------------------------------------------------------------------------------------------
    require( GetScriptDirectory().."/hero_funcs/pulling" )
    require( GetScriptDirectory().."/hero_funcs/stacking" )
    require( GetScriptDirectory().."/hero_funcs/zoning" )
    
    require( GetScriptDirectory().."/utility_funcs" )
    require( GetScriptDirectory().."/locations2" )
    function OnStart()
        print("DOING START")
        _G.test = "test"
        print(_G.test)
        --TODO replace current_mode with current_laning_mode
        _G.state = {action_queue={current_action}, current_action=nil, current_target=nil, temp_memory={}, current_mode="zone_offlaner" }
        _G.state.neutrals = NEUTRAL_CAMPS -- this really should be outside onstart. should be gloabl...er
    end
    
    function OnEnd()
        if _G.state ~= nil then
            _G.state.current_mode = "none"
            _G.state.current_target = nil
            _G.state.temp_memory.creeps_aggroed = nil
            _G.state.temp_memory.have_pulled = false
        end
    
    
    	--print( "mode_generic_defend_ally.OnEnd" );
    end
    
    
    function Think()
    
        if _G.state.current_mode == "none" then
            _G.state.current_mode = "zone_offlaner" -- kind of default mode
        end
        ---- somestuff
    end
    code example for mode_laning_lina.lua in-case anyone can spot if ive done something wrong
    https://github.com/ThePianoDentist/t...dentistdotabot Lina bot which pulls small camp when 'laning' (Aim to work on pulling and stacking bots initially)
    https://github.com/ThePianoDentist/dotabots-ml-tools Parsing data from bot games

  3. #3
    Basic Member
    Join Date
    Jun 2013
    Posts
    274
    Pretty much. Bots are initially in Laning mode so technically it can't "start" because it's already in it. That's always been the case for me, I've never had a point where the Laning mode OnStart would call immediately after the versus screen.

    What I've always done is have another mode get set to absolute and then continue on normally after a certain time threshold.

    Example: I put

    Code:
    if DotaTime() < -89
    then 
        return 1.0;
    end
    at the top of another GetDesire() and

    Code:
    if DotaTime() < -89
    then 
        return 0.0;
    end
    at the top of the Laning GetDesire().

    Then let everything continue normally underneath.

  4. #4
    ^Ok thanks.

    Ill try something along those lines

    But yeah strangely that's how it was always working for me in the past.


    edit: @below. thanks!
    Last edited by TheP1anoDentist; 02-13-2017 at 03:41 PM.
    https://github.com/ThePianoDentist/t...dentistdotabot Lina bot which pulls small camp when 'laning' (Aim to work on pulling and stacking bots initially)
    https://github.com/ThePianoDentist/dotabots-ml-tools Parsing data from bot games

  5. #5
    Valve Developer
    Join Date
    Sep 2011
    Posts
    1,704
    I'll fix it so that OnStart() gets called, even if it's their initial mode.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •