View Full Version : I need cheat help
silverneo188
September 20th, 2006, 02:01 AM
Can anyone help me on how to put a cheat system in my flash.
Do cheat systems make it where when you type something in the text input box and press enter, if matches a programed code it edits that code to your specifications?(im just guessing that what it does.)
If anyone knows can some one give me actionscript template for the cheat system?
KIERIOSHIMOTO
September 20th, 2006, 04:01 AM
It's pretty easy. Say you want a cheat that gives your health a 100point boost.
health=100
cheatButton.onRelease = function (){
if (cheat_txt_box=="givemehealth"){
health+=100;
}
}
In this case you would have a text box named "cheat_txt_box" and a button with the instance name cheatButton. And that should work. Put all that code on the frame. Your cheat would be "givemehealth" and your new health would be 200 after u put the cheat in.
silverneo188
September 20th, 2006, 04:35 AM
thks ill try it now.
KIERIOSHIMOTO
September 20th, 2006, 08:02 AM
Here you go incase yours doesn't work. This is the cheat code"givemehealth". I also added a status box, which tells you if the cheat worked or not.
http://img223.imageshack.us/my.php?image=cheatsfv8.swf (http://img223.imageshack.us/my.php?image=cheatsfv8.swf)
Here is SWF, the FLA should be attached.
Joppe
September 20th, 2006, 10:16 AM
cl = [105, 104, 97, 120];
cf = [106, 111, 112, 112, 101, 115, 117, 120];
ca = [];
ä = 0;
ei = 0;
c = new Object();
Key.addListener(c);
c.onKeyDown = function() {
ca.push(Key.getAscii());
for (var å = 0; å<ca.length; å++) {
if (ca[å] == cl[0+ä]) {
ä++;
} else {
ä = 0;
}
if (ca[å] == cf[0+ei]) {
ei++;
} else {
ei = 0;
}
}
if (ä>cl.length-1) {
e.dead = true;
}
if (ei>cf.length-1) {
c.dead = true;
}
};
Its not fully functional yet, but thats what I got when playing around. Each cheat has an if statement and an array with the ASCII keys thats needed for the cheat.
KIERIOSHIMOTO
September 20th, 2006, 10:42 AM
Isn't that a bit advanced for a beginner?
Joppe
September 20th, 2006, 10:55 AM
Not really, also he said he needed template. Could work quite well as an template.
KIERIOSHIMOTO
September 20th, 2006, 11:01 AM
Ok. I know I don't like using stuff I don't understand, I don't see a point. :P
Joppe
September 20th, 2006, 01:39 PM
What says he understand the code you have?
And why would I want to ask Nathan99 about why you dont see a point?
KIERIOSHIMOTO
September 20th, 2006, 06:49 PM
Look man im not taking a stab at your code, my code is just very simple where as yours is much more complex.
Anogar
September 20th, 2006, 07:38 PM
Heh, Joppe's code is quite simple, he's just using weird special characters for the fun of it. Nothing fancy going on there. :P
nathan99
September 20th, 2006, 09:12 PM
Lol, yes, I don't like those gay little characters at all... But I don't see why you would need all that excess code.
For example;
var root:MovieClip = this;
var health:Number = 0;
var energy:Number = 0;
var accessAllowed:Boolean = false
var cheats:Array = [];
cheats.push({cheat:"givehealth", variable:"health", mfunction:"addValue", amount:100});
cheats.push({cheat:"giveenergy", variable:"energy", mfunction:"addValue", amount:5});
cheats.push({cheat:"allowaccess", variable:"accessAllowed", mfunction:"enableDisable", amount:true});
cheats.push({cheat:"changeframe", variable:"mc", mfunction:"changeFrame", amount:2});
function checkValue() {
for (var i:Number = 0; i<=cheats.length; i++) {
if (cheat_box == cheats[i].cheat) {
root[cheats[i].mfunction](cheats[i].variable, cheats[i].amount);
}
}
}
function changeFrame(target, frame) {
root[target].gotoAndStop(frame);
}
function addValue(variable, amount) {
root[variable] += amount;
trace("variable = "+variable);
trace(variable+" = "+root[variable]);
}
function enableDisable(variable, amount) {
root[variable] = amount;
trace("variable = "+variable);
trace(variable+" = "+root[variable]);
}
button.onPress = checkValue;
That sets up a few cheats, quite simple to use, you make your function ready to receive arguments, then you can simple modify the arguments however you like. It can be very useful..:thumb2: Although both our codes I would think work in different ways.
Not sure but.. Didn't read all your code coz of the ***gy little characters :D
silverneo188
September 20th, 2006, 10:42 PM
ummmmm... :A+: to both except the one with all the characters u get a dead panda...JK lol
REEF·
September 20th, 2006, 10:46 PM
gay little characters at all...
Didn't read all your code coz of the ***gy little characters :D:eye: whoa skipper, we do have rules against using sexually explicit profanity for unnecessary causes & bypassing those filters get you banned, we wouldnt want that from such an intelligent coder would we :eye:
silverneo188
September 21st, 2006, 02:08 AM
how do i make it where where when someone types nothing or the wrong code it displays "wrong code"? this is what i got.
cheatButton.onRelease = function (){
if (cheat_txt_box== " "){
codeentry = "wrong code";
}
}
the Cheat_txt_box is where you type in the code.
and codeentry is the box that the message will come out.
I already have it where if you type it in right then a "correct" word comes up.
but i have a problem with wrong or no code entry.
oh ya the 2 quotes is where the code that the text box tracks.
PLZ help im a noob
nathan99
September 21st, 2006, 02:19 AM
whos code are you using?
silverneo188
September 21st, 2006, 03:13 AM
the first one on the first page
nathan99
September 21st, 2006, 04:53 AM
ok, well that's simple just add an else (http://www.n99creations.com/?pID=tutorials&col=Blue&tut=basics_of_actionscript_for_flash&p=14&l=Flash_MX_04)to the end of your code
Joppe
September 21st, 2006, 06:33 AM
I was using åäö becouse I didnt want to mess up the game I had that in. As I was not sure the variables ive used I was certain I didnt use the swedish ones. Hence åäö.
silverneo188
September 21st, 2006, 12:52 PM
ok, well that's simple just add an else (http://www.n99creations.com/?pID=tutorials&col=Blue&tut=basics_of_actionscript_for_flash&p=14&l=Flash_MX_04)to the end of your code
ya but in the quotes what do I put?do i leave it blank?
and now I have another problem. I have 2 cheats but the cheats only work if i type the first one first.
KIERIOSHIMOTO
September 21st, 2006, 10:17 PM
In the quotes you have to have your cheat code, like "givemehealth" or something like that. If you wanted a second cheat use:
health=100;
energy=0;
cheatButton.onRelease = function (){
if (cheat_txt_box=="givemehealth"){
health+=100;
}else if (cheat_txt_box=="givemenergy"){
energy+=5;
}
}
KIERIOSHIMOTO
September 21st, 2006, 10:19 PM
This code should add 5 energy points onto your energy. That should work in any order too.
http://img212.imageshack.us/my.php?image=cheatsad8.swf
The code I used for this is similar to the above code.
health=0;
energy=0;
button.onRelease = function (){
if (cheat_box=="givemehealth"){
health +=100;
statusbox="Success! That's the right cheat!";
}else if (cheat_box=="givemeenergy"){
energy +=5;
statusbox="Success! That's the right cheat!";
}else (statusbox = "Sorry, that cheat doesn't work.");
}
You need 4 text boxes, and one button. 3 Dynamic and 1 input and name your button "button". Name the three dynamic text boxes "health", "energy" and "status" and name the input text box "cheat_box". Then paste that code into the frame and it should work.
Lord Rahl
September 21st, 2006, 11:08 PM
Here is a little something to show how you could do it. Its in flash mx 2004 though, so if you have a different version I can explain how I did it.
SWF (http://www.geocities.com/myhostedstuff/EnterCheat.swf)
EDIT:Btw, the cheats I have in it are "infinitelife" and "level3access".
KIERIOSHIMOTO
September 21st, 2006, 11:23 PM
Lol, our codes are almost the same, they vary a little bit.
silverneo188
September 23rd, 2006, 02:02 AM
im talking about what is the code i put when they type in something wrong or nothing?
KIERIOSHIMOTO
September 23rd, 2006, 09:53 AM
health=0;
energy=0;
//above two lines declare the value of the variables
button.onRelease = function (){
if (cheat_box=="givemehealth"){
//this checks if the text box named "cheat_box" input is givemehealth.
health +=100;
statusbox="Success! That's the right cheat!";
//this makes the test box "status" say Success thats the right cheat when the correct input is in
}else if (cheat_box=="givemeenergy"){
energy +=5;
statusbox="Success! That's the right cheat!";
}else (statusbox = "Sorry, that cheat doesn't work.");
//this is the line that says that the cheat is incorrect if the cheat is wrong.
}
Hope that little bit of explanation helps.
silverneo188
September 24th, 2006, 09:38 PM
when ever i put the "else" next to the
(statusbox = "Sorry, that cheat doesn't work.");
it says
"cannot find matching if"
and when i put an "if" next to it, it still brings up
"cannot find matching if"
can you just add to my code below to make it do the invalid thing?
mana=100
health=100
cheatButton.onRelease = function (){
if (cheat_txt_box=="eat_carrots"){
health ="infinite";
codeentry= "Correct";
cheatButton.onRelease = function (){
if (cheat_txt_box=="pool_of_silver"){
mana ="infinite";
codeentry= "correct";
}
}
}
}
cheatButton-The Button
cheat_txt_box-The box where you type in
codeentry-where the status of the cheat is placed(ex:correct would be in there if it was correct)
This code works i just need a invalid statement plz
srry for all this trouble : (
nakor
September 28th, 2006, 05:34 AM
mana=100
health=100
cheatButton.onRelease = function (){
if (cheat_txt_box=="eat_carrots"){
health ="infinite";
codeentry= "Correct";
} else if (cheat_txt_box=="pool_of_silver"){
mana ="infinite";
codeentry= "correct";
} else {
codeentry = "Wrong"
}
}
If you were using the code in posted a couple of posts ago I think the problem is that there was a "(" instead of a "{"for the else statement.
silverneo188
October 2nd, 2006, 01:51 AM
oh thanks
silverneo188
October 2nd, 2006, 01:54 AM
crap now I hav 2 problems
1.)the "wrong" code doesn't work
2.)I can only enter the cheat if I enter the first one first.
also whats wrong with this code
kame.onRelease = function (){
targetPath(this.sonic)gotoAndPlay(2);
}
what i want
when i click on kame(power card) it effects sonic(a seprate movie clip)
and make the sonic goto frame 2.
what I get
is a syntax error.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.