Jump to content

Recommended Posts

Greetings,

 

I'm creating a buildable that searches the area for entities and does stuff with them (e.g., the Flingomatic).  I've managed that successfully, but now I'm trying to fine-tune the radius.  What's more, I'd like to visualize this radius when placing the object (again, similar to how the Flingomatic works).  However, I'm not keen on crafting preview art a few dozen times until it matches up, then tweaking the radius for a few dozen runs until it matches the preview art.

 

Is there a better workflow for this?  What's the proportion between buildable image size and in-game distance?  (I assume that there's no built-in way to generate radius visualization so that I don't have to make an asset for it....)

 

In the meantime, I'm kludging the radius tweak itself by simply placing a whole bunch of entities around the object in question and seeing which ones get affected.  Ugh.

 

Open to ideas, and thanks in advance.

 

/* blahpers */

Link to comment
https://forums.kleientertainment.com/forums/topic/54579-distance/
Share on other sites

Put this in modmain:

local radius = 10GLOBAL.SR = function(ra)	radius = raendGLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_H, function()	local pos = GLOBAL.TheInput:GetWorldPosition()	for i = 0, 2 * GLOBAL.PI, GLOBAL.DEGREES do		local ret = GLOBAL.SpawnPrefab("reticule")		local x = pos.x + radius * math.cos(i)		local z = pos.z + radius * math.sin(i)		ret.Transform:SetPosition(x, 0, z)		ret:DoTaskInTime(5, ret.Remove)	endend)

Now, when you press the H key, you will generate a circle of radius 10 around your cursor.

The exact radius would be from the tip of your cursor to the middle of the "line" that contains the circle.

It disappears in 5 seconds.

 

To change radius, you open the console, and type, for example:

SR(5)

 

Now the radius is 5. You put the cursor over your thing and press H.

Edited by DarkXero

Put this in modmain:

local radius = 10GLOBAL.SR = function(ra)	radius = raendGLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_H, function()	local pos = GLOBAL.TheInput:GetWorldPosition()	for i = 0, 2 * GLOBAL.PI, GLOBAL.DEGREES do		local ret = GLOBAL.SpawnPrefab("reticule")		local x = pos.x + radius * math.cos(i)		local z = pos.z + radius * math.sin(i)		ret.Transform:SetPosition(x, 0, z)		ret:DoTaskInTime(5, ret.Remove)	endend)

Now, when you press the H key, you will generate a circle of radius 10 around your cursor.

The exact radius would be from the tip of your cursor to the middle of the "line" that contains the circle.

It disappears in 5 seconds.

 

To change radius, you open the console, and type, for example:

SR(5)

 

Now the radius is 5. You put the cursor over your thing and press H.

 

That is amazing.  Seriously.  Can't wait to try it out.

 

Cheers!

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