Request, scripts creating units
Moderator: Moderators
- PauloMorfeo
- Posts: 2004
- Joined: 15 Dec 2004, 20:53
Request, scripts creating units
I bereby formaly request for the possibility for a script to create a unit, as in, make it spawn out of no where.
Imagine a coocoon spawning a unit from inside, after some time, like the Zerg in Starcrap. Many more usefull uses, too. It is eagerly needed for a thing in TLL...
Imagine a coocoon spawning a unit from inside, after some time, like the Zerg in Starcrap. Many more usefull uses, too. It is eagerly needed for a thing in TLL...
- PauloMorfeo
- Posts: 2004
- Joined: 15 Dec 2004, 20:53
There must be some easy way that can be implemented...
After all, a building makes units. I don't understand the scripting system well but i'm imagining a function of the type:
After all, a building makes units. I don't understand the scripting system well but i'm imagining a function of the type:
Code: Select all
CreateUnit (UnitName, PosX, PosY, PosZ);
- PauloMorfeo
- Posts: 2004
- Joined: 15 Dec 2004, 20:53
If code-wise people would give me a hand with a few things, i would give it a go at trying to implement that.
- I need to know where is the code responsible for «doing» what the scripts have.
- I need to know where i can find the code that is run whenever we use the cheat ".give unitnumber unitname".
- I need to know where is the code responsible for «doing» what the scripts have.
- I need to know where i can find the code that is run whenever we use the cheat ".give unitnumber unitname".
- PauloMorfeo
- Posts: 2004
- Joined: 15 Dec 2004, 20:53
Ok, that was pretty dumb of me... I forgot that there is a middle program between the scripts and the COB interpreter, the COB compiler. I was having some trouble trying to understand the COB engine in Spring when i remembered it, i had to also mess with a COB compiler, like Scriptor, to make it also compile the new function, not just adjust the COB interpreter.
Was it not for that, it would have been a good effort. After all, the code to create units is already there (".cheat", ".give ArmCA"). But the fact is that that is over my league and i was really dumb forgeting about the compiler...
Bah!
Was it not for that, it would have been a good effort. After all, the code to create units is already there (".cheat", ".give ArmCA"). But the fact is that that is over my league and i was really dumb forgeting about the compiler...
Bah!
- PauloMorfeo
- Posts: 2004
- Joined: 15 Dec 2004, 20:53
I seem to have found a way to, somewhat easily, do that.
In the thread about emiting SFX through scripts:
http://taspring.clan-sy.com/phpbb/viewt ... 608#139608
In the thread about emiting SFX through scripts:
http://taspring.clan-sy.com/phpbb/viewt ... 608#139608
Please, someone at least say that it has been seen, even if it is not going to be coded in a recent future.PauloMorfeo wrote:Could that system be adapted to:Code: Select all
[SFXTypes] { explosiongenerator0=custom:EXPLOSION1; explosiongenerator1=custom:EXPLOSION2; explosiongenerator2=custom:CreateZerglings; }
Making it call, into the position defined by the custom explosion generator script, the "cheat" «.give count zergling».Code: Select all
[CreateZerglings] { [CreateUnit] { class = CCreateUnit; [properties] { dir = dir; Distance=0; Unit=ScZergling; } water=1; air=1; underwater=1; ground=1; count=2; } }
That would allow us to create units by scripts.
And shouldn't be very hard to implement. Code for unit creation is already there of when we ".cheat" + ".give ArmCa"...
You'd almost need a DeathType variable, a default of zero for spawning a wreckage whereas you could otherwise spawn off another unit. Or maybe you could spawn off multiple units within a building's footprint, like in C&C. I can see it now, a peewee dangling from a parachute pops out of every ARM aircraft destroyed mid-air.
This is all possible, however... it'd require reserving yet another bunch of IDs for "FX" in memory, or (a more elegant solution) we could write up a new bytecode to be watched (a "Create"), and then have the COB interpreter check for that bytecode and execute the appropriate instructions. It'd just require replacement of one file with Scriptor, and a very minor change in the COB interpreter.
However, from there, the implementation might be a bit difficult. While I see no reason you couldn't just spawn it right at the point... you'd need to make sure it never spawned underground, etc.
Personally, this is one of those things that makes me more sure than ever that the OSRTS project is necessary.
However, from there, the implementation might be a bit difficult. While I see no reason you couldn't just spawn it right at the point... you'd need to make sure it never spawned underground, etc.
Personally, this is one of those things that makes me more sure than ever that the OSRTS project is necessary.
Wouldn't it be more efficient to be a spinoff of the death sequence from the unit and not from the cob? I'd have to assume the scripted death animation is only called after the corpse is already revealed, since the corpses seem to spring up at that time. You could drop a newly spawned unit down instead of a corpse.