I’m not very good at explaining things but, I found this devfourm post on how to make a GTA-like weapon wheel. And one guy showed how to get the angle, but I have absolutely no idea how to select the stuff.
If a player had 8 tools, they could do mouseangle < 90 and mouseangle > 45 like mentioned in the post, but what if the player didn’t have 8 tools how would I calculate if they had 3 items… for example.
local numOfTools = 3
local ok = 360 / numOfTools
if Degrees < ok then
print("test")
elseif Degrees < ok + ok then
print("test2")
elseif Degrees < ok + ok + ok then
print("test3")
end
well it does, but if i change num of tools to a different number then it doesnt work
I’m sorry I can’t write the code atm because I’m not at my pc but I’d just use a simple algorithm to find the tool:
-say a player has 5 tools (so 72 degrees per segment)
-the mouse it at 227 degrees
for loop running through until it finds:
if 227 <= i x 72 (i starts at 1, then goes to 2 and so on)
when it goes through (in our case) the 4th loop:
if 227 <= i (which is 4) x 72 (which equals 288) then you know since it’s the 4 th loop that the slot will be slot 4
I’m nit the greatest at explaining so if you don’t understand anything please ask
local slots = 7
local degPerSegment = 360 / 7
local mouseDeg = idk this (example 183 degrees)
local slot = nil
for i=1, slots do
if mouseDeg <= i * degPerSegment then
slot = i
break
end
end
nit 100% sure if this’ll work but please test it and lmk
I think you’d have to break it or use until, otherwise it’ll always be the last slot, you need it to stop for the first slot that meets the criteria or check if the remainder is smaller than the offset (how much bigger it is than the degrees per segement)