Worms 4 Tweaking

Le tweaking ou comment créer ses armes au delà de l'usine d'armes

Partagez | 

 2 - Clusters

Voir le sujet précédent Voir le sujet suivant Aller en bas 

Nombre de messages : 1133
Age : 26
Localisation : data\\Tweak\\
Date d'inscription : 25/05/2006

MessageSujet: 2 - Clusters   Ven 14 Mar - 20:04

The way clusters are defined in Worms 4: Mayhem is mainly what makes tweaking so powerful. With it, you can simulate nearly anything you want, from simple clusters to nice fireworks effects, the "explosive bounciness" effect from the 2D Worms series, or even fire and earthquakes with more experience.

Basic explanation

For this explanation, we will use kWeaponClusterGrenade, which is the weapon data for the Cluster Bomb. Search "kWeaponClusterGrenade" until you get to this part:

    <XContainerResourceDetails id='kWeaponClusterGrenade'>
      <Value href='kWeaponClusterGrenade-0'/>
    <PayloadWeaponPropertiesContainer id='kWeaponClusterGrenade-0'>

Scroll down until you get to this:


This is probably pretty easy to understand, NumBomblets is the number of clusters, BombletMaxConeAngle is the maximum angle (in radians, remember) within which the clusters will spread, BombletMaxSpeed and BombletMinSpeed are respectively the maximum and minimum velocity they can get.
The most interesting property is BombletWeaponName. Scroll up until you get to this (and don't get confused between kWeaponClusterGrenade and kWeaponClusterBomb!)

    <XContainerResourceDetails id='kWeaponClusterBomb'>
      <Value href='kWeaponClusterBomb-0'/>
    <PayloadWeaponPropertiesContainer id='kWeaponClusterBomb-0'>

This is the weapon data for the clusters of the Cluster Bomb.
Looks like a weapon, just like kWeaponBazooka or kWeaponClusterGrenade. Because it is a weapon. It does not appear in the inventory, but it is a weapon anyway, and this is the reason why tweaking is so powerful. Because you can create as many weapons as you want in WeapTwk.xml, which can't be added into the inventory, but can still be used as clusters. Any weapon can be used as a cluster of another weapon.

For instance, go back to kWeaponClusterGrenade, and set its BombletWeaponName to kWeaponHolyGrenade. Run the game, and enjoy!

Any weapon can be used as a cluster, and you can even make a weapon cluster into itself (in this case, setting BombletWeaponName to kWeaponClusterGrenade).
The only limitation is that you can't set melee weapons as clusters (you don't want to do that anyway), same for guns (shotgun, sniper rifle) and sentry guns. Animals will lose their walking or flying ability, and homing missiles will lose their homing ability.

Now for more advanced stuff.

Creating clusters

You need some knowledge about how XML object models work. If you haven't read the tutorial about Understanding XOM, try to read it. If you can hardly understand anything, here is a simpler explanation of what you need.

Each weapon must have the following structure:

1: A declaration in the XDatabank, near the beginning of the file:

      <ContainerResources href='kWeaponSentryGunPayload'/>
      <ContainerResources href='kWeaponSheep'/>
      <ContainerResources href='kWeaponShotgun'/>
      <ContainerResources href='kWeaponSniperRifle'/>
      <ContainerResources href='kWeaponStarburst'/>
      <ContainerResources href='kWeaponSuperAirstrike'/>
      <ContainerResources href='kWeaponSuperSheep'/>
-----> Declaration goes here
      <ColorResources href='Payload.FuseTimerInitialColor'/>

Let's say you want to call your cluster kWeaponMyCluster. The declaration will be:

<ContainerResources href='kWeaponMyCluster'/>

Pretty simple, isn't it? This declaration is necessary so the game loads the actual cluster.
kWeapon is a naming convention, you don't have to add it to the name of your weapon, but it is recommended anyway for practical reasons.

2: A XContainerResourceDetails block. You can put it wherever you want but it is recommended to insert it near the end of the file, before </xomObjects> so you can find it again later.

    <XColorResourceDetails id='Payload.FuseTimerUrgentColor'>
      <Value r='255' g='255' b='255' a='255' />

---> XContainerResourceDetails block goes here


The actual structure of a XContainerResourceDetails block is:

    <XContainerResourceDetails id='NAME'>
      <Value href='NAME-0'/>

Just replace NAME by the name of your weapon, kWeaponMyCluster for this example. The property Flags should never be changed. Don't forget to add "-0" to the name in the Value tag.

3: A PayloadWeaponPropertiesContainer, right after your XContainerResourceDetails block. Its structure should be:

    <PayloadWeaponPropertiesContainer id='NAME-0'>

Instead of writing the XContainerResourceDetails and the PayloadWeaponPropertiesContainer, you can copy them from any payload weapon (Bazooka, Grenade, Cluster Bomb, etc...) and just change the names, and the properties you want.

And there you go, you have created your own cluster and you can use it in any weapon by setting its BombletWeaponName to the name of your cluster (kWeaponMyCluster).

Windows did not detect any keyboard. Press Enter to continue...
Revenir en haut Aller en bas
Voir le profil de l'utilisateur http://w4-tweaking.bb-fr.com
2 - Clusters
Voir le sujet précédent Voir le sujet suivant Revenir en haut 
Page 1 sur 1

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Worms 4 Tweaking :: ENGLISH Section :: ENGLISH Section :: Tweaking Tutorials and Support :: WeapTwk.xml Tutorials-
Sauter vers: