Harmless05 / harmless-lua

Repo for Lua scripts made by Harmless for YimMenu
2 stars 0 forks source link

[BUG] ragdool loop cause crash #1

Closed alyxme closed 11 months ago

alyxme commented 11 months ago

What Lua script does this affect

ragdoll-player.lua

Describe the bug

cause crash when loop are enabled

How to replicate

  1. build latest yim
  2. ...
  3. press Ragdool Player Loop
  4. crashed

Expected Behavior

expect not to crash

Possible evidence

No response

Additional context

No response

Build

Lua script version

Harmless05 commented 11 months ago

I know that this is an issue, but I could never reproduce it on my system. Could you give me your Yim logs, and did you use default settings when enabling the loop?

alyxme commented 11 months ago

I know that this is an issue, but I could never reproduce it on my system. Could you give me your Yim logs, and did you use default settings when enabling the loop?

no info in cout.log about this bug. settings are default. tried to decrease force from 500 to 0 but again just crash appear. expect when ragdolled with loop to not to disable ragdoll state rather than just reenabling it. Im personaly very like this lua can finaly enables ragdoll for self.

Harmless05 commented 11 months ago

I could now reproduce it and there is something wrong with script_util:sleep(loops) but I cannot fix it. I have a different script that uses the same way to pause the loop but on that one, it works fine. When removing script_util:sleep(loops) then everything works but you cannot change the speed, so it loops like every 1ms

alyxme commented 11 months ago

what if instead to loop single action we just set time1 to 0 (instead of looped 10000) so it may be infinite as it needed. I will check that EDIT: might be -1 instead of 0

Harmless05 commented 11 months ago

Okay, I know what you mean. I didn't really change SET_PED_TO_RAGDOLL and APPLY_FORCE_TO_ENTITY args and just copied them from my old scripts folder. I might also add RagdollTypes to SET_PED_TO_RAGDOLL so ppl have the possibility to change those as well.

Edit: ForceFlags also has some other types of pushing the ped, but since they don't really seem to do anything, so I won't change that.

alyxme commented 11 months ago

Yes. You may right. Im also just checked this: -1 gives infinite time and any above gives time in ms to "play". So loop isnt needed. Also field of type needed to be restircted to its min and max value. Espec int values fields shouldnt be able typed with letters.

Harmless05 commented 11 months ago

Also field of type needed to be restircted to its min and max value. Espec int values fields shouldnt be able typed with letters.

This is a yimmenu Lua problem, I cannot add min max to add_input_int. I could use imgui stuff but I'm still testing what works with what until then I won't change it.

Harmless05 commented 11 months ago

Im also just checked this: -1 gives infinite time and any above gives time in ms to "play". So loop isnt needed.

Could you show me what you mean by this I'm a bit lost. Also, I fixed the error.

alyxme commented 11 months ago

I mean that infinite call could be better than loop:

    if loop:is_enabled() then
            PED.SET_PED_TO_RAGDOLL(players, -1, 0, 0, true, true, false)

because loop just forced to multiple use of repeated single and other side infinite time of -1 just made call only once.

Harmless05 commented 11 months ago

@alyxme check pull request https://github.com/Harmless05/harmless-lua/pull/2/files

I'm new to pull requests so idk what the f I'm doing