Weapon_Ammo_Type proto

Discussion in 'General Modification' started by WinstonShnozwick, Sep 9, 2019.

Remove all ads!
  1. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    How does the Weapon Ammo Type proto field work? I.E. where do the values it has come from? There are things like arrow, bolt, ball_of_fire, bottle, dart, shuriken, javelin, spear, etc available in world builder. Where do these strings come from? I think they come from the projectile protos defined starting at 3000, but I don't see in any files where the association to those projectiles from the strings populating the Weapon Ammo Type field is made.

    I checked out the projectile protos and they are fairly simple, so I defined my own. I want to be able to associate my new projectile to be used as the Weapon Ammo Type in a weapon. How could I expand the ammo types so new values in the proto id are recognized in game?

    AFAIK some of the ammo types were not in the vanilla game, so someone at Co8 could have added them and knows this?
     
  2. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Update:
    I can even modify one of the protos, for example the throwing axe one (3011), to change its meshID to a different weapon, and when I use throwing_axe as the Weapon Ammo Type, the thrown weapon looks like the meshID of the weapon I specified. So I can definitely make it look like any kind of weapon is throwable. However I don't want to take the existing ammo types because obviously throwing axe is in use, so I need the game to recognize my new type.
     
  3. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    Just make new proto's for the weapon types you need, assign the throwing_axe property to it, and make the mesh I'd whatever you need for that weapon. AFAIK the only other example of a thrown weapon in that field is "dagger" which always results in a dagger animation when thrown regardless of the mesh ID used.
     
  4. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    That does not work. I have the new weapon proto (which I want to be throwable), and giving it the throwing_axe property shows a different projectile, not the mesh of the weapon I'm throwing, when I throw it.
     
  5. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    From my testing the throwing axe property was not tied to a specific weapon model, instead you could assign any weapon model and it would display that weapon model when the weapon was thrown.
     
  6. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    To clarify, what exactly did you do that made it work? Here is what I have. Proto in image 1 that I have. I gave it a range and the throwing_axe ammo type, and that allowed it to be thrown in game. I do not see the mesh of my weapon proto when I throw it.
     

    Attached Files:

  7. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    I'm not at my desk right now, so I can't check right away, but I'll make an effort to double check my claim when I am able to, though I am certain it has been discussed on these forums previously, perhaps a search will turn up the info you require quicker.
     
  8. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    The default ammo types that may be selected are:
    arrow
    ball_of_fire
    bolt
    bottle
    bullet
    club
    dagger
    dart
    halfling_sai
    javelin
    light_hammer
    magic_missile
    shortspear
    shuriken
    spear
    throwing_axe
    trident

    These all correspond to the ammo type protos.tab entries - proto numbers in the 3000+ number range. If you want a new thrown weapon animation, you will need to somehow add a new weapon model to protos.tab in the 3000+ number range.

    My preliminary test of adding a thrown greatsword animation failed however so perhaps I'm missing something, but you could certainly add the ammo type most resembling the weapon you are throwing from the list above in the mean time.
     
    Last edited: Sep 11, 2019
  9. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Yes, I did this and that's where the OP started at. There's no way that I know of to associate a new default ammo type with a new projectile proto in the 3000+ range. I was asking how to define a new ammo type that the game will recognize, that would obviously be associated with the projectile I defined. Currently the only way to get say a greatsword displayed when thrown is to modify the proto of e.g. the throwing axe projectile to change its mesh id to the mesh id that the greatsword uses, and then set the greatsword's weapon ammo type to throwing_axe, which will then look and find the throwing axe projectile proto.

    So yes, I could do this, and right now get all of the throwing weapons I want looking like they should when thrown. However this would mean I'm overwriting what existing projectiles look like when thrown and ruin their look if used in game for the weapons they were originally intended. So that's not a valid solution. I need to be able to define new weapon ammo types, unless there is another way to make a mesh you want displayed when a weapon is thrown.
     
  10. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    I see your predicament, but know of no solution, the easy workaround would be to assign the thrown ammo animation closest to the weapon to be thrown and count on the fact it's fast moving, and not on the screen long enough for most people to notice.

    I don't know if it's possible to add a script to the weapon that can change the animation's model as it's launched (san_throw?), I looked around a bit and didn't find a .mes file where projectile weapon types were assigned, it's possible those 3000+ proto lines are hardcoded.
     
  11. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Well if I can't find a solution, I'm going to have to assign it something like throwing_axe and log it as a defect for now. It stands out quite a bit in game when you throw it and the model changes, people will immediately notice it.
    Mechanically, everything at least works and I have the ability to turn mind blades into throwable weapons, so nothing is blocking me from doing multiple throw and finishing the class features. As far as QC goes, the visual is wrong and this is a big defect to me.
    For visual reference, see the mind blade in image 1 and throwing it in image 2. Yikes.
    I can even throw a two handed weapon like this, and the character uses both arms to throw! But I believe that the rules say two handed weapons are not allowed to be thrown, right?

    Edit:
    Also, I tested one last time before logging the defect. Cleaver gets its mesh which is odd, because throwing axe projectile actually points to the arrow mesh! But, the Cleaver throw actually exists as a separate "throw" radial menu option called "throw cleaver" instead of "throw weapon" or whatever the standard radial option for throwing is. So that means there is a unique d20 action being ran for the cleaver throw, which is likely what is modifying something in order to change the mesh to the cleaver when thrown. I need to know what that is doing. Any ideas on how to track down the vanilla throw cleaver action to figure out what it's doing?
     

    Attached Files:

    Last edited: Sep 12, 2019
  12. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    That cleaver still looks like an axe to me...
     
  13. WinstonShnozwick

    WinstonShnozwick Established Member

    Joined:
    Mar 2, 2011
    Messages:
    628
    Likes Received:
    23
    Whatever it looks like, it's not the mesh id that is in the proto for the throwing axe particle. The throwing axe particle is the mesh for an arrow, which you can actually see in the image I posted. So that means that whatever vanilla was doing with the cleaver's ability to throw was modifying the mesh during the action and allowing it to show something else, which is the direction I want to go to show my mesh id's.
     
  14. DarkStorm

    DarkStorm Established Member

    Joined:
    Oct 2, 2003
    Messages:
    514
    Likes Received:
    3
    I couldn't find any reference to "Throw Cleaver" in vanilla MES, but it will auto-create radial menu entries of the form "Throw <weapon-name>" using the following conditions:
    Code:
                    var ammoType = weapon.GetWeaponAmmoType();
                    if (ammoType.IsGrenade())
                    {
                        AddMenuEntry(weapon, D20ActionType.THROW_GRENADE);
                    }
                    else if (ammoType.IsThrown())
                    {
                        AddMenuEntry(weapon, D20ActionType.THROW);
                    }
    For completeness sake, here are my definitions for IsGrenade / IsThrown:
    Code:
            public static bool IsThrown(this WeaponAmmoType type)
            {
                return type >= WeaponAmmoType.dagger && type <= WeaponAmmoType.bottle;
            }
    
            public static bool IsGrenade(this WeaponAmmoType type)
            {
                return type >= WeaponAmmoType.ball_of_fire && type <= WeaponAmmoType.bottle;
            }
    For the action types STANDARD_RANGED_ATTACK, THROW, and THROW_GRENADE, the projectile is determined as follows:
    temple.dll@0x10065760 might be what you're looking for heh.
    It is used for the ranged attack and throw grenade actions.

    Translated to C# the function looks like this. Let me know if this helps:
    Code:
            [TempleDllLocation(0x10065760)]
            public static int GetProjectileProtoId(this WeaponAmmoType type)
            {
                switch (type)
                {
                    case WeaponAmmoType.arrow:
                        return 3001;
                    case WeaponAmmoType.bolt:
                        return 3002;
                    case WeaponAmmoType.bullet:
                        return 3003;
                    case WeaponAmmoType.magic_missile:
                        return 3004;
                    case WeaponAmmoType.dagger:
                        return 3005;
                    case WeaponAmmoType.club:
                        return 3006;
                    case WeaponAmmoType.shortspear:
                        return 3007;
                    case WeaponAmmoType.spear:
                        return 3008;
                    case WeaponAmmoType.dart:
                        return 3009;
                    case WeaponAmmoType.javelin:
                        return 3010;
                    case WeaponAmmoType.throwing_axe:
                        return 3011;
                    case WeaponAmmoType.light_hammer:
                        return 3012;
                    case WeaponAmmoType.trident:
                        return 3013;
                    case WeaponAmmoType.halfling_sai:
                        return 3014;
                    case WeaponAmmoType.sai:
                        return 3015;
                    case WeaponAmmoType.shuriken:
                        return 3016;
                    case WeaponAmmoType.ball_of_fire:
                        return 3017;
                    case WeaponAmmoType.bottle:
                        return 3018;
                    default:
                        throw new ArgumentOutOfRangeException(nameof(type), type, null);
                }
            }
     
    Last edited: Sep 13, 2019
  15. Allyx

    Allyx Master Crafter Global Moderator Supporter

    Joined:
    Dec 2, 2004
    Messages:
    5,001
    Likes Received:
    250
    That certainly seems to be it, I guess it's possible for you guys to work some magic, hook it out and expand the list a little, right?
     
Our Host!