Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


How to create conditional actions and mass value assignments

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking
View previous topic :: View next topic  
Author Message
Bosparan
Cheater
Reputation: 1

Joined: 30 Apr 2015
Posts: 36

PostPosted: Sat Jun 06, 2015 10:26 am    Post subject: How to create conditional actions and mass value assignments Reply with quote

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
View user's profile Send private message
Geri
Moderator
Reputation: 109

Joined: 05 Feb 2010
Posts: 5636

PostPosted: Sat Jun 06, 2015 10:32 am    Post subject: Reply with quote

Check out tutorials about the data dissector and conditional jumps.
_________________
My trainers can be found here: http://www.szemelyesintegracio.hu/cheats

If you are interested in any of my crappy articles/tutorials about CE and game hacking, you can find them here:
http://www.szemelyesintegracio.hu/cheats/41-game-hacking-articles

Don't request cheats or updates.
Back to top
View user's profile Send private message
Bosparan
Cheater
Reputation: 1

Joined: 30 Apr 2015
Posts: 36

PostPosted: Sat Jun 06, 2015 10:56 am    Post subject: Reply with quote

Hi Geri,

thanks for the swift reply Smile

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
View user's profile Send private message
Gniarf
Grandmaster Cheater Supreme
Reputation: 42

Joined: 12 Mar 2012
Posts: 1283

PostPosted: Sat Jun 06, 2015 6:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
Bosparan
Cheater
Reputation: 1

Joined: 30 Apr 2015
Posts: 36

PostPosted: Sat Jun 06, 2015 7:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General Gamehacking All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites