among-us-memory icon indicating copy to clipboard operation
among-us-memory copied to clipboard

Write Light range does not work

Open thkdlflghlsdghilr opened this issue 4 years ago • 20 comments

I am using the code data.WriteMemory_LightRange(100.0f); but it just flickers to full bright every couple of seconds and then imminently goes back to normal brightness.

thkdlflghlsdghilr avatar Sep 29 '20 17:09 thkdlflghlsdghilr

Same problem that I am having, and its because the while loop. The thread.sleep, but there is another way to do it, I just forgot the way. Theres a way to make it permanent where when the program launches it stays but not sure how.

zpacedesu avatar Sep 29 '20 17:09 zpacedesu

use freeze function in memory.dll

shlifedev avatar Sep 30 '20 04:09 shlifedev

never really used memory dll, so how do you use the freeze function exactly? any help would be appreciated, just how to use it, not the whole thing because I don't wanna be spoonfed, just want to learn :)

zpacedesu avatar Sep 30 '20 04:09 zpacedesu

mem.FreezeValue(data.WriteMemory_LightRange,** , 100f);

I do not know what goes between the stars.

use freeze function in memory.dll

zpacedesu avatar Sep 30 '20 04:09 zpacedesu

mem.FreezeValue(data.WriteMemory_LightRange,** , 100f);

I do not know what goes between the stars.

use freeze function in memory.dll


FREEZE FUNCTION MEMORY.DLL
       /// <summary>
        /// Freeze a value to an address.
        /// </summary>
        /// <param name="address">Your address</param>
        /// <param name="type">byte, 2bytes, bytes, float, int, string, double or long.</param>
        /// <param name="value">Value to freeze</param>
        /// <param name="file">ini file to read address from (OPTIONAL)</param>


Since the value it's float, just put float.

Paffo avatar Sep 30 '20 15:09 Paffo

image Then I get this error when I tried to put float

With this code: Cheese.mem.FreezeValue(data.WriteMemory_LightRange,float,100f);

zpacedesu avatar Sep 30 '20 16:09 zpacedesu

its a string, so "float"

Paffo avatar Sep 30 '20 16:09 Paffo

Ah, forgot about that! Thanks mate, really really appreciate it, that fixed my issues, truly appreciate it.

zpacedesu avatar Sep 30 '20 16:09 zpacedesu

Ah, forgot about that! Thanks mate, really really appreciate it, that fixed my issues, truly appreciate it.

no problem :)

Paffo avatar Sep 30 '20 16:09 Paffo

                mem.FreezeValue("data.WriteMemory_LightRange", "float", "100f");

So tried this code, not sure why it did not work, I put it in the while statement. Might have to find another way.

zpacedesu avatar Sep 30 '20 16:09 zpacedesu

since you're using Memory's Freeze function you dont need to put it into a while, its a single fire. Also be sure your address is correct.

Paffo avatar Sep 30 '20 16:09 Paffo

Ok, I see, well the address is the one in the code,

public void WriteMemory_LightRange(float value) { var targetPointer = Utils.GetMemberPointer(Instance.myLight, typeof(LightSource), "LightRadius"); Cheese.mem.WriteMemory(targetPointer.GetAddress(), "float", value.ToString("0.0")); }

zpacedesu avatar Sep 30 '20 16:09 zpacedesu

hey could u send me your working light code ? i iddnt manage to get it to work for now :(

oOHiyoriOo avatar Oct 02 '20 08:10 oOHiyoriOo

PlayerData player = playerDatas.Find((p) => p.IsLocalPlayer);
var lightSourcePtr = HamsterCheese.AmongUsMemory.Utils.GetMemberPointer(player.Instance.myLight, typeof(LightSource), "LightRadius");
HamsterCheese.AmongUsMemory.Cheese.mem.FreezeValue(lightSourcePtr.GetAddress(), "float", "100.0");

However flashes very rapidly, not sure exactly why

rushiiMachine avatar Oct 02 '20 16:10 rushiiMachine

Screenshot_35

randomcmd avatar Oct 02 '20 19:10 randomcmd

Reference it

rushiiMachine avatar Oct 02 '20 19:10 rushiiMachine

PlayerData player = playerDatas.Find((p) => p.IsLocalPlayer);
var lightSourcePtr = HamsterCheese.AmongUsMemory.Utils.GetMemberPointer(player.Instance.myLight, typeof(LightSource), "LightRadius");
HamsterCheese.AmongUsMemory.Cheese.mem.FreezeValue(lightSourcePtr.GetAddress(), "float", "100.0");

However flashes very rapidly, not sure exactly why

Are u calling it multiple times ? Should only be called once when u use freeze memory or am I wrong ?

oOHiyoriOo avatar Oct 03 '20 10:10 oOHiyoriOo

How do I reference it tho? Sorry, I can't figure it out @DiamondMiner88

randomcmd avatar Oct 03 '20 15:10 randomcmd

@randomcmd Visual Studio has a quick fix option to add a reference.

@oOHiyoriOo Once If you want to Unfreeze the value do mem.UnfreezeValue(lightSourcePtr.GetAddress()) Although from testing beware that if player is null it will freeze your program

rushiiMachine avatar Oct 03 '20 17:10 rushiiMachine

Update I got the code to run, but my lights just flicker on for a split second like every 3 seconds and then return to being off. I copy pasted the code and it does that :/

randomcmd avatar Oct 03 '20 17:10 randomcmd