Random Corpses.

Random Corpses.

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Random Corpses.

Post by Argh »

Um, pretty much like the random voices thing, only for corpses. Right now, they aren't random- they follow a linear progression. And, at least so far as I can tell, the whole corpse= lines in Killed() don't seem to actually do anything. Feel free to explain, if I've missed something there.

Also, while I'm asking for stuff, could somebody in the LUA community please develop a LuaCOB that will let me replace a dead Unit with another Unit upon Killed() and then assign that Unit to the Gaia?

I just want to be able to animate the dead a lot more interestingly, with control over smoke, flames, sparkly bitz, etc., etc. I think that the ideal way to go about this is to simply replace the dead Unit with another Unit that gets assigned to Gaia, so that nothing will target it further- then I can "just" animate the actual moment of death in Killed(), call a new Unit to replace the one I just destroyed, and have that new Unit do whatever it is I want it to. Dead things in Spring are, just like everything else having to do with Features, really bland, and need scripting support. I just haven't got the time this week to do further LUA stuff (trying to deliver a big build to the team and stuff), so if anybody has time and can write a complete script that will do this fairly-simple task, I'd really appreciate it (and yes, you'll get your name in our Credits, and yes, we're perfectly happy if you want to GPL whatever you write).
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

.75b1 Changelog wrote:- Weapons don't target dead and crashing units anymore.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Yeah, I know, but that's not the same as, "on Killed(), roll a random number, pick 1 of 5 animations for the death sequence, then based on that death sequence, replace the Unit with 1 of 5 Units, assigned to Gaia, that each reflect the particulars of the death sequence in a natural way".

For example, what if my Giant Mech of Doom has one death sequence where it ends with one leg blown off, but the corpse always has two, intact legs? What about a gasoline tanker that blows up, and I want it to show a huge fireball, and then replace it with a model that is two different parts, all blackened and broken, and then have them do a further animation showing the spectacular results of the fiery BOOM! In DoW, units die in lots of ways, including what are referred to as "sync-kills", where a particular weapon causes a particular death sequence. Well sure, we now have HitByWeaponID, so we can detect those weapons- that's great, but, again, if we do that in Killed(), but then the resulting corpse has nothing to do with the death... we're breaking immersion here. Kind've important, if we're going to have pro-quality games, frankly.
User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom »

Thats where the corpse variable comes in. Im not sure exactly how it works, but I know that it can do exactly what your asking for. If one of the more competent scripters who know about the corpse tag can come explain things? This can all be done with out LUA trickery.
User avatar
Neddie
Community Lead
Posts: 9406
Joined: 10 Apr 2006, 05:05

Post by Neddie »

The current corpse tag is based on damage dealt, if I recall?
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Couldn't you just use corpsenum=random number in the killed()?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

No, because that just sends me to a given Feature, which has to be in the FeatureDead hierarchy. When a Unit dies, that whole corpsenum thing refers back to the chain of Features called by FeatureDead, like this:

Code: Select all

[misc_wreckage_2x2a]
	{
	world=All Worlds;
	description=Misc. Wreckage;
	object=wreckage/2x2a.s3o;
	featuredead=misc_wreckage_2x2a2;
	footprintx=2;
	footprintz=2;
	height=0.1;
	blocking=0;
	hitdensity=100;
	metal=75;
	damage=200;
	reclaimable=1;
	}

[misc_wreckage_2x2a2]
	{
	world=All Worlds;
	description=Misc. Wreckage;
	object=wreckage/2x2a2.s3o;
	featuredead=misc_wreckage_2x2a3;
	footprintx=2;
	footprintz=2;
	height=0.1;
	blocking=0;
	hitdensity=100;
	metal=50;
	damage=200;
	reclaimable=1;
	}

[misc_wreckage_2x2a3]
	{
	world=All Worlds;
	description=Misc. Wreckage;
	object=wreckage/2x2a3.s3o;
	footprintx=2;
	footprintz=2;
	height=0.1;
	blocking=0;
	hitdensity=100;
	metal=50;
	damage=200;
	reclaimable=1;
	}
So, if you declare corpsenum == 4, then I think it automatically reverts to corpsenum 1, which in this case is misc_wreckage_2x2a. If you declare it to be 3, then it will be misc_wreckage_2x2a3, but when it dies, since that one doesn't list a featureDead, it simply disappears. See? Pretty gosh-darn inflexible, and since it uses Features, which we all know how much I hate anyhow, it won't support animation, custom sounds, etc.! This is not a terribly-good system, if you have units that are visually very different from one another, or want to have really awesome death animations- the amount of visual disconnect that's created is very annoying, frankly.
[/code]
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

Why dont you just use gadget:UnitDestroyed instead of messing with lua<->cob? far far simpler.

Try not to think fo lua as extending cob but simply as a scripting language in its own right. Sometimes its better to replace a limited spring feature entirely with your own in lua.

Look at the voices widget in CA for example.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch »

If you refer to a non-existing corpse number (say, number 4 in a 3-corpse sequence), then no corpse is created at all. Useful sometimes (for example when damage is so great the unit is blown up into pieces).
Also, if a number greater than 1 is specified for a corpse in Killed(), that corpse cannot be resurrected back to a unit.
I use corpsenum for floating vehicles which leave a blocking corpse on land but a non-blocking one in water (so that it doesn't stay at the surface). The downside is, of course, that the second corpse cannot be resurrected.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I use it to prevent Lolis from leaving a corpse when they're blown to pieces (which happens when the last hit was an explosive weapon, independent of the damage value).
User avatar
Comp1337
Posts: 2434
Joined: 12 Oct 2005, 17:32

Post by Comp1337 »

LOLIS?
EXPLOSIVE WEAPONS?
where do i sign up?
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Post by Nemo »

Eeeek. I better hop on that work for SWS.
Last edited by Nemo on 02 Aug 2007, 13:17, edited 1 time in total.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

*reads Comp's post*
*reads Nemo's post as a reply to Comp*
*sniggers*
User avatar
Nemo
Spring 1944 Developer
Posts: 1376
Joined: 30 Jan 2005, 19:44

Post by Nemo »

>_> <_<
Post Reply

Return to “Feature Requests”