Wonderlarr Posted November 27, 2020 Share Posted November 27, 2020 (edited) Hello! Is there a way to have an entity be removed from a frozen state? I'm coding a sortof Ice Statue thing and need my character to be frozen for exactly 0.5 seconds. I can freeze them, but can't unfreeze them on demand. This is what I tried, but I don't think RemoveColdness is a real thing. local function FreezeStomp(inst) if inst.components.freezable then inst:AddColdness(10) end inst:DoTaskInTime(0.5, function(inst) if inst.components.freezable then inst:RemoveColdness(10) end) end According to the server log, RemoveColdness is nil, so what can I use or do to break my character out of the frozen state? Edit: To be clear, I need them to be frozen first, I can't just resist the freeze entirely, it defeats the point. If this isn't possible, is there a way to just call the animation? Then I could combine that with a speed modifier of 0x to kindof freeze them. Edited November 27, 2020 by TheSkylarr Forgot to finish writing Link to comment Share on other sites More sharing options...
pickleplayer Posted November 27, 2020 Share Posted November 27, 2020 (edited) If you take a peek into freezable.lua, I see there is a function called Unfreeze() You might want to give that a try. Looking into component files is always a good way to get an idea of what you can do with them. inst.components.freezable:Unfreeze() Alternatively, I believe the frozen state is, well, a state. Meaning that you could force someone out of it by simply forcing them into another state, like inst.sg:GoToState("idle") I'm unsure if there could be consequences to doing this manually, like if frozen values would build up if not removed properly, but it's something to consider. EDIT: Oh, I just noticed you were trying to call freezable component functions on inst by itself. I'm surprised this doesn't just crash the game. You're probably looking for inst.components.freezable:AddColdness(10) But yea, RemoveColdness() doesn't exist. Buuut, I think you can put negative values into AddColdness() Edited November 27, 2020 by pickleplayer 1 Link to comment Share on other sites More sharing options...
Wonderlarr Posted November 28, 2020 Author Share Posted November 28, 2020 26 minutes ago, pickleplayer said: If you take a peek into freezable.lua, I see there is a function called Unfreeze() You might want to give that a try. Looking into component files is always a good way to get an idea of what you can do with them. inst.components.freezable:Unfreeze() Alternatively, I believe the frozen state is, well, a state. Meaning that you could force someone out of it by simply forcing them into another state, like inst.sg:GoToState("idle") I'm unsure if there could be consequences to doing this manually, like if frozen values would build up if not removed properly, but it's something to consider. EDIT: Oh, I just noticed you were trying to call freezable component functions on inst by itself. I'm surprised this doesn't just crash the game. You're probably looking for inst.components.freezable:AddColdness(10) But yea, RemoveColdness() doesn't exist. Buuut, I think you can put negative values into AddColdness() It doesn't crash the game because this is actually inside of a function called by the server when a player presses a key, so inst is directly linked to the player. Thanks for the help, I'll start looking into stuff like this, I figured it was built into the engine or something and I couldn't access help like that. Link to comment Share on other sites More sharing options...
pickleplayer Posted November 28, 2020 Share Posted November 28, 2020 10 minutes ago, TheSkylarr said: It doesn't crash the game because this is actually inside of a function called by the server when a player presses a key, so inst is directly linked to the player. Thanks for the help, I'll start looking into stuff like this, I figured it was built into the engine or something and I couldn't access help like that. Do you know how to look at the game files? It was a little easier back when I started modding, but the scripts are tucked inside of a zipped folder now. It's still a great thing to have access to, and essential for anyone learning to mod. Using notepadd++'s "find in files" feature centered on the scripts folder is the best way to quickly learn how things are used in the game's programming. There are a few things that are built into the engine that we can't see, but it's pretty rare. 1 Link to comment Share on other sites More sharing options...
Wonderlarr Posted November 28, 2020 Author Share Posted November 28, 2020 2 minutes ago, pickleplayer said: Do you know how to look at the game files? It was a little easier back when I started modding, but the scripts are tucked inside of a zipped folder now. It's still a great thing to have access to, and essential for anyone learning to mod. Using notepadd++'s "find in files" feature centered on the scripts folder is the best way to quickly learn how things are used in the game's programming. There are a few things that are built into the engine that we can't see, but it's pretty rare. I do know how to look into them, but I've only ever looked at prefab scripts. I didn't know components and such were also stored in scripts there. I also didn't know about find in files, thank you! I just tried it and it's super useful! 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now