It says “This function parameter expects a value of type fort_character->void, but this argument is an incompatible value of type tuple(fort_character,logic)->void.”
If anyone could help much would be appreciated. I want the movement__modulator_device to activate when you jump
Hi, here’s an updated version of your code. Untested, but no type errors. I’ve not used the movement modulator device and I’m not sure how Disable and Activate are going to work without trying it.
@editable
ModDevice : movement_modulator_device = movement_modulator_device{}
@editable
Spawner : player_spawner_device = player_spawner_device{}
var MaybeTargetAgent: ?agent = false
var JumpStarted: logic = false
ActivateOnJump(FortCharacter : fort_character) : void =
# This event indicates a jump has happened
if(CharacterAgent := FortCharacter.GetAgent[]):
ModDevice.Activate(CharacterAgent)
set JumpStarted = true
HandleSpawnEvent (Agent : agent) : void =
if (FortCharacter := Agent.GetFortCharacter[]):
FortCharacter.JumpedEvent().Subscribe(ActivateOnJump)
set MaybeTargetAgent = option{Agent}
OnBegin<override>()<suspends>:void=
Spawner.SpawnedEvent.Subscribe(HandleSpawnEvent)
loop:
if(TargetAgent := MaybeTargetAgent, FortCharacter := TargetAgent.GetFortCharacter[]):
if(JumpStarted = true and FortCharacter.IsOnGround[]):
set JumpStarted = false
ModDevice.Disable()
Sleep(0.0)
Your welcome! once you’ve tested it out and if it does what you’d hoped - It will need to be updated to track that jumping variable per player agent reference for multiplayer which isn’t too difficult to set up.