Jump to content
Sign in to follow this  
#Weedswag

Infinite Interaction Distance While Moving

Recommended Posts

#Weedswag

Hello

Ok, here is a new script. It is the combination of gir489's script "Infinite Interact Distance" and PPv15's "nomoveblock" script. This means you can now move while interacting with an object, door, etc as far as you want! I hope this helps anyone.

ChangeLog:

v0.2 --> v0.3

  • Fixed Toggle Interaction Bug
  • Added Toggle Interaction Version and Needed Toggle Interaction Script
  • Optimized Overall Script/Added Lookaround While Interacting to Toggle Interaction
  • Added inChat Check (Need My Globals Script)

v0.1 --> v0.2

  • Added Toggle to Infinite Interaction Distance While Moving
  • Added Toggle to Lookaround While Interacting
  • Added inGame and isPlaying Checks (See Globals Thread for any Errors)
  • Optimized Lookaround While Interacting
  • Added Combined Scripts (Toggle)

v0.1

  • Initial Release

Toggle Interaction Version (v0.3):

Toggle Interaction Script Needed For v0.3 Script

--Toggle Interaction by LazyOzzy with Look Around While Interaction by B1313

if not _PlayerStandard__check_action_interact then _PlayerStandard__check_action_interact = PlayerStandard._check_action_interact end

function PlayerStandard:_check_action_interact(t, input)

    self._ext_camera:camera_unit():base():set_limits( 360, 360 )

    if input.btn_interact_press and self._interaction_active then

            self:_interupt_action_interact()

            return nil

    elseif input.btn_interact_release then

        return nil

    end

    

    local result = _PlayerStandard__check_action_interact(self, t, input)

    if result then

        self._interaction_active = true

    end

    return result

end



if not _PlayerStandard__interupt_action_interact then _PlayerStandard__interupt_action_interact = PlayerStandard._interupt_action_interact end

function PlayerStandard:_interupt_action_interact(t, input, complete)

    _PlayerStandard__interupt_action_interact(self, t, input, complete)

    self._interaction_active = false

end
Infinite Interaction Distance While Moving [Look Around While Interacting NOT Included] [REQUIRES Toggle Interaction For Look Around While Interacting]
-- INFINITE INTERACTION DISTANCE & MOVEMENT WITH LOOKAROUND WHILE INTERACTING v0.2 by B1313 (Original Script gir489)

if inGame and isPlaying()  and not inChat() then

_toggleMove = not _toggleMove

if _toggleMove then

    

    -- MOVE WHILE INTERACTING

    function PlayerStandard:_interacting() 

        return

    end



    -- INFINITE INTERACTION DISTANCE

    _ObjectInteractUpdate = _ObjectInteractUpdate or ObjectInteractionManager.update

    function ObjectInteractionManager:update( t, dt ) 

        if self._active_object_locked_data then

            if alive( self._active_object ) and self._active_object:interaction():active() then

                return

            end

        end

        _ObjectInteractUpdate(self, t, dt)

    end



    managers.chat:_receive_message(1, "Stealth Suite System", "Interaction Look & Move Modifications ON", tweak_data.system_chat_color)

else

    -- MOVE WHILE INTERACTING

    function PlayerStandard:_interacting()

        return self._interact_expire_t

    end

    

    managers.chat:_receive_message(1, "Stealth Suite System", "Interaction Look & Move Modifications OFF", tweak_data.system_chat_color)

end    

end
Run Toggle Interaction as PostRequire Script in PD2Hook.yml
 - [lib/units/beings/player/states/PlayerStandard, .lua]



Infinite Interaction Distance While Moving With Lookaround While Interacting (1 Toggle for Both):


-- INFINITE INTERACTION DISTANCE & MOVEMENT WITH LOOKAROUND WHILE INTERACTING by B1313 (Original Script gir489)

if inGame and isPlaying() then

_toggleMove = not _toggleMove

if _toggleMove then

    function PlayerStandard:_interacting() 

        return nil 

    end



    _ObjectInteractUpdate = _ObjectInteractUpdate or ObjectInteractionManager.update

    function ObjectInteractionManager:update( t, dt ) 

        if self._active_object_locked_data then

            if alive( self._active_object ) and self._active_object:interaction():active() then

                return

            end

        end

        _ObjectInteractUpdate(self, t, dt)

    end

    function PlayerStandard:_check_action_interact( t, input )

      local new_action,timer,interact_object

      local interaction_wanted = input.btn_interact_press

      self._unit:base():set_slot( self._unit, 4 )

      if interaction_wanted then

         local action_forbidden = self:chk_action_forbidden( "interact" ) 

         or self._unit:base():stats_screen_visible() 

         or self:_interacting() 

         or self._ext_movement:has_carry_restriction()

         or self:is_deploying()

         or self:_changing_weapon()

         or self:_is_throwing_grenade()

         or self:_is_meleeing()

         if not action_forbidden then   

            new_action,timer,interact_object = managers.interaction:interact( self._unit )

            if new_action then

               self:_play_interact_redirect( t, input )

            end

            if timer then

               new_action = true

               self:_start_action_interact( t, input, timer, interact_object )

            end

            new_action = new_action or self:_start_action_intimidate( t )

         end

      end

      if input.btn_interact_release then

         self:_interupt_action_interact()

      end

      return new_action

    end

    managers.chat:_receive_message(1, "Stealth Suite System", "Interaction Look & Move Modifications ON", tweak_data.system_chat_color)

else

    function PlayerStandard:_interacting()

        return self._interact_expire_t

    end

    

    function PlayerStandard:_check_action_interact( t, input )

    

    local new_action,timer,interact_object

    local interaction_wanted = input.btn_interact_press

    if interaction_wanted then

        local action_forbidden = self:chk_action_forbidden( "interact" ) or self._unit:base():stats_screen_visible() 

        or self:_interacting() 

        or self._ext_movement:has_carry_restriction()

        or self:is_deploying()

        or self:_changing_weapon()

        or self:_is_throwing_grenade()

        or self:_is_meleeing()

         if not action_forbidden then    

            new_action,timer,interact_object = managers.interaction:interact( self._unit )

            if new_action then

                self:_play_interact_redirect( t, input )

            end

                        

            if timer then -- When recieving a timer we will start an action 

                new_action = true

                self._ext_camera:camera_unit():base():set_limits( 80, 50 )

                self:_start_action_interact( t, input, timer, interact_object )

            end

            new_action = new_action or self:_start_action_intimidate( t )

        end

    end

    

    if input.btn_interact_release then

        self:_interupt_action_interact()

    end

    

    return new_action

    end

    managers.chat:_receive_message(1, "Stealth Suite System", "Interaction Look & Move Modifications OFF", tweak_data.system_chat_color)

end    

else

end

 

Infinite Interaction Distance While Moving (Toggle):


-- INFINITE INTERACTION DISTANCE & MOVEMENT v0.2 by B1313 (Original Script gir489)

if inGame and isPlaying() then

_toggleMove = not _toggleMove

if _toggleMove then

    function PlayerStandard:_interacting() 

        return nil 

    end



    _ObjectInteractUpdate = _ObjectInteractUpdate or ObjectInteractionManager.update

    function ObjectInteractionManager:update( t, dt ) 

        if self._active_object_locked_data then

            if alive( self._active_object ) and self._active_object:interaction():active() then

                return

            end

        end

        _ObjectInteractUpdate(self, t, dt)

    end

    managers.chat:_receive_message(1, "Stealth Suite System", "Infinite Interaction Distance While Moving ON", tweak_data.system_chat_color)

else

    function PlayerStandard:_interacting()

        return self._interact_expire_t

    end

    managers.chat:_receive_message(1, "Stealth Suite System", "Infinite Interaction Distance While Moving OFF", tweak_data.system_chat_color)

end    

else

end

Infinite Interaction Distance While Moving (No Toggle):


-- INFINITE INTERACTION DISTANCE & MOVEMENT v0.1 by B1313 (Original Script gir489)

function PlayerStandard:_interacting() 

    return nil 

end



_ObjectInteractUpdate = _ObjectInteractUpdate or ObjectInteractionManager.update

function ObjectInteractionManager:update( t, dt ) 

    if self._active_object_locked_data then

        if alive( self._active_object ) and self._active_object:interaction():active() then

            return

        end

    end

    _ObjectInteractUpdate(self, t, dt)

end 



Look Around While Interacting (Toggle):


-- Lookaround While Interacting v0.1 by B1313

-- Player Check

if not PlayerStandard then return end

-- INTERACT LOOKAROUND

   if not _intlookcat then _intlookcat = PlayerStandard._check_action_interact

   end

if inGame and isPlaying() then    

_toggleInteractLook = not _toggleInteractLook

if _toggleInteractLook then

   function PlayerStandard:_check_action_interact( t, input )

      local new_action,timer,interact_object

      local interaction_wanted = input.btn_interact_press

      self._unit:base():set_slot( self._unit, 4 )

      if interaction_wanted then

         local action_forbidden = self:chk_action_forbidden( "interact" ) 

         or self._unit:base():stats_screen_visible() 

         or self:_interacting() 

         or self._ext_movement:has_carry_restriction()

         or self:is_deploying()

         or self:_changing_weapon()

         or self:_is_throwing_grenade()

         or self:_is_meleeing()

         if not action_forbidden then   

            new_action,timer,interact_object = managers.interaction:interact( self._unit )

            if new_action then

               self:_play_interact_redirect( t, input )

            end

            if timer then

               new_action = true

               self:_start_action_interact( t, input, timer, interact_object )

            end

            new_action = new_action or self:_start_action_intimidate( t )

         end

      end

      if input.btn_interact_release then

         self:_interupt_action_interact()

      end

      return new_action

   end

managers.chat:_receive_message(1, "Stealth Suite System", "Look Around While Interacting ON", tweak_data.system_chat_color)

else

    function PlayerStandard:_check_action_interact( t, input )

    

    local new_action,timer,interact_object

    local interaction_wanted = input.btn_interact_press

    if interaction_wanted then

        local action_forbidden = self:chk_action_forbidden( "interact" ) or self._unit:base():stats_screen_visible() 

        or self:_interacting() 

        or self._ext_movement:has_carry_restriction()

        or self:is_deploying()

        or self:_changing_weapon()

        or self:_is_throwing_grenade()

        or self:_is_meleeing()

         if not action_forbidden then    

            new_action,timer,interact_object = managers.interaction:interact( self._unit )

            if new_action then

                self:_play_interact_redirect( t, input )

            end

                        

            if timer then -- When recieving a timer we will start an action 

                new_action = true

                self._ext_camera:camera_unit():base():set_limits( 80, 50 )

                self:_start_action_interact( t, input, timer, interact_object )

            end

            new_action = new_action or self:_start_action_intimidate( t )

        end

    end

    

    if input.btn_interact_release then

        self:_interupt_action_interact()

    end

    

    return new_action

end

managers.chat:_receive_message(1, "Stealth Suite System", "Look Around While Interacting OFF", tweak_data.system_chat_color)

end

else

end




Look Around While Interacting (No Toggle):


-- Lookaround While Interacting v0.1 by B1313

-- Player Check

if not PlayerStandard then return end

-- INTERACT LOOKAROUND

   if not _intlookcat then _intlookcat = PlayerStandard._check_action_interact

   end 

if inGame and isPlaying() then   

   function PlayerStandard:_check_action_interact( t, input )

      local new_action,timer,interact_object

      local interaction_wanted = input.btn_interact_press

      self._unit:base():set_slot( self._unit, 4 )

      if interaction_wanted then

         local action_forbidden = self:chk_action_forbidden( "interact" ) 

         or self._unit:base():stats_screen_visible() 

         or self:_interacting() 

         or self._ext_movement:has_carry_restriction()

         or self:is_deploying()

         or self:_changing_weapon()

         or self:_is_throwing_grenade()

         or self:_is_meleeing()

         if not action_forbidden then   

            new_action,timer,interact_object = managers.interaction:interact( self._unit )

            if new_action then

               self:_play_interact_redirect( t, input )

            end

            if timer then

               new_action = true

               self:_start_action_interact( t, input, timer, interact_object )

            end

            new_action = new_action or self:_start_action_intimidate( t )

         end

      end

      if input.btn_interact_release then

         self:_interupt_action_interact()

      end

      return new_action

   end

else

end

If you want to use Look Around While Interacting with @LazyOzzy's Toggle Interaction Key Script you MUST use v0.3!

Credits:

@LazyOzzy (Toggle Interaction, Helping me Fix Toggle Interaction Bug)

@gir489 (Infinite Interact Distance Script)

@JoeSss (Notifying Me About Toggle Interaction Key Script Relation Bug)

@B1313

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Stop being a peeping tom and join the community.... we got cookies

Join the crew now

Sign in

Already part of the crew? Board right here

Sign In Now
Sign in to follow this  

×