Jump to content

Recommended Posts

Hello! I'm looking for the animation that plays when you get mind controlled by the ancient fuelweaver.
Specifically the animation where the player grabs their head, not just the overlay.
I'd like to use it with this code: inst.AnimState:PlayAnimation for something I'm working on.
If someone could help me out, that would be greatly appreciated!

12 hours ago, zvxaxvz said:

Hello! I'm looking for the animation that plays when you get mind controlled by the ancient fuelweaver.
Specifically the animation where the player grabs their head, not just the overlay.
I'd like to use it with this code: inst.AnimState:PlayAnimation for something I'm working on.
If someone could help me out, that would be greatly appreciated!

I guess it's this

inst.AnimState:PlayAnimation("mindcontrol_loop", true)

 

1 hour ago, Haruhi Kawaii said:

I guess it's this

inst.AnimState:PlayAnimation("mindcontrol_loop", true)

 

This works! Thank you!
But the animation doesn't play if the player is moving, and stops as soon as they start moving if they aren't.
I'll have to figure out how to freeze the player in place for a second or two when the function is triggered.
for reference, this is the code I'm using (under common_postinit):

local function BurnOut(inst, data)
inst.AnimState:PlayAnimation("mindcontrol_loop", true) 
end

and in the master_postinit I have this:

inst:ListenForEvent("goinsane", BurnOut)

 

22 hours ago, zvxaxvz said:

This works! Thank you!
But the animation doesn't play if the player is moving, and stops as soon as they start moving if they aren't.
I'll have to figure out how to freeze the player in place for a second or two when the function is triggered.
for reference, this is the code I'm using (under common_postinit):

local function BurnOut(inst, data)
inst.AnimState:PlayAnimation("mindcontrol_loop", true) 
end

and in the master_postinit I have this:

inst:ListenForEvent("goinsane", BurnOut)

 

You might need to use stategraphs, but I don't know much about them. You could either create a new state or edit an existing one. Another less efficient way is to repeatedly call

inst.sg:GoToState("mindcontrolled_loop")

 as it defaults to about 0.5 seconds, and I don't know how to extend it. Also, I found this code from this post, but I'm not sure if it works
https://forums.kleientertainment.com/forums/topic/150849-a-walter-slingshot-mod-request/#comment-1663790

local SGWilson = require("stategraphs/SGwilson")
local previousMindControlledOnEnter = SGWilson.states["mindcontrolled_loop"].onenter

SGWilson.states["mindcontrolled_loop"].onenter = function(inst)
    previousMindControlledOnEnter(inst)
    if inst:HasTag("yourtag") then
        inst.sg:SetTimeout(3) --Time out
    end
end

 

1 hour ago, Haruhi Kawaii said:

You might need to use stategraphs, but I don't know much about them. You could either create a new state or edit an existing one. Another less efficient way is to repeatedly call

inst.sg:GoToState("mindcontrolled_loop")

 as it defaults to about 0.5 seconds, and I don't know how to extend it. Also, I found this code from this post, but I'm not sure if it works
https://forums.kleientertainment.com/forums/topic/150849-a-walter-slingshot-mod-request/#comment-1663790

local SGWilson = require("stategraphs/SGwilson")
local previousMindControlledOnEnter = SGWilson.states["mindcontrolled_loop"].onenter

SGWilson.states["mindcontrolled_loop"].onenter = function(inst)
    previousMindControlledOnEnter(inst)
    if inst:HasTag("yourtag") then
        inst.sg:SetTimeout(3) --Time out
    end
end

 

This works! Kind of. If I'm moving while the timeout is triggered, instead of stopping in place, I just lose control and keep walking in the direction I was headed until the timeout is over. I've tried adding the following lines of code:

	inst.components.locomotor:Stop()
	inst:ClearBufferedAction()
	inst.Physics:Stop()

but it doesn't seem to be doing anything to fix that. I could try a line of code that disables control entirely, but I wouldn't know how to make it stop when the timeout is over. Thank you for all your help so far, this is more progress than I'd be able to do alone!

11 hours ago, zvxaxvz said:

This works! Kind of. If I'm moving while the timeout is triggered, instead of stopping in place, I just lose control and keep walking in the direction I was headed until the timeout is over. I've tried adding the following lines of code:

	inst.components.locomotor:Stop()
	inst:ClearBufferedAction()
	inst.Physics:Stop()

but it doesn't seem to be doing anything to fix that. I could try a line of code that disables control entirely, but I wouldn't know how to make it stop when the timeout is over. Thank you for all your help so far, this is more progress than I'd be able to do alone!

Try this
modmain:
 

local SGWilson = require("stategraphs/SGwilson")
local previousMindControlledOnEnter = SGWilson.states["mindcontrolled_loop"].onenter

SGWilson.states["mindcontrolled_loop"].onenter = function(inst)
    previousMindControlledOnEnter(inst)
    if inst:HasTag("needtostop") then
        inst.sg:SetTimeout(5) --Time out 5s
    end
end

character:

local function BurnOut(inst, data)
	inst:AddTag("needtostop")
	inst.sg:GoToState("mindcontrolled_loop")
	inst:RemoveTag("needtostop")
end

master_postinit:

inst:ListenForEvent("goinsane", BurnOut)
7 hours ago, Haruhi Kawaii said:

Try this
modmain:
 

local SGWilson = require("stategraphs/SGwilson")
local previousMindControlledOnEnter = SGWilson.states["mindcontrolled_loop"].onenter

SGWilson.states["mindcontrolled_loop"].onenter = function(inst)
    previousMindControlledOnEnter(inst)
    if inst:HasTag("needtostop") then
        inst.sg:SetTimeout(5) --Time out 5s
    end
end

character:

local function BurnOut(inst, data)
	inst:AddTag("needtostop")
	inst.sg:GoToState("mindcontrolled_loop")
	inst:RemoveTag("needtostop")
end

master_postinit:

inst:ListenForEvent("goinsane", BurnOut)

That doesn't seem to stop the sliding that happens if It triggers the state while I'm moving. Is there some way to add a delay to calling a line of code?

23 hours ago, zvxaxvz said:

That doesn't seem to stop the sliding that happens if It triggers the state while I'm moving

 
local SGWilson = require("stategraphs/SGwilson")
local previousMindControlledOnEnter = SGWilson.states["mindcontrolled_loop"].onenter

SGWilson.states["mindcontrolled_loop"].onenter = function(inst)
    previousMindControlledOnEnter(inst)
    if inst:HasTag("needtostop") then
        inst.components.locomotor:Stop()
        inst.sg:SetTimeout(5) --Time out 5s
    end
end
23 hours ago, zvxaxvz said:

Is there some way to add a delay to calling a line of code?

You can use DoTaskInTime or inst.components.timer

 

Edited by Haruhi Kawaii

I've tried adding this

local function BurnOut(inst, data)
	inst:AddTag("needtostop")
	inst.sg:GoToState("mindcontrolled_loop")
    inst:DoTaskInTime(1.5, function() 
	inst:RemoveTag("needtostop")
  end)
end

local function StopMoving(inst, data)
if inst:HasTag("needtostop") then
        inst.components.playercontroller:Enable(false)
		inst.components.locomotor:Stop()
else 
        inst.components.playercontroller:Enable(true)
	end
end

and in master, this

inst:DoPeriodicTask(1.0, StopMoving)

And it still doesn't work properly D:
If I'm not moving when I go insane, it functions perfectly, but if I'm mid-movement it still just slides me in the direction I was going...
I'll try some more stuff and see if that works in the meantime.

9 hours ago, zvxaxvz said:

I've tried adding this

local function BurnOut(inst, data)
	inst:AddTag("needtostop")
	inst.sg:GoToState("mindcontrolled_loop")
    inst:DoTaskInTime(1.5, function() 
	inst:RemoveTag("needtostop")
  end)
end

local function StopMoving(inst, data)
if inst:HasTag("needtostop") then
        inst.components.playercontroller:Enable(false)
		inst.components.locomotor:Stop()
else 
        inst.components.playercontroller:Enable(true)
	end
end

and in master, this

inst:DoPeriodicTask(1.0, StopMoving)

And it still doesn't work properly D:
If I'm not moving when I go insane, it functions perfectly, but if I'm mid-movement it still just slides me in the direction I was going...
I'll try some more stuff and see if that works in the meantime.

I missed a few things; here's the complete code. I'm pretty sure it will work. The "mindcontrolled" state will stop the character, and then it will run "mindcontrolled_loop" afterward.

local SGWilson = require("stategraphs/SGwilson")
local previousMindControlledOnEnter = SGWilson.states["mindcontrolled_loop"].onenter

SGWilson.states["mindcontrolled_loop"].onenter = function(inst)
    previousMindControlledOnEnter(inst)
    if inst:HasTag("needtostop") then
        inst.sg:SetTimeout(5) --Time out 5s
    end
end


 

local function BurnOut(inst, data)
    inst:AddTag("needtostop")
    inst.sg:GoToState("mindcontrolled")
    inst:DoTaskInTime(1.5, function()
        inst:RemoveTag("needtostop")
    end)
end

 

10 hours ago, Haruhi Kawaii said:

I missed a few things; here's the complete code. I'm pretty sure it will work. The "mindcontrolled" state will stop the character, and then it will run "mindcontrolled_loop" afterward.

local SGWilson = require("stategraphs/SGwilson")
local previousMindControlledOnEnter = SGWilson.states["mindcontrolled_loop"].onenter

SGWilson.states["mindcontrolled_loop"].onenter = function(inst)
    previousMindControlledOnEnter(inst)
    if inst:HasTag("needtostop") then
        inst.sg:SetTimeout(5) --Time out 5s
    end
end


 

local function BurnOut(inst, data)
    inst:AddTag("needtostop")
    inst.sg:GoToState("mindcontrolled")
    inst:DoTaskInTime(1.5, function()
        inst:RemoveTag("needtostop")
    end)
end

 

This worked PERFECTLY! Thank you so much :D

Create an account or sign in to comment

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

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...