Page 1 of 1

help with aa on/off varaible (dont know if this is the place to post)

Posted: Thu Jun 25, 2020 1:07 pm
by mflvs
Hi,

I dont know if this is the right place to post, ive checked the forum and havent found what i was looking for.

i have a script that i am working on for enemy health in "little witch nobeta" but i would like to know how to code an on/off variable as so to enable or disable a ohk.



i would like orignal code to activate when "off" and changed code to activate when "on". But i dont know how to create such a variable, i have seen them in other trainers.



thank you in advance

help with aa on/off varaible (dont know if this is the place to post)

Posted: Thu Jun 25, 2020 1:25 pm
by GreenHouse
[CODE=nasm]alloc(ohk,1)

registersymbol(ohk)



newmem:

cmp byte ptr [ohk],01

jne originalcode

*mov health to 0 here*



originalcode:

*whatever your code already has*[/CODE]

With that, add 'ohk' to the address list, and set to 1 to enable ohk and 0 to disable.

help with aa on/off varaible (dont know if this is the place to post)

Posted: Thu Jun 25, 2020 1:26 pm
by mflvs
thank you :)

[automerge]1593095925[/automerge]

i am really grateful for the code snippet above i can now switch between the 2 sections with on/off. only issue is writing the value i want for the ohk ( 0 ). with normal values im fine. but im am wondering if i could have some guidance on how to write to dwords that are using fstp and fld.



only issue i have is i cant seem to write my desired value

fstp dword ptr [edi+18] //when this is nop health wont decrease, but i can seem to set it to 0 for one hit kill



[CODE=nasm]EnemyCode:

cmp byte [ohk],1

jne EnemyOrigDamage

//OHK

fstp dword ptr [edi+18] //when this is nop health wont decrease, but i can seem to set it to 0 for one hit kill

fld dword ptr [edi+00000080]

jmp return



EnemyOrigDamage:

fstp dword ptr [edi+18]

fld dword ptr [edi+00000080]

push rax

lea rax,[edi+18]

mov [EnemyHealthAddress],rax

pop rax

jmp return[/CODE]

help with aa on/off varaible (dont know if this is the place to post)

Posted: Thu Jun 25, 2020 2:41 pm
by Dread_Pony_Roberts
You can then turn the ohk address into a simple enable/disable script by writing



[CODE][ENABLE]

ohk:

db 1

[DISABLE]

ohk:

db 0[/CODE]

help with aa on/off varaible (dont know if this is the place to post)

Posted: Thu Jun 25, 2020 2:47 pm
by mflvs
ohhhh, that would make it easier than changing it in a dropdown box. only issue is i can seem to make the

fstp dword ptr [edi+18] hold the varaible i want. I know im missing something obvious. Which makes this way funer :D

help with aa on/off varaible (dont know if this is the place to post)

Posted: Thu Jun 25, 2020 3:16 pm
by GreenHouse
[QUOTE="mflvs, post: 140700, member: 498"]

only issue is i can seem to make the fstp dword ptr [edi+18] hold the varaible i want. I know im missing something obvious. Which makes this way funer :D

[/QUOTE]

Can't you just do a mov to edi+18? At the end of it.

[CODE=nasm]mov [edi+18],(float)0[/CODE]

help with aa on/off varaible (dont know if this is the place to post)

Posted: Thu Jun 25, 2020 3:37 pm
by mflvs
Thank you greenhouse :) it wortked. i may of been trying too hard. i wasnt putting (float) facepalm

i love your work :D hopefully i get this working so i can update my script with ohk