1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Making a loader mod to change variables in action script

Discussion in 'Help' started by Shadow7988, Jul 2, 2012.

  1. Shadow7988

    Shadow7988 Potential Patron

    Joined:
    Jun 29, 2012
    Messages:
    6
    Likes Received:
    0
    I'm a bit confused as to how I'm supposed to go about this. I've gotten the source code and found the values I wanna mess with, but I'm also rather new to Flash, and using a swf decompiler to actually mess with the .fla is...daunting. I just want to make a loader mod that changes a few variables around, nothing too advanced. The art-side stuff is pretty straight forward, but how would I go about pulling this off?
     
  2. anonymous

    anonymous Club Regular

    Joined:
    Feb 16, 2011
    Messages:
    2,926
    Likes Received:
    10
    why are you using a swf decompiler? Just use Faceless' template and modify what you want. I believe Modguy's Loader forces all variables to be public, so you can change them via a Loader Mod.

    I'm sure Moddame will comment on this eventually.
     
  3. Shadow7988

    Shadow7988 Potential Patron

    Joined:
    Jun 29, 2012
    Messages:
    6
    Likes Received:
    0
    I'm assuming you're referring to the mod.fla up in the loader section, right? I've got it open now, but for the life of me I can't seem to figure out how to actually get to the action script for it! Darn adobe makes my head spin. Things always seemed more straight forward messing with stuff like Maya.

    Edit: Nevermind, I'm an idiot and found out how to access it. Reading is fundamental, as my Mother used to say. Alright, so say I want to tell this thing to change one of the variables in the game, how would I go about doing that? Something along the lines of setmaxBreastScale:Number=1.100 ?
     
  4. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    21
    Find where a variable is being declared, for example class "g".
    Use a loader reference to the class if it exists, "main.g" or target the class using the application domain:
    Code:
    main.eDOM.getDefinition("g");
    This gives us the class "g" from which our target variable is accessible.
    Using an object reference such as:

    Code:
    var g = main.eDOM.getDefinition("g");
    We now have a local object through which to access the variable.
    From here on out we just change values assuming that they've been made public.

    Code:
    g.VARIABLE = VALUE
    This code hasn't been tested but should be more or less what you're after.
     
  5. Shadow7988

    Shadow7988 Potential Patron

    Joined:
    Jun 29, 2012
    Messages:
    6
    Likes Received:
    0
    Thanks! That's pretty much what I was looking for! I'll screw around with it later today and try out some funky stuff.
     
  6. Shadow7988

    Shadow7988 Potential Patron

    Joined:
    Jun 29, 2012
    Messages:
    6
    Likes Received:
    0
    So I'm trying to mess with the 'Her' class, but there seems to be no effect. Maybe I'm doing it wrong?

    Code:
    main.Her.getDefinition("Her");
    	var Her = main.Her.getDefinition("Her");
    	Her.maxBreastScale = 1.30;
     
  7. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    21
    Code:
    main.eDOM.getDefinition
    Although a main.her object already exists.
     
  8. Shadow7988

    Shadow7988 Potential Patron

    Joined:
    Jun 29, 2012
    Messages:
    6
    Likes Received:
    0
    Ok, I see, so the first part isn't even really necessary, right? I'm not sure what I'm messing up, though. Even if I did something redundant such as defining something that's already there, wouldn't it work anyway?
     
  9. ModGuy

    ModGuy Club Regular Content Creator

    Joined:
    Feb 17, 2011
    Messages:
    1,754
    Likes Received:
    21
    Thing is you're not redefining it at all:

    Code:
    main.Her.getDefinition("Her");
    	var Her = main.Her.getDefinition("Her");
    	Her.maxBreastScale = 1.30;
    For a start, the first line isn't doing anything so you should get rid of it.
    Second line should replace ".Her" with ".eDOM" otherwise it will just crash.
    Third line should work with those fixes.
    Although you really only need the last line using "main.her.blah=value"

    Even then that only increases the max scale without actually setting the current scale value so it does nothing anyway.