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

Help with mod coding, is this feasible?

Discussion in 'Help' started by colin, Jun 4, 2016.

  1. colin

    colin Avid Affiliate Content Creator

    Joined:
    Apr 11, 2016
    Messages:
    59
    Likes Received:
    22
    Hey, Just started trying to create/alter some mods (codewise), in particular I was trying to add a dialogue trigger that would cause the animation to hold in place (rather than pause the game or turn off automatic control). Later I would like to add triggers to pull down to some level (basically equivalent to moving the mouse to certain points on the screen) to make it easier to set up scripted dialogues without HOPING the auto settings will do what you want (and not have the guy pull out and she continues to think that he is choking her for example.)

    From what I can see, the auto modes are coded into the loader itself, so I am not sure if there is a way to alter them without altering the loader source and recompiling it. Is this the case, or is there a method of extending a class in pre-compiled code that my lack of AS experience prevents me from recognizing?

    Feel free to tell me this would be too much trouble to explain/just not reasonable to do.
     
  2. stuntcock

    stuntcock Club Regular Staff Member Moderator

    Joined:
    Jun 5, 2012
    Messages:
    1,511
    Likes Received:
    352
    Nitpick: they aren't hardcoded into Loader.swf. They're hardcoded into SDT.swf.

    This is a trivial operation; almost every mod does it. AS3 is incredibly lax about data-hiding. You can extend an object at runtime. Extending a class is also possible, but it's rarely necessary -- most of the important SDT classes (e.g. Her, Him, InGameMenu) get instantiated only once. So you can just grab that one instance (e.g. g.her) and mess around with it directly (e.g. g.her.visible = false; ).

    Strands actually do get generated during gameplay, so it's sometimes appropriate to extend those classes instead of tinkering with each instance.

    Using Loader modding techniques is preferred, because if you directly replace a function (or kill an instance variable) then your mod may suffer compatibility problems with other mods. @ModGuy's lProxy technique allows us to temporarily hook the native function calls and add "Pre" or "Post" functions which will react whenever those functions are invoked.

    Go here. Talk to @Pim_gd.

    It's been proposed before. Talk to @Pim_gd.

    They're defined in memory structures (obj.AutomaticControl). They can be edited using brute-force memory intrusion, or more subtly via Loader modding techniques. Recompilation of the SWF file is not necessary.

    The key question is how disruptive you're willing to be. For instance: you could completely replace the Hard auto mode with an instruction such as "goto penetration depth 30, oscillate ±0 units". This would constitute an indefinite "hold" action. Then you'd simply use the standard dialog trigger to switch to Hard mode when you want to hold that particular depth ... and then switch back to Normal mode when it's narratively appropriate (e.g. after speaking the next six lines).

    The downside would be that the game state would be damaged by your modding activity. If the user gets bored with your mod, then they'll need to restart the game completely in order to restore the Hard auto mode to its normal functionality. The other downside is that completely replacing the auto modes leaves you with a maximum of 4 custom settings - which may be insufficient for your narrative.

    It would be more prudent to write some custom code, in order to add a new temporary Auto mode option instead of replacing any of the existing ones. You'd then need some new fancy syntax in your Dialogue file which would define this custom mode, establish timing, and switch to/from the custom mode when appropriate.

    But this is all moot unless you can either convince @Pim_gd to add your requested feature - or learn AS3 and do it yourself (note: the code for the dialogueActions mod is shared on a public repo).

    Edit - @ModGuy provided some sample code to add new customized Auto modes. This approach assumes that you're writing a Loader mod; it isn't useful if you're just hoping to add an invocation line to your Dialogue file. But it's the sort of thing which you might conceivably add to the dialogueActions codebase in order to fulfill your requirements.
     
    Last edited: Jun 5, 2016
  3. colin

    colin Avid Affiliate Content Creator

    Joined:
    Apr 11, 2016
    Messages:
    59
    Likes Received:
    22
    Thank you for the quick response. I have been messing around with the dialogueActions source code, but with the knowledge of AS3 I currently possess, I am having trouble figuring out how get some stuff working. I will see if Pim_gd has some advice, but with the small amount of effort I have put in so far asking him to do a lot of teaching would be a bit much I think, lol.
     
  4. colin

    colin Avid Affiliate Content Creator

    Joined:
    Apr 11, 2016
    Messages:
    59
    Likes Received:
    22
    Posted an alpha version, still pretty rough. I have two things I need in order to complete my set of triggers which I am having trouble figuring out. The first is: Is there a fast easy way to switch off the automatic pull off?
    The second is: is there a good way to convert available values of penis length to the units used in main.g.currentPos?
     
  5. stuntcock

    stuntcock Club Regular Staff Member Moderator

    Joined:
    Jun 5, 2012
    Messages:
    1,511
    Likes Received:
    352
    Loader.swf::MainTimeline.performShortcut(), line 1329. You'll probably want to check the l.holdDown status before toggling it -- just in case the player has already activated Auto Hold on their own initiative.

    Do you mean penis slider values? They aren't really comparable.

    g.currentPos is the mouse pointer position (global units IIRC). During automatic control, g.currentPos gets oscillated back and forth by code.

    You could invoke the localToGlobal function on the penis object to get a global position, but it's going to be messy. And it will probably involve a lot of hardcoded literals. I think that the tip of the penis is (-325,0) while the actual origin point (0,0) refers to the junction of the penis with the guy's torso.

    There may be an easier way to achieve your goal without hardcoding a bunch of coordinates into your mod files. Could you please describe your current difficulties (or objectives) in greater detail?
     
  6. colin

    colin Avid Affiliate Content Creator

    Joined:
    Apr 11, 2016
    Messages:
    59
    Likes Received:
    22
    The idea was to add triggers that would set a position/oscillation at certain depths RELATIVE to the penis, i.e. going between tip and hilt, throat and hilt, tip and throat etc without the dialogue writer having to experiment to find the exact values that will work for a given size.

    The idea was if, say, the dialogue used [AUTO_CUSTOM_TIP_HILT_20] the mod would calculate the center point between tip and hilt along with half the length, she would move tip->hilt->tip repeat every 20 frames.

    This RESULT is completely possible with the code I already have, but it requires the dialogue writer to figure out the exact coordinates for that penis length and hard code them into the dialogue rather than just calling for the effect with a speed and letting the mod do the work.

    In other words, you can pretty much do everything I intend to add already, I just wanted to add additional commands to allow use with less effort.
     
    NoctSoul and lemurian-seed like this.