Already went through that, didn’t get it. Even went through these
I don’t think you need a module for this, just keep it as a regular script. You can use multiple script components on the same object and expose some variables as script properties so the base behavior script is customizable. For example, in your “module code”, you can add go.property("speed", 30) and then you can set that to whatever you want for each mob, in the editor. Or you can set it from another script with something like, go.set("#mobModule, "speed", 150). You can do the same thing with …
local functions={}
local function functions.test()
local a="eee"
print(a)
end
return functions
Need to put local in all the functions or variables, or a function/variable inside a table/function, are always local?
or if the table/function is local, al his “child” are local?
local functions={}
function functions.test()
a="eee" --or this need to be local?
print(a)
end
return functions
thanks
There are a couple options for that:
Message passing
You can define your own custom messages with an ID and a table of data sent with it. This is good for when you just need to set or change some value without needing a response:
-- In some script
msg.post("player", "add_points", { amount = 100 })
-- In player script
function on_message(self, message_id, message, sender)
if message_id == hash("add_points") then
self.score = self.score + message.amount
end
end
Read more:
Lu…
idk Ill keep trying and finding. But Im guessing maybe Ill try switching it, module is the wasd movement and tom script is the regular script with defined health and speed.