DeeZire's Tutorials

Tutorial for Red Alert 2 RA2

Avatar of Allied General

Allied General

Category: Code
Level: Beginner
Created: Wednesday July 29, 2009 - 2:48
Updated: Sunday October 11, 2009 - 8:28
Views: 9979
Summary: DeeZire's tutorials that were lost in the revamp of
  • Staff-
  • Members-
  • Average-

0 votes

Since after "revamp" has lost loads of content and apparantly banned any old users

Miscellaneous Tweaks #1

- Afterburn/Trailers
In the ART file you can add a Trailer= animation to the entry for any AircraftType - this can be used for a crude 'afterburn' effect if you choose the right animation.

- Improve Random Maps
If you add CASLAB to the list of NeutralTechBuildings= in RULESMD.INI (Yuri's Revenge) then the Secret Lab will be placed (at random) on Random Maps generated by the RMG in the same way as other Tech Buildings.

- Debris
Do a 'case sensitive' search and replace in the RULES files - search for DebrisAnim= and replace it with DebrisAnims= - thats a typo (the 's' is missing) which means some objects don't generate explosive debris. To correct another typo, do another search and replace to replace Maxdebris= with MaxDebris= to get the game to use the correct amount of debris too.

- Map Smudges
Change the following entries in the [CombatDamage] section so that they look like this;-


That makes the game use the smudges properly, as those above are the only ones that exist in Red Alert 2 and Yuri's Revenge.

- Ore From Destroyed Refineries
Make residual Ore fly from destroyed Refineries or Ore Processors by adding CRYSTAL1,CRYSTAL2,CRYSTAL3,CRYSTAL4 to the DebrisAnims= for GAREFN, NAREFN and GAOREP. Add them to YAREFN in Yuri's Revenge too.

- Shake The Screen
Add these lines to any warhead to shake the screen when it impacts;-


Thats best reserved for the Nuke - in that case, simply remove the comments from the [NUKE] entry in the RULES file. To create the 'shake' effect used by the Ion Cannon in Tiberian Sun, use this;-


- AI Repair Vehicles
You can get the AI to repair it's own vehicles on the Service Depots - simply add AIBuildThis=yes to the [NADEPT] and [GADEPT] entries. It's also worth adding CAOUTP to the RepairBay= list in the [General] section to get the AI to use the Tech Outpost too if it has one. The AI will then send damaged vehicles to the nearest one it owns and repair them, so it can prolong its war effort and keep it's Veteran and Elite units in good health. The only drawback to this is that, sometimes, badly damaged units will break off any 'mission' they are involved in and head back to get repaired.

- Make An Armory
Utilize some unused logic left over from Tiberian Sun and make a structure that can 'upgrade' any InfantryTypes to Veteran level when they are ordered to enter it. Simply give any structure Armory=yes and use the Ammo= statement to dictate how many times it can be used. Dont give this to any structure that produces Infantry (such as a Barracks) as that can cause problems for the AI. You can only get the AI to use it by telling it to do so in the AI.INI file (thats beyond the scope of this tutorial, maybe in another). If it's going to be a Tech Building, add it to the list of NeutralTechBuildings= too and it will get placed on Random Maps like the other Tech Buildings by the RMG. The one problem is that whatever structure you use, the game is hardcoded to default to it having Foundation=4x4 which will affect where the units exit the structure from. Choose a structure and image for it carefully to ensure that players can still see and select units when they leave.

- Residual Flames
Use any of the fire SHP images from the game to make a new one, call it FIRE3.SHP and add it to your mod. The game is hardcoded to use that image directly for residual flames when a structure is badly damaged or destroyed. A 'smoke' image makes a good alternative too - try NUKESTM.SHP which is in the game but would otherwise be unused.

- Control Ivan Bomb Detonation
In the [CombatDamage] section, set the following two statements to 'yes' to allow the player to control when Ivans bombs will detonate by double clicking the object they are attached to;-


- Get The Animations Right
A couple of typo's and omissions from the RULES file can be corrected to give some slight improvements. Add these to the end of the [Animations] list;-


- Oil Burning
For an 'oil burning' animation effect on the Tech Oil Derrick when it's damaged, find the [TestSmoke] entry and amend it so it has Image=t4_ib and then find the [CAOILD] entry, and set the DamageParticleSystems= to TestSmokeSys.

- Extra Vehicle Debris
Vehicles can spawn tires and wheels when they get destroyed, you can also get them to spawn axles. Find the [VoxelAnims] section and add a new entry called AXLE. Then add this section with the other Voxel Anims;-


Give any unit DebrisTypes=AXLE to make use of it.

- Ore Miner Sounds
Add an unused sound - give the Chrono Miner and War Miner MoveSound=OreTruckHarvest so they make a sound when moving about in Ore. In Red Alert 2, you can also give them a VoiceSpecialAttack= to get them to acknowledge commands to harvest Ore or Gems.

- Super Gap Generator
Add these lines to the GAGAP entry;-


When the player has 200 surplus power 'points' they can 'deploy' the Gap Generator so it covers a wider radius and uses that extra power to do so.

- Desolator Effect
Add IsRadEruption=yes to the [RadEruptionWeapon] entry to get a cool green-lined visual 'umbrella' effect when the Desolator deploys.

- Ore Tree Sounds
Add AmbientSound=OreMineExtract to all 3 of the TIBTRE entries to get them to make a sound when they 'extract' Ore from the ground.

Just like in Tiberian Sun, you can make units in Red Alert 2 that travel underground, and also have a good degree of control over where they can and cannot move, submerge and surface.

You can only use this logic on VehicleTypes, and it involves giving the unit an unused Locomotor= and MovementZone= as well as making several other tweaks throughout the RULES and ART files.

First off, make your unit as normal. You need to add these tags to it in place of any existing ones;-


You may also want to give the unit MoveToShroud=no for balance - you may consider it to be be unfair to allow such a unit to move to areas of the map that the player has not yet explored.

Depending on the unit's capabilities, including any weapon(s) it has, whether it has a turret and whether or not it can carry passengers, you may also need to give the unit IsTilter=yes and Crusher=yes to prevent any errors when it's submerging or surfacing.

The game is hardcoded to produce an animation when such a unit submerges or surfaces. That animation is specified by the Dig= statement in the [AudioVisual] section of the RULES file which is normally commented out, so you need to put it back in (in Yuri's Revenge it's removed altogether so you need to manually add the tag). You can use any animation, although make sure you add it to the [Animations] list if it's not there already, and give it a section in the ART file.

While you are in the ART file, add this line to your animation;-


That's a sound that is otherwise unused in the game - it's a kind of rubble/rustling sound thats quite fitting to it's new purpose, so we also get to make use of it for uniqueness.

You're almost ready to go, however there has been a change to the underground unit movement logic during the transition from Tiberian Sun to Red Alert 2.

Back in the [AudioVisual] section, theres a tag which also makes the sound when underground units submerge or surface. DigSound=NukeSiren is the tag, although in Red Alert 2 that tag is used when a Nuke is launched. The effect is that every time your unit goes underground or surfaces, the Nuke warning siren will sound. Not good (unless of course you really want to scare the players).

To get around this, set DigSound= to 'Dummy' - no sound will be used. But, we want the players to still get the air raid siren warning when a Nuke is launched, so hop back into the ART file and find the [NUKEPUFF] entry - that animation is hardcoded to be called by the game when a Nuke is launched, so add this line to it;-


The Speed= setting on the unit itself is only used when it's not underground. To adjust it's speed when moving underground, simply find the TunnelSpeed= tag in the [General] section of the RULES file and set it to your liking, but remember that this applies to all underground units.

If you want the players to be able to see it's health bar and select it when it's underground, find the AllowShroudedSubteranneanMoves= in the [General] section and set it to 'true' - only the player that owns the unit will be able to 'see' and select it however.

For more advanced tweaking, you can control the types of terrain on the map that your unit can and cannot 'burrow' into. Normally, you dont want it to be able to submerge into pavement or rocks or emerge in water - those are the default settings, so if you're happy with that then skip this next step.

If you extract and open the theater specific INI files (such as SNOW.INI and TEMPERAT.INI) then you can look at the object definitions for each of the tile sets that are used to make up every map in the game. Each tileset is named and has it's own section, so it's fairly simple to figure out which is which. You can put AllowBurrowing= into the section for a tileset and set this to 'true' or 'false' to tell the game whether or not underground units can burrow into it.

There you have it - the ability to make use of underground units in Red Alert 2 with no difference to the players or effect on the Nuke.

Originally, the Mirage Tank was supposed to be able to select the terrain object to disguise as in a similar manner to the Spy. However it was felt that this caused too much micro-management - you had to 'deploy' the tank (like the Siege Chopper in Yuri's Revenge) to get it to disguise, then it could only fire when disguised. Finally you had to 'undeploy' the tank to move it again.

You can reach a good compromise by giving the tank 2 weapons and making some adjustments - with one weapon, it can disguise as any terrain object, and the other is it's normal weapon. With some additional tweaking, you can put a better animation on it's normal weapon too.

The advantage of this is that you can then get the tank to disguise as lamp posts or rocks as well as any tree - more fitting, and also makes it more useful and effective between different maps with different terrain features.

Thankfully, half of the work is done as the code is left in the RULES file, all we have to do is tweak it.

Go to the [MGTK] entry and delete the Primary=MirageGun statement. Remove the comments so that it now has;-


Note that because of a mistake here, the tank would not normally get a better weapon when it reaches 'elite' - but with our new logic, it does, due to the presence of the EliteSecondary=MirageGunE statement which was never changed.

You should also edit the entries for all of its weapons (the Primary=, Secondary and EliteSecondary= weapons) so that each weapon has OmniFire=yes set - this prevents the tank turning to face its target thus giving itself away.

Next, we need to change the warhead used by the TankMakeUpKit weapon - if we dont do this, the tank can get confused when targetting enemy vehicles and wont attack them with the right weapon.

Find the [TankSnapshot] entry and change it so the first line is like this;-


Now add a new animation to the end of the [Animations] list called CHRONOFS. Find the [MirageWH] and change it so the AnimList= looks like this;-


This is an animation image that's in the game files but completely unused, so we get to make use of it thus add a little uniqueness. It actually looks better than the default one, which simply uses an effect used by 'Iron Curtained' units.

Finally, in the ART file, add this section so that the animation displays properly;-


There you have it - one final thing to note is that you will notice the Mirage Tank as being one of the few tanks that has no seperate turret (it is built in) - this is required for this logic to work, as problems occur when the game tries to disguise 2 joined voxels like a tank and its turret into one terrain object. You are therefore restricted to such voxel units when using this weapon.

In a flashback to the original Red Alert, it is possible to add a medic infantry unit, and also a mechanic infantry unit (although that one is a slight hack).

To add your medic, simply clone an existing infantry unit. You may want to give the medic the following properties, just so it makes sense to the kind of unit he is;-

Just so he can heal himself over time. What kind of medic would he be if he could not do that?

Only in Yuri's Revenge. Makes sense that a medic would carry antidote against the Virus sniper's poison.

His 'weapon' (see below) doesnt actually inflict damage, so in assessing this as a threat the AI needs to consider it as a special case.

Next, we give him the ability to heal other infantry units. This is done by giving him a 'weapon' that doesnt actually inflict any damage - it restores damage instead. Give him Primary=Heal then look for that weapon's entry and amend it to this to get the correct sound and range;-


As you can see, because it inflicts negative damage, it has the effect of restoring health instead of taking it away. A different type of hack is possible which would entail this weapon inflicting Damage= as usual (that is, a positive value rather than negative) but then using negative values on the Verses= percentages on the Warhead= - however, a major drawback of this is that the unit must be force-fired on your own units, and will actively seek out enemy units and heal them!

The game is hardcoded to set specific features for the units that have such a weapon using the [Organic] warhead;-

- firstly, when you leave the mouse cursor over him, you can place him in Automatic Area Guard. This means he will scan for nearby friendly infantry units that are damaged and run to heal them. You can set the 'scanning' range for this by amending the HealScanRadius= tag (in cells) in the [General] section of the RULES file.

- secondly, the game is supposed to indicate this unit by giving him a unique 'pip' in the form of a red cross (this goes in place of any veteran stripes). Although this image exists, Red Alert 2 does not use it. In Red Alert 2 DeeZire, each frame from the SHP of the unit itself has been modified to give this effect.

- finally, such a unit can perform the unique Action of 'Heal'. The cursor for this does not exist in Red Alert 2, so you get the default 'Stop' cursor instead. You can change this with the following steps;-

(i) extract MOUSE.SHP from the game (MOUSE.SHA in Yuri's Revenge)

(ii) convert it to PCX format using the MOUSEPAL.PAL palette

(iii) change frame #384 to whatever you want the 'Heal' cursor to be, although you cannot have an animated one (it must be one frame or image)

(iv) convert the PCX image sequence back into a SHP (or SHA) but make sure that you do not use SHP compression. The mouse cursor is drawn in the uppermost 'layer' on screen since it must always be available - if you compress images in this layer, you will get bad corruption of the cursor.

Note that if you have also followed the Carryall Units tutorial, the Carryall's 'Tote' will share the same cursor as the medic's 'Heal' - choose a cursor which looks equally fitting for both functions. If you are not using the Carryall, simply change frame #384 so it's the Heal one.

The mechanic is trickier. His 'weapon' works in the same way as the medics, although like the Carryall logic, the logic for that weapon means it can only be used by a VehicleType. What we have to do is fool the game into thinking that our mechanic infantry unit is actually a vehicle.

Make your new InfantryType and add him to the list as usual. Give him Primary=RepairBullet (this is already in the game). Now, you have 2 options here;-

(i) you could simply make a VehicleType that has the image of an infantry unit and make him buildable from the War Factory. You wont get any problems with this other than the fact that he wont be on the Infantry Tab - he will appear on the Unit Tab instead.

(ii) you could make him an InfantryType but give him to a BuildingType as a FreeUnit=. This is how it's done in Red Alert 2 DeeZire - you get an InfantryType as normal except the game is fooled into classing it as a VehicleType by that tag, hence it can use the weapon. If you choose this method, give him TechLevel=-1 so he can't be built. If you build him, you will get graphical issues with him as he will be treated like a vehicle with that weapon.

In either case, you will have to make a new SHP sequence for your mechanic that reflects one of a vehicle. Non-voxel vehicles use the 'frames' method to determine how they look - examine the Terror Drone entry in the ART file to see how this is done, and construct your mechanic sequence appropriately from an existing infantry SHP.

Very simple one this, this allows you to make a perfect replica of the Mutant Hijacker from Tiberian Sun - a soldier which can steal enemy vehicles.

The only restriction is that the unit must be an InfantryType, as the required tags only work for those objects.

Add VehicleThief=yes to the unit - this does not invoke any of the logic, it simply gives the unit an 'enter' cursor when it is selected and the mouse is moved over any enemy vehicle.

Then add Thief=yes to the unit - coupled with the first tag, this allows the unit to steal the vehicle. When the vehicle is destroyed, the unit emerges partly damaged. You can steal up to 3 vehicles in this manner (when the third is destroyed it invariably results in the death of the thief).

You can stop a VehicleType being stolen by this kind of unit by giving the vehicle the NonVehicle=yes tag.

There is one drawback - the Thief=yes tag also gives the unit the 'enter' cursor over Ore Refineries and (if you enable them) Ore Silo's, but he gets no effect if he enters them. To get around this, Red Alert 2 DeeZire only uses this logic on the Spy which can enter such structures anyway so the player sees no adverse effects.

Finally, it's worth adding Crushable=no and OmniCrushResistant=yes (in Yuri's Revenge) - a crushable vehicle thief will often not get close enough to actually steal the vehicle before he gets crushed.


Original MaterialDeeZire
Original MaterialDeeZire
Original MaterialDeeZire
Original MaterialDeeZire
Original MaterialDeeZire
Original MaterialDeeZire


Display order: Newest first

xchivalr0us - Saturday August 28, 2010 - 16:11

How it download?

Return to top