View previous topic :: View next topic |
Author |
Message |
sjl002 Master Cheater Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Thu Nov 12, 2015 9:51 pm Post subject: [req]making script for select unit health. |
|
|
Hi.
Making script for select unit health is hard.
how make script for stronghold crusader 2 to weak unit, heal unit,super unit and reset unit.
please help me in making this scripts. |
|
Back to top |
|
|
Zanzer I post too much Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Sat Nov 14, 2015 5:36 pm Post subject: |
|
|
Find a unit's health. Find out what access that health only when the unit is selected.
Hook that instruction to save a pointer to the unit's structure.
Add to that hook a check for a custom 0/1 variable. When 0, execute code as normal.
When 1, set unit's health to 9999 before the instruction would normally read the value.
Of course, set the custom variable back to 0 when done.
Then you set a hotkey to change your custom variable to 1 when desired. |
|
Back to top |
|
|
sjl002 Master Cheater Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Sun Nov 15, 2015 1:22 pm Post subject: |
|
|
Do you can show me the script for Reset unit(health) and heal unit(set to max)?
please. |
|
Back to top |
|
|
sjl002 Master Cheater Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Tue Nov 17, 2015 6:44 pm Post subject: |
|
|
One can not help me? |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Tue Nov 17, 2015 7:01 pm Post subject: |
|
|
How to make a script:
http://forum.cheatengine.org/viewtopic.php?t=570083
Find an instruction that accesses health often enough and inject code there. Then, just move whatever value you want into the address. If you want to set a unit's health to max, you'll have to find out where that's stored if it's not constant. It's usually around the current health value, so simply browsing for it in the memory viewer can lead you to it. _________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
sjl002 Master Cheater Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Tue Nov 17, 2015 7:45 pm Post subject: |
|
|
I would script like cheat happens options unit's. |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Tue Nov 17, 2015 7:51 pm Post subject: |
|
|
I'm not sure I'm understanding you correctly, but if you're saying you want to make a trainer, then there's also a tutorial for that here:
http://forum.cheatengine.org/viewtopic.php?p=5576412 _________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
sjl002 Master Cheater Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Tue Nov 17, 2015 8:00 pm Post subject: |
|
|
Now,if I want to from weak unit's and super unit's mode to normal To go back to what should I do?
I cant good write english.sorry |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Tue Nov 17, 2015 9:21 pm Post subject: |
|
|
You could make hotkeys for everything using Lua.
Code: | healthAddr = 0x0040AD38
function disableHacks()
-- code to disable hacks
-- example:
writeDouble(healthAddr,100)
end
function weakUnitHack()
-- code to make a unit weak
-- example:
writeDouble(healthAddr,1)
end
function strongUnitHack()
-- code to make a unit strong
-- example:
writeDouble(healthAddr,999999999)
end
createHotkey(disableHacks,VK_NUMPAD0)
createHotkey(weakUnitHack,VK_NUMPAD1)
createHotkey(strongUnitHack,VK_NUMPAD2) |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
sjl002 Master Cheater Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Tue Nov 17, 2015 9:44 pm Post subject: |
|
|
This lua It works.very thank you
other my question?
what about make script and address So that the when with number1 enable then Automatically disable? |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Tue Nov 17, 2015 10:04 pm Post subject: |
|
|
You could use a timer to disable it after a certain amount of time has passed (for example 10 seconds):
Code: | function strongUnitHack()
if strongT then
strongT.destroy()
strongT = nil
disableHacks()
return
else
strongT = createTimer(nil,true)
strongT.Interval = 10000 --10 seconds
strongT.OnTimer = strongUnitHack
end
-- code to make a unit strong
-- example:
writeDouble(healthAddr,999999999)
end |
Do a similar thing for the function weakUnitHack(). Just name the timer variable something different (e.g. "weakT").
A side effect is that if you press the hotkey for this function again, it'll disable the hack. You can get around this by setting that hotkey's DelayBetweenActivate property to the same as the interval on the timer. _________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
sjl002 Master Cheater Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Wed Nov 18, 2015 4:56 am Post subject: |
|
|
Do,You write the lua code that gets the entire to auto assembly?(i mean is how this lua code in auto assemly) |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Wed Nov 18, 2015 9:49 am Post subject: |
|
|
All of that code was meant to go into the cheat table Lua script (Ctrl+Alt+L).
If you want to put it into an AA script, do something like this:
Code: | [ENABLE]
// asm code here
{$lua}
-- Lua code here
{$asm}
// asm code here
[DISABLE]
// asm code here
{$lua}
-- Lua code here
{$asm}
// asm code here |
If you want to auto assemble something using Lua, then use the autoAssemble(String) function:
Code: | autoAssemble([[
// asm code here
// example:
globalalloc(newmem,1024)]]) |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
sjl002 Master Cheater Reputation: 0
Joined: 31 Aug 2013 Posts: 305
|
Posted: Wed Nov 18, 2015 10:06 pm Post subject: |
|
|
Thanks again.
for example lua script super unit What the difference with heal unit.
is meaning super unit mov unit health to max and freeze to max for one unit?(To be show script for this options)** |
|
Back to top |
|
|
ParkourPenguin I post too much Reputation: 140
Joined: 06 Jul 2014 Posts: 4289
|
Posted: Thu Nov 19, 2015 12:41 pm Post subject: |
|
|
Create a timer and freeze it with that:
Code: | function freezeUnitHealth()
if freezeT then
freezeT.destroy()
freezeT = nil
return
else
freezeT = createTimer(nil,true)
freezeT.Interval = 10000 --10 seconds
freezeT.OnTimer = freezeUnitHealth
end
local f = function()
writeDouble(healthAddr,100)
end
local fT = createTimer(freezeT,true)
fT.Interval = 50
fT.OnTimer = f
end |
_________________
I don't know where I'm going, but I'll figure it out when I get there. |
|
Back to top |
|
|
|