Corpse Options

Corpse Options

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Corpse Options

Post by Warlord Zsinj »

Yes, to add to the increasing torrent of unlikely to be implemented requests, here's a small one from SWS:

We would very much like to be able to return which corpse file to use from the script.

Currently, the corpse file is referenced in the FBI, and can only be used in the sequence ("full corpse", "degraded corpse", "heap", etc).

We would like to have the killed() script return("my unit dead", 1); so that the unit would die with the corpse allocated, and then degrade according to what is specified in the corpse file.

We feel this would give far more options to modders, and would complement the death animation system far better, as currently we have to end the animation in a way that will comply with the corpse specified.
We would like to have multiple death animations, with each animation resulting in a different corpse.

For example, on the ATAT, we would like to make it fall over a couple of different ways after it is killed. However, because of the corpse limitation, we can only have it fall over in the way that reflects the single corpse option we have available.

Code: Select all

How it works now:
Corpse:
[Myunit_dead] -> [Myunit_heap] -> nothing

FBI:
corpse=Myunit_dead;

Script:
Killed(severity,corpsetype)
{
  corpsetype = 1; // [Myunit_dead]
  corpsetype = 2; // [Myunit_heap]
  corpsetype = 3; // nothing
  return(corpsetype); //engine spawns given corpse
}

How it should work:
Corpse:
As many sequences as you want, for example
[Myunit_dead] -> [Myunit_heap] -> nothing
[Myunit_dead2] - > [Myunit_heap2] -> [Myunit_heap2_2] -> nothing

FBI:
Depreciation of corpse tag

Script:
Killed(severity,corpsetype)
{
  if(severity < 50) {
    return("Myunit_dead",2); //use Myunit_dead sequence starting at Myunit_heap
  }
  if(severity >= 50) {
    return("Myunit_dead2",1); //use Myunit_dead2 sequence starting at Myunit_dead2
  }
}
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

I thought the scripts couldnt return strings?
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

"return" can be anything as long as the whatever called the script accepts it. Theoretically at least, I don't know if Scriptor was set to only return numerals.
I'd be a lot happier if we could define a set of corpses for a unit, and have the Killed() script return the index of the needed one.
Post Reply

Return to “Engine”