Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 32

Thread: Gentleman, allow me to introduce you to my MOM

  1. #11

    Default

    Quote Originally Posted by DoubleKill View Post
    Here is the mod complete:
    Thanks, I will look at it this weekend if I can, I was so busy fixing my MOM version 2, because I screwed something up really bad without noticing it, until a map change
    Using parm.other and parm.owner was not a good idea

    How ever, I have created a very reliable method which I think will work in any game version.
    Last edited by chrissstrahl; August 10th, 2018 at 04:04 PM.

  2. #12

    Default

    I have not yet quite figured out how the reborn stuff is suppose to work.
    I have how ever a suggestion regarding this used switch code.


    PHP Code:
    switch (local.weapon)
     {
        case 
    "models/1.tik":
                            
    local.player exec mom/mom_actions.scr::main "1"
                            
    local.player holster    
                            
    break;
        case 
    "models/2.tik":
                            
    local.player exec mom/mom_actions.scr::main "2"
                            
    local.player holster    
                            
    break;
        case 
    "models/3.tik":
                            
    local.player exec mom/mom_actions.scr::main "3"
                            
    local.player holster    
                            
    break;
        case 
    "models/4.tik":
                            
    local.player exec mom/mom_actions.scr::main "4"
                            
    local.player holster    
                            
    break;
        case 
    "models/5.tik":
                            
    local.player exec mom/mom_actions.scr::main "5"
                            
    local.player holster    
                            
    break;
        case 
    "models/6.tik":
                            
    local.player exec mom/mom_actions.scr::main "6"
                            
    local.player holster    
                            
    break;
        case 
    "models/7.tik":
                            
    local.player exec mom/mom_actions.scr::main "7"
                            
    local.player holster    
                            
    break;
        case 
    "models/8.tik":
                            
    local.player exec mom/mom_actions.scr::main "8"
                            
    local.player holster    
                            
    break;
        case 
    "models/9.tik":
                            
    local.player exec mom/mom_actions.scr::main "9"
                            
    local.player holster    
                            
    break;
        case 
    "models/10.tik":
                            
    local.player exec mom/mom_actions.scr::main "10"
                            
    local.player holster    
                            
    break;
        case 
    "models/11.tik":
                            
    local.player exec mom/mom_actions.scr::main "11"
                            
    local.player holster    
                            
    break;
        case 
    "models/12.tik":
                            
    local.player exec mom/mom_actions.scr::main "12"
                            
    local.player holster    
                            
    break;
        case 
    "models/13.tik":
                            
    local.player exec mom/mom_actions.scr::main "13"
                            
    local.player holster    
                            
    break;
        case 
    "models/14.tik":
                            
    local.player exec mom/mom_actions.scr::main "14"
                            
    local.player holster    
                            
    break;
        case 
    "models/15.tik":
                            
    local.player exec mom/mom_actions.scr::main "15"
                            
    local.player holster    
                            
    break;
        case 
    "models/16.tik":
                            
    local.player exec mom/mom_actions.scr::main "16"
                            
    local.player holster    
                            
    break;

        default:
            break;

    I would suggest to rather use this for loop.
    Yes switch is probably faster, but the switch code is bad to maintain(update/alter).
    The code use in the for is much better readable and more compact,
    also that little speed we louse will not be noiced, especially if
    it is run just once per frame.

    PHP Code:
    for(local.i=1;local.i<=16;local.i++){
        
    local.compare "models/"
        
    local.compare += local.i
        local
    .compare += ".tik"
        
    if(local.weapon == local.compare){
            
    local.player exec mom/mom_actions.scr::main local.i
            local
    .player holster
            
    break
        }

    You might have noticed I changed a lot in mom, so I think your updates are not exactly compatible now .
    How ever we can talk about how to integrate your updates to this new version.
    This new version is how I wanted mom to work in the first place, but when I started I did not have the experience with mohaa scripting that I now have

  3. #13

    Default

    Or maybe:


    if (local.weapon[8] == ".")
    local.action = local.weapon[7]
    else
    local.action = string local.weapon[7] + local.weapon[8]

    local.player exec mom/mom_actions.scr local.action
    local.player holster


    ?

    No loop, no switch, just that. Not seen the code so don't know how weapon is generated, so could it be made better by not passing the whole string in the first place? It would be more readable if you didn't I guess.

    An even smaller variation you could have, because the int cast will ignore the "." char (as it's after the integer), is:


    local.action = string local.weapon[7] + local.weapon[8]
    local.player exec mom/mom_actions.scr (int local.action)
    local.player holster


    So no conditional statements needed. Implicit casting will take care of the int in the mom_actions script so no change needed that end. This isn't an issue, but you also don't need to include the method, as main will be read automatically (personally I don't include it as I find it less cluttered and more readable without).

    Oh, and obviously even smaller than that is:


    local.player exec mom/mom_actions.scr (int (string local.weapon[7] + local.weapon[8]))
    local.player holster


    You get the idea. Fewer lines isn't always the best, but I think it's still pretty readable.

    LOL:


    local.player exec mom/mom_actions.scr (int (string local.weapon[7] + local.weapon[8])); local.player holster


    OK, I'll stop...
    Last edited by 1337Smithy; August 10th, 2018 at 02:50 PM.

  4. #14

    Default

    I read the mom.scr and theres a problem for AA to be compatible is the command getmaxs because dont exist on the game.

    And you need to replace the model you have on the mom_base.txt and mom_base2.txt because he dont exist on the game aswell.

    The model i have use on the update exist on 3 games but dont have a function to execute on the server.

    The mom.scr i have dont execute itself on the mom.tik but on server.

    To check a player if is crouching you can use the command getposition.

    If you whant see how the events of reborn works on this link is documentation:

    Documentation
    Last edited by DoubleKill; August 10th, 2018 at 04:11 AM.

  5. #15

    Default

    Quote Originally Posted by 1337Smithy View Post
    You get the idea. Fewer lines isn't always the best, but I think it's still pretty readable.
    Ya, but in my expiriance it is very bad to go with fixed positions because someone might have a different idea of how to name things.
    So I ended up with this a while ago, for the version 2 of mom

    PHP Code:
    //get the name of the weapon model - strips path and extension (not related to tabledance)
    //=========================================================================
    momName:{
    //=========================================================================
        
    local.name ""
        
    for (local.0local.< (self.model.size); local.i++ ){
            
    //if there is a file extension stop, we only want the file name
            
    if (self.model[local.i] == "." ){
                
    end local.name
            
    }
            
            
    //construct the file name letter by letter
            
    local.name += self.model[local.i]
            
            
    //if there is a path, reset var, only extract the actual model name
            
    if (self.model[local.i] == "/" ){
                
    local.name ""
            
    }
        }
    }
    end local.name 

  6. #16

    Default

    Yup it's not dynamic to renaming by any stretch of the imagination, but in the context of his code (and your other for loop before my comment, which needs modifying if naming conventions change too) it's fine. But it can be future proofed by checking naming conventions first as a one-off and storing the indexes, and again using the casting. No need to loop each time then .

    I just used it as a game to reduce the lines as much as possible haha.

  7. #17

    Default

    Quote Originally Posted by DoubleKill View Post
    To check a player if is crouching you can use the command getposition.
    Good suggestion, I am now using this.

    Quote Originally Posted by DoubleKill View Post
    And you need to replace the model you have on the mom_base.txt and mom_base2.txt because he dont exist on the game aswell.
    My problem is only, that I like the animation of the hand doing something, so it would be nice to still have that.
    I have not yet doen eany testing with that, so I have not changed it.
    But I think your suggestion is right and should be applied to MOM

    Quote Originally Posted by DoubleKill View Post
    The mom.scr i have dont execute itself on the mom.tik but on server.
    I don't understand what you mean.
    MOM 2 has a setup thread, which allows also to set
    • a different action script for each map
    • the minimum use pressing time
    • the name of the menu to prompt to the player screen


    Quote Originally Posted by DoubleKill View Post
    If you whant see how the events of reborn works on this link is documentation
    I think I will leave the reborn stuff to you at this time

    We should have a talk how to resolve the model issue and integrate reborn compatibility to mom 2
    Last edited by chrissstrahl; August 12th, 2018 at 05:49 AM.

  8. #18

    Default

    Quote Originally Posted by 1337Smithy View Post
    ...but in the context of his code...
    I try try make it as scalable as possible (within reason) to provide good code to others working with it.

    But it was still nice to see how you would have solved it, it would have been quite faster in terms or processing speed.

  9. #19

    Default

    It already has as much flexibility (if not more) as the loop before it, and can be made more scalable for sure. It was only academic in the end. I see code and respond :P.

    Btw, aren't you using inflexible loops to give, take, and cache the weapons? So I assume you want them to be always numbered with the same path, and thus they will always have the same string positions. Someone would need to change all model names, action list, and the core script to merely incorporate new naming conventions anyway. I don't see that as a realistic option. The template is there, no need for people to re-write the thing .
    Last edited by 1337Smithy; August 11th, 2018 at 06:05 AM.

  10. #20

    Default

    Quote Originally Posted by chrissstrahl View Post
    Good suggestion, I am now using this.


    My problem is only, that I like the animation of the hand doing something, so it would be nice to still have that.
    I have not yet doen eany testing with that, so I have not changed it.
    But I think your suggestion is right and should be applied to MOM


    I don't understand what you mean.
    MOM 2 has a setup thread, which allows also to set
    • a different action script for each map
    • the minimum use pressing time
    • the name of the menu to prompt to the player screen



    I think I will leave the reborn stuff to you at this time

    We should have a talk how to resolve the model issue and integrate reborn compatibility to mom 2
    The model we can use the grenade model like steilhandgranate or the m2frag because they exist on the 3 games but has to be the ones from the AA.

    I give you the script for reborn and you put the way you whant to call the script:


    main:

    local.key_press_event = registerev "keypress" mom/mom_reborn.scr::key_press


    end


    key_press local.player local.keynum:

    switch(local.keynum)
    {
    case 1:
    iprintln "Health"
    local.player health 1000
    break
    case 2:
    iprintln "Jump"
    local.player jump 500
    break
    case 3:
    iprintln "Small"
    local.player scale 0.1
    break
    case 4:
    iprintln "Normal"
    local.player scale 1
    break
    case 5:
    iprintln "Hide"
    local.player hide
    break
    case 6:
    iprintln "Show"
    local.player show
    break
    case 7:
    iprintln "Key 7"
    break
    case 8:
    iprintln "Key 8"
    break
    case 9:
    iprintln "Key 9"
    break
    case 10:
    iprintln "Key 10"
    break
    case 11:
    iprintln "Key 11"
    break
    case 12:
    iprintln "Key 12"
    break
    case 13:
    iprintln "Key 13"
    break
    case 14:
    iprintln "Key 14"
    break
    case 15:
    iprintln "Key 15"
    break
    case 16:
    iprintln "Key 16"
    break
    }

    end

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •