Jump to content

Recommended Posts

I want to write a simple mod to allow Clockmaker's Tools to dismantle other items

The limit is in componentactions.lua, it only allows Wanda to dismantle watchs

image.png.3b518deb0cc39fd779ea5e34714eb556.png

So I write this

image.png.205d1d993de20e30388a9f194a6e61a8.png

But the game reported "attempt to index global 'ACTIONS'(a nil value)"

I did't see any code in componentactions.lua to import ACTIONS from other place, maybe this variable has not been initialized yet when loading the mod?

Link to comment
https://forums.kleientertainment.com/forums/topic/161966-how-to-access-actions/
Share on other sites

Use
local ACTIONS = GLOBAL.ACTIONS at the top of your file. Remember my child: if something is being used in code and not being declared in code but don't work because of "a nil value" you should probably declare it with GLOBAL. or import the script with this function which is often times impossible or useless because it's in source code.

  • Like 1
On 12/9/2024 at 2:53 PM, Mr.CrazyPotato said:

Use
local ACTIONS = GLOBAL.ACTIONS at the top of your file. Remember my child: if something is being used in code and not being declared in code but don't work because of "a nil value" you should probably declare it with GLOBAL. or import the script with this function which is often times impossible or useless because it's in source code.

Thank you very much ~~Then I got an error throwed by seasonclock(how?)~~

I plan to write a new dismantle action.

But I have a question, I have another mod to override a TUNING variable, but I do not need to write `local TUNING = GLOBAL.TUNING`, I just need to write `TUNING.DEERCLOPSEYEBALL_SENTRYWARD_TEMPERATURE_OVERRIDE = 10`, and it just work

2 hours ago, Fangliding said:

and it just work

Yes, sometimes mod environment already have some things. It's good to not write code you don't need to but if you're not sure you can always do it, it won't cause an error if you're know what you're doing. And error with seasonclock most likely caused because you're using some Wanda's items components which maybe somewhere work with seasonclock

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...