 |
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
mouser Advanced Cheater
Reputation: 0
Joined: 08 Mar 2015 Posts: 50
|
Posted: Mon Aug 01, 2016 2:36 pm Post subject: Activate and Deactivate soundfiles to table |
|
|
I'm currently playing the Metro 2033 games and using mgr.inz.Player's CT alongside it.
Which you can find here:
http://forum.cheatengine.org/viewtopic.php?p=5550291&sid=2e911d96430b242ffb529ef9e274468d
I was surprised to hear activation and deactivation sounds when enabling the different cheats, I think that's really awesome and useful.
I often lose track of what cheats I have already enabled and I have to tab out to look at the table to see what's the actual state (I'm a 1 monitor only scrub . With these sound cues I don't need to do this.
Now I want to this this for my own stuff too, as always though, I don't even know where to start. I can see from the table that there are lua scripts doing something, I don't know what and where and how to just replicate what he was doing there.
Can someone help me out with an example method/script on how I would be able to do the same?
|
|
Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Mon Aug 01, 2016 4:13 pm Post subject: |
|
|
Call
LuaCall( playSound(findTableFile([[godmode]]),true) )
LuaCall( playSound(findTableFile([[sndEnabled]])) )
on ENABLE
LuaCall( playSound(findTableFile([[godmode]]),true) )
LuaCall( playSound(findTableFile([[sndDisabled]])) )
on DISABLE.
Add sound files from Table>Add file. Done
_________________
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Mon Aug 01, 2016 4:48 pm Post subject: |
|
|
If you need different sounds for each cheat... I updated my method, it is more efficient than one I used in Metro cheat table.
I recommend those steps (should work with CE6.4, CE6.5, CE6.5.1):
1) prepare few mp3 files. If you can, use those audio codec settings: MPEG1 Layer III, 1channel, 160kbps, 22050Hz (if it is not a music, this should be enough)
audio files saying something like those:
"Activated" (or "Enabled")
"Deactivated" (or "Disabled")
"godmode"
"infinite armor"
"infinite ammo"
"infinite stamina"
etc.
I recommend using "Activated" and "Deactivated" sounds. So we don't need those:
"Activated godmode"
"Deactivated godmode"
"Activated infinite armor"
"Deactivated infinite armor"
"Activated infinite ammo""
"Deactivated infinite ammo"
"Activated infinite stamina"
"Deactivated infinite stamina"
etc.
As you see, 6 files versus 8 files. (We could use "infinite" as separate audio file, this will reduce CT size)
2) convert them to MP3RIFF (mp3 file inside RIFF container) with FFMPEG like this:
Code: | ffmpeg -i enable.mp3 -f wav -c:a copy enable.mp3riff |
Direct link: https://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-latest-win32-static.7z
Instructions:
- take ffmpeg.exe from 7zip archive, from "bin" folder. And place it inside folder where you have your mp3 files.
- Select the folder you want to open in the command prompt
- Right-click on it while holding the Shift key
- Select Open command window here
- (if your OS is below win7, open command prompt the other way, use google search)
Type in:
Code: | ffmpeg -i nameofyoursound.mp3 -f wav -c:a copy nameofyoursound.mp3riff |
I recommend using MP3RIFF extension so you will always know that those files are in fact mp3 files inside RIFF container.
Press ENTER. Do this for every mp3 file.
3) In CE, in main menu click "Table" -> "Add file". Add each mp3riff file.
4) Now, if you have main cheat (master cheat), add this block somewhere in ENABLE section:
Code: | {$lua}
sndFreeze = findTableFile('freeze.mp3riff')
sndHealth = findTableFile('health.mp3riff')
sndShield = findTableFile('shield.mp3riff')
sndFirstAmmo = findTableFile('firstAmmo.mp3riff')
sndSecondAmmo = findTableFile('secondAmmo.mp3riff')
sndUnfreeze = findTableFile('unfreeze.mp3riff')
{$asm} |
It will set few variables for us, so sounds will play few milliseconds earlier.
5) now for each individual cheat, place this somewhere in ENABLE section:
Code: | {$lua}
if syntaxcheck then return end
createNativeThread( function ()
playSound(sndFreeze, true)
playSound(sndHealth)
end)
{$asm} |
and this somewhere in DISABLE section:
Code: | {$lua}
if syntaxcheck then return end
createNativeThread( function ()
playSound(sndUnfreeze, true)
playSound(sndHealth)
end)
{$asm} |
5a) if you don't have master cheat, you will need something like this for each cheat:
this somewhere in ENABLE section:
Code: | {$lua}
if syntaxcheck then return end
createNativeThread( function ()
playSound(findTableFile('freeze.mp3riff'), true)
playSound(findTableFile('health.mp3riff'))
end)
{$asm} |
and this somewhere in DISABLE section:
Code: | {$lua}
if syntaxcheck then return end
createNativeThread( function ()
playSound(findTableFile('unfreeze.mp3riff'), true)
playSound(findTableFile('health.mp3riff'))
end)
{$asm} |
6) that's all
There is a lot to explain:
- first - {$Lua} - Lua blocks inside AutoAssemble script. Search/ask on CE forum.
- second - playSound function - it can play only wave files, and mp3 files encapsulated in riff container. I also wait till the first sound has stopped. See function description in lua documentation file (main.lua file inside CE directory)
- third - createNativeThread - I used it, so AA script will turn on immediately, and not after playing the first part (playSound(snd,true) will stop current thread till the end of sound). See lua documentation file.
_________________
|
|
Back to top |
|
 |
mouser Advanced Cheater
Reputation: 0
Joined: 08 Mar 2015 Posts: 50
|
Posted: Mon Aug 01, 2016 5:19 pm Post subject: |
|
|
Damn, thanks a lot guys, especially for the detailed guide mgr.inz.Player! I will try that tomorrow!
|
|
Back to top |
|
 |
mgr.inz.Player I post too much
Reputation: 222
Joined: 07 Nov 2008 Posts: 4438 Location: W kraju nad Wisla. UTC+01:00
|
Posted: Mon Aug 01, 2016 5:43 pm Post subject: |
|
|
PS: There is other method. When CE6.5.2 will come out, you can set individual sounds for each hotkey.
Well, it is possible with current version, CE6.5.1, but, unfortunately there is a bug. CE6.5.1 doesn't save hotkey sounds.
You have to edit CT file with text editor. Just place those nodes inside "Hotkey" node:
Code: | <ActivateSound>nameOfSoundFileAddedToTable</ActivateSound>
<DeactivateSound>nameOfAnotherSoundFileAddedToTable</DeactivateSound> |
Example, you have this:
Code: | <Hotkey>
<Action>Toggle Activation</Action>
<Keys>
<Key>115</Key>
</Keys>
<ID>0</ID>
</Hotkey> |
change it to this:
Code: | <Hotkey>
<Action>Toggle Activation</Action>
<Keys>
<Key>115</Key>
</Keys>
<ID>0</ID>
<ActivateSound>nameOfSoundFileAddedToTable</ActivateSound>
<DeactivateSound>nameOfAnotherSoundFileAddedToTable</DeactivateSound>
</Hotkey> |
But, when you open it with CE6.5.1 and then save, it will break again.
Better wait for CE6.5.2.
_________________
|
|
Back to top |
|
 |
|
|
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
|
|