Jump to content

Command Blocks


Recommended Posts

Hey everyone, I was trying to make a boss fighting arena with some friends but I got tired of typing the exact same command in the console every time. I was wondering if there was a mod out there that made it so that when you click an object, a command gets executed in the console. Something similar to minecraft command blocks.

If there isn't, anyone has any tips or to tutorials that could help me do this ? I have done some java and c# before but I've never worked on a don't starve mod before so I don't exactly know where to start. 

Thanks in advance for your help !

Link to comment
Share on other sites

You can make a mod that does something when you push a certain key on your keyboard, if that helps. Also, you don't have to type the whole command each time. DST supports copy/paste, so if you write the command in a text document, and just CTRL-C the line before you start playing, it's ready to be pasted into the console with CTRL-V.

If you want to start modding, I recommend taking at least the LUA Crash Course. From there, you can look at any mod that does keyboard commands (or search this forum) to find out how to execute code at the push of a button.

Link to comment
Share on other sites

If the object has an inspectable component, then you could override its description with a new one and have it do things:

sometarget.components.inspectable.getspecialdescription = function(inst, viewer)
    local mob = SpawnPrefab("hound")
    local x, _, z = viewer.Transform:GetWorldPosition()
    mob.Transform:SetPosition(x, 0, z + 5)
    return "Spawned~"
end

 

Link to comment
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

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
 Share

×
  • Create New...