:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::

Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Sun May 31, 2020 11:01 pm
All times are UTC + 0
 Forum index » Modding Central » Red Alert 2 Editing Forum » Tutorials Vault
[ARES] Lightning Strike Tank
Moderators: Global Moderators, Red Alert 2 Moderators
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
Author Message
Sir Prize
Vehicle Driver


Joined: 27 Mar 2020
Location: AKA WoRmINaToR

PostPosted: Fri Mar 27, 2020 11:27 pm    Post subject:  [ARES] Lightning Strike Tank
Subject description: 1 bolt, say goodbye to Airburst.
Reply with quote

Hey guys, Apollo and I got to chatting yesterday and together we came up with an excellent way to make a weapon that fires lightning strikes, mimicking a single hit of the Lightning Storm SuperWeapon almost flawlessly. It took some fiddling and tweaking, but I'm extremely happy with the results.

There's a bit of work involved, but it's worth it. Scroll down if you want to see the finished product. This tutorial assumes some basic familiarity with general modding practices, in particular it assumes you know how to use Ares and already know how to create new units, weapons, projectiles, and animation art entries. A cursory familiarity with XCC Mixer and SHP Builder is a plus, but not really required.

Anyways:
Before we get to coding, we first need to do some SHP work. If you don't already have it installed, grab a copy of SHP Builder and fire it up.

Create two new SHPs. The first one should be only a single frame, the second should be 29 frames. The width and height are arbitrary, as these will be completely empty. I chose 5x5. Type should be RA2 Animation



Save these immediately with no further edits, name them whatever you'd like. I chose DUMMYANIM1 and DUMMYANIM29 to indicate how many frames they last. If you're not using a mod manager, these need to go directly into your RA2 install folder.

Next, crack open XCC Mixer and go to File -> Found -> Red Alert 2 -> ra2.mix. Open up Conquer.mix and look for WCCLOUD1.shp. Extract it to the same directory where you saved the dummy animations. Name it something other than WCCLOUD1 (we don't want to override the existing animation, as that will screw up the lightning storm), I chose LCLOUD.

Open LCLOUD in SHP Builder and go to Edit -> Resize Canvas. Add about 360 pixels to the bottom of the frame (this is what I used, feel free to adjust this to your liking). Save your edits and close
Don't worry if SHP Builder loads the animation in the wrong palette. The WCCLOUDs use unittem.pal instead of anim.pal. Since you're not editing colors, it will still look correct in-game.

(N.B. on the above: If you like, you can skip this step and use YDrawOffset instead)

Next we need to graft the lightning bolt and the lightning bolt explosion together, because the warhead will only trigger one animation at a time. Head back to XCC Mixer to the same location and extract WCLBOLT1.shp and EXPLOLB.shp. Rename EXPLOLB.shp to something unique, I chose simply LBOLT.

Next you'll have to copy/paste these two SHPs together. This can be a bit tricky and I believe there is already a tool or tutorial somewhere for that, so I won't go into details (I'll attach the anim I created a few years back for this, no credit necessary).

Now on to the rules/art code.

Firstly, a few concepts to explain:
    1. PreImpactAnim. This is the linchpin of the whole operation. This allows you to specify an animation that that plays and completes before the warhead is detonated.
    This poses a problem however, because the PreImpactAnim needs to fully complete before the warhead is detonated, meaning the cloud will have dissipated before the lightning bolt is fired. This is why you created the dummy animations--More on that later.

    2. TrailerAnim and TrailerSeperation. Another two critical pieces of the puzzle. Animations can have Trailers just like projectiles, however they are specified by different tags, namely the two above. TrailerAnim is the anim to play as a trailer, and TrailerSeperation is the delay in frames between spawning said animation.

    3. Next. A very seldom-used, but extremely useful tag that lets you specify what animation to play after the given animation has completed. In our case, PreImpactAnim does not detonate the warhead until both the original anim and the one specified by Next have completed.

So, because the cloud animation is 59 frames, and the bolt doesn't fire until the 29th frame, we need a way to delay firing the lightning bolt (which will be the eventual animation in the Warhead's AnimList= by exactly 29 frames, while still completing the last 30 frames of the cloud animation.

The basic strategy for accomplishing that effect is this:
    1. Using PreImpactAnim attached to a warhead, spawn a 1-frame dummy animation.
    2. Using TrailerAnim= and TrailerSeperation=, spawn the actual cloud animation as a TrailerAnim. Because the cloud is a trailer, this means it will not be tied to the timing of detonating the warhead per PreImpactAnim.
    3. Using Next=, have the dummy 1-frame animation progress on to a 29-frame dummy animation that doesn't have TrailerAnim= set. This prevents any more cloud animations from spawning, as otherwise you would get a new cloud every other frame for 30 frames.
    4. After the 29-frame dummy animation has finished (which should be exactly half-way through the cloud animation playing), detonate the warhead and create the lightning bolt.

Firstly, you need a weapon to fire your lightning bolt. Use all the standard tags and include whatever damage, ROF, etc. that you want. Ideally, the projectile should be set to something like InvisibleHigh for direct hits or create a new invisible projectile with Inaccurate= and FlakScatter=, whatever suits you.
Code:
[LightningStrikeWeapon]
...
Projectile=InvisibleHigh
Warhead=LightningStrikeWarhead

Next is the Warhead. Again, use whatever tags and values suit you. Just make sure you have the following:
Code:
[LightningStrikeWarhead]
...
PreImpactAnim=LCLOUD1; this will be our 1-frame dummy animation
AnimList=LBOLT; this is the actual lightning bolt

Now on to the art. First, add your animations to the [Animations] list in rulesmd.ini:
Code:
[Animations]
...
XXX=LBOLT
XXX=LCLOUD1
XXX=LCLOUD2
XXX=LCLOUD3

I always do this first because it's the easiest step to forget! Again, name those whatever you want. Those are just the names I chose.

Now, create the entries in Artmd.ini. Let's start with the easiest one:
Code:
[LBOLT]
Layer=ground
Report=WeatherStrike; We need this for the lightning strike sound to play. WCLBOLTX don't have this because the sound is specified in SW-specific code in AudioVisual

If you would like, you can add a negative ZAdjust= to LBOLT if you find it's rendering behind buildings when it shouldn't. I put a ZAdjust=-20 on mine, as it helps in certain edge cases without being too aggressive.

Now for the clouds, where the magic happens. First, define your 1-frame dummy animation. Start by copying from WCCLOUD1 and add TrailerAnim=LCLOUD2, TrailerSeperation=2, and Next=LCLOUD3. Note you can remove AltPalette=yes and Layer=Top. If you used the SHP Editor method of raising the clouds, ZAdjust is important here:
Code:
[LCLOUD1]
Image=DUMMYANIM1; I didn't just name the section ID DUMMYANIM1 because I want to keep it generic for other purposes
TrailerAnim=LCLOUD2
TrailerSeperation=2
Next=LCLOUD3
ZAdjust=-150; important if you used the SHP editor method of raising the clouds. If you use YDrawOffset, omit this

Next, define your actual cloud animation:
Code:
[LCLOUD2]
Image=LCLOUD; you don't have to have this. you could instead simply name your SHP lcloud2.shp or name this section LCLOUD. Up to you
Rate=450; tweak this to your liking. Orginal clouds use Rate=375
Layer=Top
AltPalette=yes
ZAdjust=-150

Finally, define the 29-frame dummy animation that plays after LCLOUD1 completes:
Code:
[LCLOUD3]
Image=DUMMYANIM29
Rate=450; Make sure this matches the Rate= of LCLOUD2, otherwise your lightning bolt will be out of sync w/ cloud

And that should do the trick. If you have everything wired up correctly, it should look just like this. If you try this out, let me know how it goes!


lightning tank.gif
 Description:
 Filesize:  5.81 MB
 Viewed:  835 Time(s)

lightning tank.gif



lbolt.shp
 Description:

Download
 Filename:  lbolt.shp
 Filesize:  70.69 KB
 Downloaded:  3 Time(s)


_________________
Formerly WoRmINaToR. I've created a new account to update to the name I've been using everywhere else for the last several years.

Last edited by Sir Prize on Mon Mar 30, 2020 9:08 am; edited 5 times in total

Back to top
View user's profile Send private message
McPwny
Cyborg Soldier


Joined: 29 Jan 2018

PostPosted: Sun Mar 29, 2020 2:35 am    Post subject: Reply with quote

weird that certain ppl would have s sudden interest in weapons that fire lihhtning bolts. 10/10 tutorial.

Back to top
View user's profile Send private message
Sir Prize
Vehicle Driver


Joined: 27 Mar 2020
Location: AKA WoRmINaToR

PostPosted: Sun Mar 29, 2020 4:13 am    Post subject: Reply with quote

If you're referring to the thread that got crapped a few weeks ago... incidentally, I did come across that thread thanks to another thread getting crapped that I was involved in. This doesn't really have anything to do with that, though.

I've actually had this tank in my mod for over 10 years and have always wanted to product this effect, but was never quite able to nail it down. I had to settle for lightning strikes without the cloud, which isn't nearly as cool.

We just happened to get on the subject, he shared a good idea, and I ran with it. That's all.
_________________
Formerly WoRmINaToR. I've created a new account to update to the name I've been using everywhere else for the last several years.

Back to top
View user's profile Send private message
cxtian39
Commander


Joined: 11 Feb 2016

PostPosted: Sun Mar 29, 2020 4:47 am    Post subject: Reply with quote

Should always use YDrawOffset Wink
You don't want an anim at the ground but looks like it's in the sky. There will be some layering problem.
_________________
I DON'T extract models from Rivals.
I play Rivals tho, PM me for a fight.

Back to top
View user's profile Send private message Skype Account
Sir Prize
Vehicle Driver


Joined: 27 Mar 2020
Location: AKA WoRmINaToR

PostPosted: Sun Mar 29, 2020 9:32 am    Post subject: Reply with quote

That's why you use ZAdjust (which is specifically called out in the tutorial).

But, as I also mention in the tutorial, YDrawOffset is fine as well. Personal preference really.
_________________
Formerly WoRmINaToR. I've created a new account to update to the name I've been using everywhere else for the last several years.

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [5 Posts] View previous topic :: View next topic
 Forum index » Modding Central » Red Alert 2 Editing Forum » Tutorials Vault
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 1.1781s ][ Queries: 13 (1.0541s) ][ Debug on ]