Posted: Thu Jul 14, 2011 6:22 pm Post subject:
Spawning random crates with debris
A while back I read LKO saying that you can spawn random crates with a building that has Wall=yes and ToOverlay=CRATE (can't remember the thread this was in). Anyway, since debris can be used to spawn tiberium, I tried to use the same logic to spawn random crates. To my surprise it actually works, though I still have some problems with it...
Start in art.ini. You need the same stuff as for tiberium spawning buildings. Note that these examples are from my quick tests, the values need to be adjusted so only the desired amount of crates spawn, and at the desired interval.
Code:
; Building active anim
[BUILDINGX_A]
Image=none
Normalized=yes
LoopStart=0
LoopEnd=10
LoopCount=-1
Rate=10
Surface=yes
NewTheater=no
DetailLevel=0
;DemandLoad=true
TrailerAnim=TSPAWNS1
TrailerSeperation=800
; Crate spawner
[TSPAWNS1]
Image=DBRIS1LG ;none ; Enable image only for testing
Elasticity=0.0
MinZVel=7.0
MaxXYVel=40.0
ExpireAnim=none
Damage=0
DamageRadius=0
Warhead=Organic
LoopStart=0
LoopEnd=14
LoopCount=5
Rate=10
DetailLevel=0
RandomRate=400,400
Bouncer=yes
Theater=yes
IsTiberium=true ; These 3 keys below are very important!!!
TiberiumSpreadRadius=1
TiberiumSpawnType=TIB12
Next in rules.ini, search for [TIB12] and change it to this
This should make the building active anim spawn random crates near the building. If you edited the crates to spawn only credits, this could be used to create a very clean, non-hacky supply drop building. The crate spawning interval and position should be adjustable with proper active anims and editing the TSPAWNS1 keys.
Now I have 2 problems with the logic so far:
1) I can't seem to make the crates visually appear as crates in the game. I tried to replace tib12.tem with a custom tib12.tem that has the crate image on all the frames (I've attached it to this post), but for some reason the game still draws tiberium where the crate spawns. The spawned tiberium also seems bit messed up and the palette is wrong.
2) The area where the crate spawned is also harvestable, which means another crate cannot spawn there until you have cleared it out with a harvester. I tried removing the IsTiberium=true, TiberiumSpreadRadius=1 keys from TSPAWNS1, but removing either or both of these keys resulted in no crates being spawned.
Also, I recall some talk that the game does not make use of all the Tiberium types? So using TIB12 for this crate spawning logic shouldn't make random crates appear in normal tiberium fields? Can someone confirm this since I might remember it wrong.
ok I've got the two problems mentioned earlier fixed and the logic works pretty flawlessly now. Here are the changes to the code in the previous post (and explanations below):
Instead of trying to override tib12.tem, I created a new cratetest.tem and used Image=CRATETEST in rules.ini. This makes the crate appear correctly. As for tiberium being spawned around the crates, I noticed that if you use eg. TiberiumSpawnType=TIB16, the game randomly spawns nearby OverlayTypes around the area where the debris hit, in this case OverlayTypes TIB16, TIB17, TIB18 and TIB19. I first tried to use TiberiumSpawnType=TIB20 and the game spawned pieces of bridges next to the crates, since there is no TIB21 . I tested different values and with TIB17 the game didn't spawn bridge pieces anymore.
There is still one little problem. Tiberium cannot be spawned on top of certain surfaces, like pavement or roads. I'm not sure if there is a way to change it, and even if there is, it would probably make ordinary tiberium grow on pavement too... would need to be able to define it individually for each OverlayType to avoid problems.
Think this logic could be used to kind of emulate the oil derricks from Red Alert 2. Create a civilian structure (possibly indestructible), that spawns crates around it during certain intervals. Wouldn't require engineers, but would still create some interesting gameplay as players would race to capture the crates. I'm considering using the logic in my mod to make the Forgotten logistic center spawn crates at certain intervals. It would be bit like a superweapon / support power. And as I mentioned earlier, this could be used to create a pretty neat supply drop superweapon, as the cost of getting rid of the random crates (well, all crates would always spawn cash). _________________ QUICK_EDIT
Joined: 13 Feb 2007 Location: C:\Westwood\ TechLevel=12
Posted: Fri Jul 15, 2011 4:15 am Post subject:
Very nice!
It could work more like the RA2 oil derricks if the active anim is powered. So that if it was a Civ building it would be unpowed and spawn no crates but once take by a player it would become powed and spawn crates. _________________
Was thinking of something that doesn't even need this logic, just the Wall=yes and ToOverlay=CRATE trick that LKO described. You could buy a "structure" that costs 2000, and when you place it on the map it turns into a money crate. You could place the crate anywhere on the map (Adjacent=255). This would allow you to donate money to your allies, even to your enemies if for whatever reason you wanted to do that. The "donation structure" would even build alot faster than normal buildings, thanks to reduced wall construction times.
Or have an even more expensive structure that showers the area with random crates. Could be used to send help to allies or your own forces out in the field. _________________ QUICK_EDIT
Long ago i had such a logic implemented in TI too, but found the crates too powerful in multiplayer and since i didn't want to give them all only money, i dropped the logic again.
Some things you should take care of, if you haven't done already.
1. You don't need the name TIB17-TIB20. You can also use CRATE1-CRATE4, as TiberiumSpawnType spawns any overlaytype regardless of the name.
2. Put the new overlays at the end of the overlaytypes list, because the 4 different tiberium types are hardcoded to use overlays from a specific position in the overlaytypes list. _________________ SHP Artist of Twisted Insurrection: Nod buildings
Joined: 28 Apr 2009 Location: Auckland, New Zealand
Posted: Fri Jul 15, 2011 8:18 am Post subject:
Wait is it possible to decide what kind of crates spawn, because one could theoretically use this for a lot of things such as a spy satellite. _________________ Beta Tester for Mental Omega 3.0
Joined: 13 Feb 2007 Location: C:\Westwood\ TechLevel=12
Posted: Fri Jul 15, 2011 8:33 am Post subject:
Crates are random crates in MP games. You could make all crates reveal map but it would remove all other types of crates in the game. _________________
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