Flipcam with lua/SOC?

metalharbor

Member
I'm making a level with reverse gravity...is there any way to flip the camera with lua or a SOC?

The wiki suggests that PF_FLIPCAM can be used, but I am not sure how to use it


I know that this can be done by the player through the console/options but I'd rather have it on by default
 
Nope, you need to do it correctly!

To enable: player.pflags = $1|PF_FLIPCAM
To disable: player.pflags = $1 & ~PF_FLIPCAM
To check: if (player.pflags & PF_FLIPCAM)
 
I'm pretty basic with lua...I haven't really gotten beyond modifying other people's scripts. To enable this I assume it would be something like

addHook("ThinkFrame", do player.pflags = $1|PF_FLIPCAM end

but that doesn't seem to do anything.
 
I'm pretty basic with lua...I haven't really gotten beyond modifying other people's scripts. To enable this I assume it would be something like

addHook("ThinkFrame", do player.pflags = $1|PF_FLIPCAM end

but that doesn't seem to do anything.
try this :
Lua:
local function FlipCam(player)
  -- Check if the player is in first-person mode
  if player.camera.style == 1 then
    -- Flip the camera horizontally
    player.camera.angle = player.camera.angle + Angle(0, 180, 0)
  end
end

-- Hook the FlipCam function to the appropriate event
addHook("ThinkFrame", function()
  for player in players.iterate do
    FlipCam(player)
  end
end)
 
Does that need to be called by a linedef? Just including it in the pk3 lua folder doesn't seem to do anything.

Edit: to be clear, the camera flip setting is off by default, and I'm hoping for it to go on.
 
try this :
Lua:
local function FlipCam(player)
  -- Check if the player is in first-person mode
  if player.camera.style == 1 then
    -- Flip the camera horizontally
    player.camera.angle = player.camera.angle + Angle(0, 180, 0)
  end
end

-- Hook the FlipCam function to the appropriate event
addHook("ThinkFrame", function()
  for player in players.iterate do
    FlipCam(player)
  end
end)
Same warning as your other post, but this AI generated piece of code was obviously not screened or corrected to work with SRB2. Please don't suggest AI code as help if you can't correct it.
 

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top