View previous topic :: View next topic |
Author |
Message |
Bosparan Cheater
Reputation: 1
Joined: 30 Apr 2015 Posts: 36
|
Posted: Sat Jun 06, 2015 10:26 am Post subject: How to create conditional actions and mass value assignments |
|
|
Hi Guys,
I've been trying to figure out the two techniques described in the subject for some time now:
- How can I assign multiple values while having the user change a single one within CE?
- How can I perform conditional actions in the same context?
Example:
There are 80 Character slots in the RPG-H-Game Daibanchou. Not all of them are filled however - you may have any number of characters. Furthermore, this game has the nasty tendency to store enemies in some of the unused slots.
In this game your characters have a loyalty stat and maintaining it is a bit of a bother, so ... why not cheat it?
However, if I bulk set it to all 80 values (using the group option I could do that already) I assign values to unused character slots and increase the enemies' loyalty. That may not be all that harmful, but it ain't exactly tidy either.
So basically, In this example I want a way to check for each of these 80 entries, whether they are
a) 0
b) Belong to a hostile character
And only if neither is true, change the stat to the specified amount.
In the next step I'd really like to also freeze the values at the specified amount for each entry where conditions match, similar to how it is possible to do so for an individual (pointer-)address by checking it.
Is it possible to incorporate this into a CT file? If yes: How?
Cheers and thanks,
Bosparan
Ps.: Massive typing overhead for each of those 80 entries doesn't bother me much - I automate my CT-File generation using Windows PowerShell, so 10 or 80 doesn't make a difference, effortwise. |
|
Back to top |
|
 |
Geri Moderator
Reputation: 111
Joined: 05 Feb 2010 Posts: 5636
|
Posted: Sat Jun 06, 2015 10:32 am Post subject: |
|
|
Check out tutorials about the data dissector and conditional jumps. _________________
|
|
Back to top |
|
 |
Bosparan Cheater
Reputation: 1
Joined: 30 Apr 2015 Posts: 36
|
Posted: Sat Jun 06, 2015 10:56 am Post subject: |
|
|
Hi Geri,
thanks for the swift reply
Data Dissector
Thanks, but I already know where my data lies and what it represents.
Conditional Jumps
I tried it and probably could use them, however I have not found a way around two limitations:
a) Freeze or unfreeze values (Might be doable by (un-)toggling a replacement of the routines that write to the value, but especially in Daibanchou that can be very risky, I'd prefer not to).
b) It would be one fixed value (or at least I know no way how to pass a value the same way I can set the value of an address in CE). That would be acceptable in the specific example I used (by always specifying max loyalty), but in a general sense I really want to allow the user to choose the value to set to (without needing any of the skills that went into creating the table).
Cheers,
Bosparan |
|
Back to top |
|
 |
Gniarf Grandmaster Cheater Supreme
Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Sat Jun 06, 2015 6:41 pm Post subject: |
|
|
Now that we can put a lua script inside an auto assembler script it allows using lua in on/off toggle-able scripts. So you can have a script that when toggled on will display a message box asking the user for a value, then walk over all cheat records in your table and conditionally set the to a value. Something like that:
Code: | [enable]
{$lua}
local LOYALTY_TO_TEAMID_OFFSET=4; --team id is always XXX bytes after (the start of) loyalty
local CheatTable=getAddressList();
function IsFriendlyUnit(TeamID) --returns true if this unit belongs to the player
if(TeamID==0) then
return false;
--elseif (IsHostile(TeamID)) then --TODO fix this condition
elseif (TeamID==-1) then --for debugging
return false;
else
return true;
end
end
--display a dialog box
local DesiredLoyalty=inputQuery("Desired loyalty?", "What should we set loyalty to?", "10");
--loop over all records in our cheat table and set all those named "Loyalty" to
--the DesiredLoyalty if they belong to a friendly unit.
for i=0,CheatTable.Count-1 do
local CurrentMemRec=CheatTable.getMemoryRecord(i);
if (CurrentMemRec.Description=="Loyalty") then
if (IsFriendlyUnit(readInteger(getAddress(CurrentMemRec.Address)+LOYALTY_TO_TEAMID_OFFSET))) then
CurrentMemRec.Value=DesiredLoyalty;
end
end
end
{$asm}
[disable]
{$lua}
-- put here what to do when disabling this option
{$asm}
|
PS: lua documentation in %ProgramFiles(x86)%\Cheat Engine 6.4\main.lua _________________
DO NOT PM me if you want help on making/fixing/using a hack. |
|
Back to top |
|
 |
Bosparan Cheater
Reputation: 1
Joined: 30 Apr 2015 Posts: 36
|
Posted: Sat Jun 06, 2015 7:13 pm Post subject: |
|
|
Hi Gniarf,
Awesome!
Thanks for the example, just what I was looking for. With that I can take it from there and get it done.
Cheers,
Bosparan |
|
Back to top |
|
 |
|