Results 1 to 16 of 16

Thread: How to make a projectile spawn another (Kingdoms)

  1. #1

    Default How to make a projectile spawn another (Kingdoms)

    One of the changes in kingdoms allows projectiles to spawn other projectiles - this is used by the mangonel and bombards (for grapeshot). The possibilities of this are huge - blunderbusses, grapeshot, mortars and exploding shells that actually use shrapnel, cluster bombs (for a steampunk mod perhaps), firebreathing monsters and the exploding cow fountain I made while I was playing around with the files. In this post I'll be looking at how the mangonel works, as this provides a fairly good example.

    1. Unpack the Crusades or Teutonic campaign.
    2. Open export_descr_unit.ext and search for the mangonel.
    You'll see the following line of text:

    stat_sec 65, 3, mangonel_shot, 250, 10, siege_missile, artillery_gunpowder, blunt, none, 26, 1

    The bolded text indicates the name of the projectile.

    2. Open descr_projectile.txt from the unpacked files and search for "mangonel_shot". Look for the following lines of text

    ; self_explode <prob> <min sec> <max sec> [<area effect>]
    self_explode 0.8 1.0 5.5 air_burst_test

    These are used to determine the parameters for a projectile exploding before hitting a target, which is necessary for spawning other projectiles. The stats for the mangonel indicate that it has an 80% chance of exploding, between 1 and 5.5 seconds after launch, and that it will use the air_burst_test area effect.

    3. Open descr_area_effects.xml and search for air_burst_test. You'll see something like this:

    <name>air_burst_test</name>
    <type>projectile</type>
    <effect>air_burst_impact_wall_explosion_culvern_set</effect>
    <explosion_force_min>1.0</explosion_force_min>
    <explosion_force_max>10.0</explosion_force_max>
    <projectile_type>cow_carcass</projectile_type>
    <!-- Do new projectiles have same velocity as parent (true/false) -->
    <preserve_momentum>true</preserve_momentum>
    <!-- Direction projectiles are fired by the explosion (forward, backward, up or down) -->
    <direction>forward</direction>
    <!-- max deviation of projectiles from direction -->
    <scatter_angle>45</scatter_angle>
    <projectile_number>10</projectile_number>
    </area_effect>

    <name> is self explanatory
    <type> indicates that it's a projectile. As far as I can see the options here are projectile, fire, nausea (stat debuff, I think. It's what cows use), holy (morale buff, as used by giant crosses) and explosion.
    <effect> is the effect to play when the area effect is started.
    <explosion_force_min> and <explosion_force_max> indicate the min and max distances the explosion will throw the spawned projectiles. Experimenting with shrapnel and cows, the projectile itself seems to be a factor in distance, as well as the force.
    <projectile_type> - determines what type of projectile is spawned. Your file will have a different entry here, because you probably don't find exploding cows as funny as I do.
    <preserve_momentum> - indicates whether the spawned projectiles will inherit the trajectory of the parent projectile.
    <direction> - which direction do you want the projectiles to spawn in. Heavily influenced by <preserve_momentum>, so be sure to turn that off if you want the projectiles to go straight up or down.
    <scatter_angle> - This determines the maximum deviation from <direction>. Measured in degrees, and applies equally to all 3 axes, thus 180 will get you a spherical explosion.
    <projectile_number> - Bit obvious really, number of projectiles to be spawned.

    So, to set up something like grapeshot:
    1. Set the cannon projectile to explode with a probability of 1, 0.1 seconds after launch
    2. Create an area effect entry.
    3. Spawn x number of musket bullets, with a forward direction and a scatter of around 10

    A cluster bomb:
    1. Mangonel, increase the explosion min time
    2. Area effect to spawn x exploding cannonballs downwards with preserve momentum off

  2. #2
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: How to make a projectile spawn another (Kingdoms)

    Hmm so what does the exploding ammo in the original game use?

  3. #3

    Default Re: How to make a projectile spawn another (Kingdoms)

    Just a straightforward explosion, with a chance of killing anyone within a set radius.

  4. #4
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: How to make a projectile spawn another (Kingdoms)

    So could we kind of trigger on the ammo hitting the ground? It'd be cool to have something like shrapnel.
    Will the ammo explode automatically on the ground?

  5. #5

    Default Re: How to make a projectile spawn another (Kingdoms)

    Should be possible - define an area effect in descr_projectiles.txt and then set the area effect up as a spawning area effect.

  6. #6
    Harbinger of... saliva Member alpaca's Avatar
    Join Date
    Aug 2003
    Location
    Germany
    Posts
    2,767

    Default Re: How to make a projectile spawn another (Kingdoms)

    Yeah I may do that some time

  7. #7
    feed me! Member Ashdnazg's Avatar
    Join Date
    Dec 2006
    Location
    Haifa, Israel
    Posts
    54

    Default Re: How to make a projectile spawn another (Kingdoms)

    I suppose Canister can be done by making it explode after 0 or so seconds, and throw a nice amount of musket balls.
    a.k.a Lord hokomoko @ the Lordz Modding Collective

  8. #8

    Default Re: How to make a projectile spawn another (Kingdoms)

    Yeah, but judging by the mangonel explosion, it seems to go all directions, so you would end up killing your own troops.

  9. #9
    feed me! Member Ashdnazg's Avatar
    Join Date
    Dec 2006
    Location
    Haifa, Israel
    Posts
    54

    Default Re: How to make a projectile spawn another (Kingdoms)

    I believe that's why the scatter angle and preserve_momentum exist :)
    a.k.a Lord hokomoko @ the Lordz Modding Collective

  10. #10

    Default Re: How to make a projectile spawn another (Kingdoms)

    Does the projectiles spawning other projectiles only work with artillery? I'm trying to create a scattergun type effect with muskets, but it isn't working. I've even tried changing the musket to ribault shot in case it had something to do with ammo type. Any chance for this to work?
    Give a man fire and he'll be warm for a day. Set a man on fire and he'll be warm for the rest of his life.

  11. #11

    Default Re: How to make a projectile spawn another (Kingdoms)

    Yeah just change the entry for the musket_shot projectile the same as you would change an entry for an artillery shot. Of course, you would want the effect to create a smaller number of projectiles.

  12. #12

    Default Re: How to make a projectile spawn another (Kingdoms)

    Quote Originally Posted by Furious Mental
    Yeah just change the entry for the musket_shot projectile the same as you would change an entry for an artillery shot. Of course, you would want the effect to create a smaller number of projectiles.
    I tried doing that, I more or less followed the steps outlined by the OP (even the cow_carcass!), modifying it as needed to suit the musket_shot type. Would it make a difference that I'm trying to do it in the americas expansion? Would that type of effect be disabled for mods that don't use the mangonel normally?
    Give a man fire and he'll be warm for a day. Set a man on fire and he'll be warm for the rest of his life.

  13. #13
    Member Member PBI's Avatar
    Join Date
    Jan 2008
    Location
    UK
    Posts
    1,176

    Default Re: How to make a projectile spawn another (Kingdoms)

    Will this work for vanilla or does it only work in Kingdoms? I tried setting up grapeshot but the cannonballs just disappear, they don't spawn anything.

  14. #14

    Default Re: How to make a projectile spawn another (Kingdoms)

    Quote Originally Posted by Shadow_Wolf33
    I tried doing that, I more or less followed the steps outlined by the OP (even the cow_carcass!), modifying it as needed to suit the musket_shot type. Would it make a difference that I'm trying to do it in the americas expansion? Would that type of effect be disabled for mods that don't use the mangonel normally?

    I believe this only works for Kingdoms because it is hardcoded in Kingdoms.exe. Please correct me if I'm wrong on this.

    It should work in any Kingdoms mods as long as you have all the .cas files and everything done properly in descr_proj and all the relevant effects files.

    For example,you could make an exploding beehive grenade with a shrapnel effect that would randomly hit different members of a group within a certain radius, instead of just an area effect that would effect every single unit in the area radius.

    Personally I want to see if I can create an exploding shell for basilisks and cannon, etc that will emit a damaging shrapnel.cas beyond the cannon ball's usual damage radius, and have a sound.evt attached to it.

    I'm already working on a bullet effects set that if I finish it and make available for release, should be able to be added to just about any mtw2 mod.

  15. #15
    Member Member PBI's Avatar
    Join Date
    Jan 2008
    Location
    UK
    Posts
    1,176

    Default Re: How to make a projectile spawn another (Kingdoms)

    I see.

    Yes, just tried this with the Retrofit mod (which runs from kingdoms.exe) and it works fine. Thanks for the help.

  16. #16

    Default Re: How to make a projectile spawn another (Kingdoms)

    Lots of possibilities here, thanks!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO