More than 2 available possible Corpses for units

More than 2 available possible Corpses for units

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

More than 2 available possible Corpses for units

Post by PauloMorfeo »

As far as i understood, unit definitions define a corpse (say it is named "corpo").

Then, when a unit get's destroied, a function in the script is called with a parameter named "severity".

Then, we can check "severity" and choose a "corpsetype" scording to it. Hardcoded to:
Corpsetype=1 will spawn feature "corpo"+"_dead".
Corpsetype=2 will spawn feature "corpo"+"_heap".
Corpsetype=3 will not spawn anything.

That is, if i am understanding it correctly.

My point is, this is yet another example where the ability to spawn units from the scripts would solve limitations, allowing for more flexibility.
With the option to spawn units from scripts, we could check the parameter "severity" and choose one of how many diferent corpses as we would want, not just of 2 available corpses, since a unit can be a feature (like Dragon Teeths) meaning it could also be a corpse.

And because i could use more than 2 available types of corpses.
User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7052
Joined: 16 Nov 2004, 13:08

Re: More than 2 available possible Corpses for units

Post by zwzsg »

I think you understand wrongly.


Corpsetype=1 will spawn the feature whose name is after the "Corpse=" tag in the unit FBI
Corpsetype=2 will spawn the feature whose name is after the "featuredead=" tag in the section of the TDF that describe the first feature
Corpsetype=N will spawn the feature whose name is after the "featuredead=" tag in the section of the TDF that describe the feature (N-1)


The only case in which the names are used to link feature to units is when ressurecting units, and even then, that was only true in TotalA, not Spring.


BTW, I'm pretty sure there's already loads of units, especially buildings, that use more than 2 wrecks. So don't ask for features that have always been there and working and largely used, before even Spring was born.




Loosely related: There is a way to make the script branch into two, or more, feature threads, depending on whatever scripted condition. The trick is to make each thread follow the other, but have the last feature of each feature thread have both an indestructible=1; (as well as null footprints, null heigh, no object, not blocking, null density, etc...) and a featuredead=first_feature_of_next_thread; tag. This way only the script can jump from one thread from another, since you can't destroy/reclaim/see/etc.. the last feature of each thread.

Well, see my ArmDuck at Wormhole Prod for instance: when killed over water, it spawn non blocking feature, when killed over land, it spawn blocking feature. (Again, I think I tested it just in TA, not Spring, but bah)
User avatar
VonGratz
Posts: 471
Joined: 03 May 2005, 05:25

Post by VonGratz »

I'm pretty sure there's already loads of units, especially buildings, that use more than 2 wrecks. So don't ask for features that have always been there and working and largely used, before even Spring was born.
See for example the Cavedogs (ARMAMB) Ambusher, that have 3 corpses, one for each position of the gun when it was killed, and the script that do it.
VonGratz :wink:
piece base ,flare ,gun ,door1 ,door2 ,door3 ,door4 ,stand ,turret ,barrel ;
static-var running_0 ,restore_delay ;

#DEFINE SMOKEPIECE1 base
#INCLUDE "StateChg.h"
#INCLUDE "exptype.h"
#DEFINE SIG_NUM1 2
activatescr()
{
IF ( TRUE )
{
MOVE door1 to y-axis <0> NOW;
MOVE door1 to y-axis <-3.40> SPEED <8.00>;
MOVE door2 to y-axis <0> NOW;
MOVE door2 to y-axis <-3.40> SPEED <8.00>;
MOVE door3 to y-axis <0> NOW;
MOVE door3 to y-axis <-3.40> SPEED <8.00>;
MOVE door4 to y-axis <0> NOW;
MOVE door4 to y-axis <-3.45> SPEED <8.00>;
MOVE stand to y-axis <-5.35> NOW;
MOVE turret to y-axis <-14.35> NOW;
MOVE barrel to z-axis <-7.90> NOW;
TURN door1 to x-axis <90.36> NOW;
TURN door1 to x-axis <0> SPEED <227.09>;
TURN door2 to z-axis <-90.36> NOW;
TURN door2 to z-axis <0> SPEED <227.09>;
TURN door3 to x-axis <-90.36> NOW;
TURN door3 to x-axis <0> SPEED <227.09>;
TURN door4 to z-axis <90.36> NOW;
TURN door4 to z-axis <0> SPEED <227.09>;
TURN stand to y-axis <295.36> NOW;
TURN gun to x-axis <-90.36> NOW;
SLEEP <398>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <-3.39> SPEED <0>;
MOVE door2 to y-axis <-3.39> SPEED <0>;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> SPEED <0>;
MOVE stand to y-axis <-1.50> SPEED <7.00>;
TURN stand to y-axis <-180.24> SPEED <333.58>;
SLEEP <539>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <-3.39> SPEED <0>;
MOVE door2 to y-axis <-3.40> SPEED <0>;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> SPEED <0>;
MOVE stand to y-axis <0> SPEED <2.00>;
TURN stand to y-axis <0> SPEED <346.03>;
SLEEP <521>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <-3.40> SPEED <0>;
MOVE door2 to y-axis <-3.40> SPEED <0>;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> SPEED <0>;
MOVE turret to y-axis <0> SPEED <40.00>;
SLEEP <354>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <-3.40> SPEED <0>;
MOVE door2 to y-axis <-3.40> SPEED <0>;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> SPEED <0>;
TURN gun to x-axis <0> SPEED <253.18>;
SLEEP <357>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <-3.40> SPEED <0>;
MOVE door2 to y-axis <-3.40> SPEED <0>;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> SPEED <0>;
MOVE barrel to z-axis <0> SPEED <22.00>;
SLEEP <352>;
}
SLEEP <25>;
}
deactivatescr()
{
IF ( TRUE )
{
MOVE door1 to y-axis <-3.40> NOW;
MOVE door1 to y-axis <-3.40> SPEED <0>;
MOVE door2 to y-axis <-3.40> NOW;
MOVE door2 to y-axis <-3.40> SPEED <0>;
MOVE door3 to y-axis <-3.40> NOW;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> NOW;
MOVE door4 to y-axis <-3.40> SPEED <0>;
MOVE barrel to z-axis <0> NOW;
MOVE barrel to z-axis <-7.90> SPEED <24.00>;
SLEEP <320>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <-3.40> SPEED <0>;
MOVE door2 to y-axis <-3.40> SPEED <0>;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> SPEED <0>;
TURN gun to x-axis <-90.36> SPEED <281.57>;
SLEEP <321>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <-3.39> SPEED <0>;
MOVE door2 to y-axis <-3.40> SPEED <0>;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> SPEED <0>;
MOVE turret to y-axis <-14.35> SPEED <44.00>;
SLEEP <321>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <-3.39> SPEED <0>;
MOVE door2 to y-axis <-3.39> SPEED <0>;
MOVE door3 to y-axis <-3.40> SPEED <0>;
MOVE door4 to y-axis <-3.40> SPEED <0>;
MOVE stand to y-axis <-1.50> SPEED <3.00>;
TURN stand to y-axis <-180.24> SPEED <362.01>;
SLEEP <498>;
}
IF ( TRUE )
{
MOVE door1 to y-axis <0> SPEED <6.00>;
MOVE door2 to y-axis <0> SPEED <6.00>;
MOVE door3 to y-axis <0> SPEED <6.00>;
MOVE door4 to y-axis <0> SPEED <6.00>;
MOVE stand to y-axis <-5.35> SPEED <7.00>;
TURN stand to y-axis <295.36> SPEED <353.24>;
SLEEP <509>;
}
IF ( TRUE )
{
TURN door1 to x-axis <90.36> SPEED <225.96>;
TURN door2 to z-axis <-90.36> SPEED <225.96>;
TURN door3 to x-axis <-90.36> SPEED <225.96>;
TURN door4 to z-axis <90.36> SPEED <225.96>;
SLEEP <400>;
}
SLEEP <17>;
}
#INCLUDE "smokeunit.h"
#INCLUDE "exptype.h"
Go()
{
DONT-CACHE barrel;
DONT-CACHE door1;
DONT-CACHE door2;
DONT-CACHE door3;
DONT-CACHE door4;
DONT-CACHE flare;
DONT-CACHE gun;
DONT-CACHE stand;
DONT-CACHE turret;
IF (!running_0 )
{
CALL-SCRIPT activatescr();
}
running_0 = 1;
SET ARMORED TO FALSE ;
}
Stop()
{
SET ARMORED TO TRUE ;
running_0 = 0;
CALL-SCRIPT deactivatescr();
CACHE barrel;
CACHE door1;
CACHE door2;
CACHE door3;
CACHE door4;
CACHE flare;
CACHE gun;
CACHE stand;
CACHE turret;
}
#DEFINE ACTIVATECMD CALL-SCRIPT Go();
#DEFINE DEACTIVATECMD CALL-SCRIPT Stop();
#INCLUDE "StateChg.h"
RestoreAfterDelay()
{
SLEEP restore_delay;
SET-SIGNAL-MASK 0;
START-SCRIPT RequestState( INACTIVE );
}
Create()
{
DONT-SHADE barrel;
DONT-SHADE base;
DONT-SHADE door1;
DONT-SHADE door2;
DONT-SHADE door3;
DONT-SHADE door4;
DONT-SHADE flare;
DONT-SHADE gun;
DONT-SHADE stand;
DONT-SHADE turret;
HIDE flare;
running_0 = 1;
restore_delay = 3000;
START-SCRIPT SmokeUnit();
CALL-SCRIPT InitState();
START-SCRIPT RequestState( ACTIVE );
SET-SIGNAL-MASK SIG_NUM1;
WHILE (GET BUILD_PERCENT_LEFT)
{
SLEEP <1000>;
}
START-SCRIPT RestoreAfterDelay();
}
SetMaxReloadTime(time)
{
restore_delay = time * 2 ;
}
AimPrimary(heading,pitch)
{
START-SCRIPT RequestState( ACTIVE );
SIGNAL SIG_NUM1;
SET-SIGNAL-MASK SIG_NUM1;
WHILE (!running_0 )
{
SLEEP <250>;
}
TURN turret to y-axis heading SPEED <100.02>;
TURN gun to x-axis (0 - pitch) SPEED <50.01>;
WAIT-FOR-TURN turret around y-axis;
WAIT-FOR-TURN gun around x-axis;
START-SCRIPT RestoreAfterDelay();
RETURN ( TRUE );
}
FirePrimary()
{
MOVE barrel to z-axis <-5.00> SPEED <500.00>;
SHOW flare;
SLEEP <250>;
HIDE flare;
MOVE barrel to z-axis <0> SPEED <3.00>;
}
AimFromPrimary(piecenum)
{
piecenum = gun;
}
QueryPrimary(piecenum)
{
piecenum = flare;
}
SweetSpot(piecenum)
{
piecenum = base;
}
Killed(severity,corpsetype)
{
HIDE flare;
IF (severity <= 25 )
{
IF (running_0 )
{
corpsetype = 1 ;
}
IF (!running_0 )
{
corpsetype = 2 ;
}
EXPLODE barrel type BITMAPONLY | BITMAP1;
EXPLODE base type BITMAPONLY | BITMAP2;
EXPLODE door1 type BITMAPONLY | BITMAP2;
EXPLODE door2 type BITMAPONLY | BITMAP2;
EXPLODE door3 type BITMAPONLY | BITMAP2;
EXPLODE door4 type BITMAPONLY | BITMAP2;
EXPLODE flare type BITMAPONLY | BITMAP3;
EXPLODE gun type BITMAPONLY | BITMAP4;
EXPLODE stand type BITMAPONLY | BITMAP5;
EXPLODE turret type BITMAPONLY | BITMAP1;
RETURN ( 0 );
}
IF (severity <= 50 )
{
IF (running_0 )
{
corpsetype = 2 ;
}
IF (!running_0 )
{
corpsetype = 3 ;
}
EXPLODE barrel type FALL | BITMAP1;
EXPLODE base type BITMAPONLY | BITMAP2;
EXPLODE door1 type FALL | BITMAP3;
EXPLODE door2 type FALL | BITMAP3;
EXPLODE door3 type FALL | BITMAP3;
EXPLODE door4 type FALL | BITMAP3;
EXPLODE flare type FALL | BITMAP3;
EXPLODE gun type BITMAPONLY | BITMAP4;
EXPLODE stand type BITMAPONLY | BITMAP5;
EXPLODE turret type BITMAPONLY | BITMAP1;
RETURN ( 0 );
}
IF (severity <= 99 )
{
IF (running_0 )
{
corpsetype = 3 ;
}
IF (!running_0 )
{
corpsetype = 4 ;
}
EXPLODE barrel type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
EXPLODE base type BITMAPONLY | BITMAP2;
EXPLODE door1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE door2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE door3 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE door4 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE flare type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE gun type BITMAPONLY | BITMAP4;
EXPLODE stand type BITMAPONLY | BITMAP5;
EXPLODE turret type BITMAPONLY | BITMAP1;
RETURN ( 0 );
}
corpsetype = 4 ;
EXPLODE barrel type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP1;
EXPLODE base type BITMAPONLY | BITMAP2;
EXPLODE door1 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE door2 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE door3 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE door4 type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE flare type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
EXPLODE gun type SHATTER | EXPLODE_ON_HIT | BITMAP4;
EXPLODE stand type BITMAPONLY | BITMAP5;
EXPLODE turret type BITMAPONLY | BITMAP1;
}
Post Reply

Return to “Feature Requests”