Update cubzh.lua
Browse files
cubzh.lua
CHANGED
@@ -103,6 +103,26 @@ local skills = {
|
|
103 |
dialog:create("<Jumps in the air!>", npc.avatar.Head)
|
104 |
print(string.format("%s: %s", npc.gameName, "<Jumps in the air!>"))
|
105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
npc.object.avatarContainer.Physics = PhysicsMode.Dynamic
|
107 |
npc.object.avatarContainer.Velocity.Y = 50
|
108 |
Timer(3, function()
|
@@ -476,30 +496,10 @@ Client.OnChat = function(payload)
|
|
476 |
content = msg,
|
477 |
})
|
478 |
|
479 |
-
rotateNPCHead(5)
|
480 |
-
|
481 |
print("User: " .. payload.message)
|
482 |
return true
|
483 |
end
|
484 |
|
485 |
-
function rotateNPCHead(times)
|
486 |
-
local rotations = 0
|
487 |
-
local rotationTimer = Timer.New()
|
488 |
-
local originalRotation = Player.avatar.Head.LocalRotation:Copy()
|
489 |
-
|
490 |
-
rotationTimer:Schedule(function()
|
491 |
-
if rotations < times * 2 then
|
492 |
-
local angle = (rotations % 2 == 0) and math.pi/4 or -math.pi/4
|
493 |
-
Player.avatar.Head.LocalRotation = { angle, 0, 0 }
|
494 |
-
rotations = rotations + 1
|
495 |
-
return 0.2 -- Schedule next rotation in 0.2 seconds
|
496 |
-
else
|
497 |
-
Player.avatar.Head.LocalRotation = originalRotation
|
498 |
-
return false -- Stop the timer
|
499 |
-
end
|
500 |
-
end)
|
501 |
-
end
|
502 |
-
|
503 |
onboardingConfig = {
|
504 |
steps = {
|
505 |
{
|
|
|
103 |
dialog:create("<Jumps in the air!>", npc.avatar.Head)
|
104 |
print(string.format("%s: %s", npc.gameName, "<Jumps in the air!>"))
|
105 |
|
106 |
+
-- Add head rotation
|
107 |
+
local rotationDuration = 2 -- seconds
|
108 |
+
local rotationSpeed = 2 * math.pi / rotationDuration -- radians per second
|
109 |
+
local elapsedTime = 0
|
110 |
+
local originalRotation = npc.avatar.Head.LocalRotation:Copy()
|
111 |
+
|
112 |
+
local rotationTimer = Timer.New("headRotation")
|
113 |
+
rotationTimer.OnFinish = function()
|
114 |
+
elapsedTime = elapsedTime + 1/60 -- Assuming 60 FPS
|
115 |
+
local newRotation = originalRotation + Number3(0, math.sin(elapsedTime * rotationSpeed) * 0.5, 0)
|
116 |
+
npc.avatar.Head.LocalRotation = newRotation
|
117 |
+
|
118 |
+
if elapsedTime < rotationDuration then
|
119 |
+
rotationTimer:Start(1/60) -- Restart the timer for the next frame
|
120 |
+
else
|
121 |
+
npc.avatar.Head.LocalRotation = originalRotation -- Reset to original rotation
|
122 |
+
end
|
123 |
+
end
|
124 |
+
rotationTimer:Start(1/60) -- Start the rotation timer
|
125 |
+
|
126 |
npc.object.avatarContainer.Physics = PhysicsMode.Dynamic
|
127 |
npc.object.avatarContainer.Velocity.Y = 50
|
128 |
Timer(3, function()
|
|
|
496 |
content = msg,
|
497 |
})
|
498 |
|
|
|
|
|
499 |
print("User: " .. payload.message)
|
500 |
return true
|
501 |
end
|
502 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
onboardingConfig = {
|
504 |
steps = {
|
505 |
{
|