|
Page 1 of 1
|
[ 13 posts ] |
|
Spawner Coding Help Needed
Author |
Message |
Slayer0019
Joined: Sun May 24, 2009 1:16 pm Posts: 11
|
Spawner Coding Help Needed
Hey guys, I've been playing around with Cortex Command for a while now, digging through coding and rebalancing the whole time, and now I want to make something myself by modifying the Zombie Spawner to pump out pre-equipped soldiers, some basic filler troops like Coalition lights with assault rifles. I know how it's done, the AddInventory command for the gun, but I can't get an automated spawn system to work.
I was looking at the coding for the Zombie Spawner and Bomb Spawner, trying to see if I could get them to work in skirmish, but despite making them buyable they still don't function, just sit there and soak up bullets.
So, is there any way to kick the zombie spawner to life? If not, how do I set an emitter so that the actors it 'emits' are on the team of the player who build the bunker module, or is that automatic?
|
Sun May 24, 2009 2:11 pm |
|
|
carriontrooper
Joined: Mon Apr 13, 2009 12:27 pm Posts: 813 Location: Yogyakarta, Indonesia. A slice o' paradise.
|
Re: Spawner Coding Help Needed
You need Lua for that. The lua of the zombie and bomb generators are in the scenes in the missions, methinks?
|
Sun May 24, 2009 2:21 pm |
|
|
Slayer0019
Joined: Sun May 24, 2009 1:16 pm Posts: 11
|
Re: Spawner Coding Help Needed
Nope, no Lua files in the missions folder. Take a look at the Zombie Spawner coding. If emissions work as I understand them (creating something, usually a sprite but in this case an actor, x times per minute), then they should do that on their own. Dropship exhaust is an emitter, is it not? rather than exhaust, I just want to emit actors.
|
Sun May 24, 2009 2:24 pm |
|
|
carriontrooper
Joined: Mon Apr 13, 2009 12:27 pm Posts: 813 Location: Yogyakarta, Indonesia. A slice o' paradise.
|
Re: Spawner Coding Help Needed
GoTo C:\Program Files\Data Realms\Cortex Command\Missions.rte\Scenes\Scripts and look at the lua file. Srsly. about line 246 or something.
|
Sun May 24, 2009 2:30 pm |
|
|
Slayer0019
Joined: Sun May 24, 2009 1:16 pm Posts: 11
|
Re: Spawner Coding Help Needed
Code: self.Generator1:EnableEmission(genInnerEnabled); else self.Generator1 = nil; self.BombMaker1:EnableEmission(false); end If I'm reading that right, that's saying something like "Zombie generator emission is enabled, unless x condition is met." Seeing as the emission is in the Zombie generator code: Code: AddEmission = Emission EmittedParticle = AHuman CopyOf = Zombie Medium ParticlesPerMinute = 15 BurstSize = 1 Spread = 0 MaxVelocity = 1.0 MinVelocity = 0 PushesEmitter = 0 Just like that, it should emit automatically, unless the above Lua code tells it not to. I'm not trying to be argumentative, I'm just making sure I understand this. Because from what I can tell, there's no reason the Zombie generator shouldn't just spawn zombies.
|
Sun May 24, 2009 3:01 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Spawner Coding Help Needed
Let's get the entire code related to a zombie spawn. First, placing the object in the scene: Code: self.Generator1 = CreateAEmitter("Zombie Generator"); self.Generator1.Pos = Vector(339, 219); self.Generator1.Team = self.CPUTeam; self.Generator1:EnableEmission(false); MovableMan:AddParticle(self.Generator1); Note that emissions are DISABLED by default. Then the enabling code, based on the player actor's position in the scene: Code: local genOuterEnabled = self.CurrentFightStage >= self.FightStage.OUTERCAVE; local genInnerEnabled = playerInCave or self.Generator2 == nil; Then a little later you get this line: Code: self.Generator2:EnableEmission(genOuterEnabled); What this is saying is that if genOuterEnabled reports back true, turn on emissions. Otherwise, don't do anything (since by default it will report back nil, AKA false). And then this: Code: else self.Generator2 = nil; self.BombMaker2:EnableEmission(false); end checks whether the generator still exists. If it doesn't, then it turns off the bomb spawn. That's basically the entirety of the logic regarding the generators, at least. So obviously the reason they won't work in skirmish is the lack of any of these zones. If you duplicate the object and then change the script to be emissions enabled on function Update(self) then it'll emit whatever you tell it to just fine.
|
Sun May 24, 2009 4:54 pm |
|
|
Slayer0019
Joined: Sun May 24, 2009 1:16 pm Posts: 11
|
Re: Spawner Coding Help Needed
What with me being completely unskilled in Lua, could I just paste a similar emission function onto something else, kinda like this: Code: AddEffect = AEmitter AddEmission = Emission EmittedParticle = AHuman CopyOf = Zombie Medium ParticlesPerMinute = 15 BurstSize = 1 Spread = 0 MaxVelocity = 1.0 MinVelocity = 0 PushesEmitter = 0 If so, how would I do that? I assume I can't just slap that onto a bunker bit and expect it to work.
|
Sun May 24, 2009 5:02 pm |
|
|
Noobos
Joined: Tue May 19, 2009 11:21 pm Posts: 23 Location: Ostrava, Czech Republic
|
Re: Spawner Coding Help Needed
I assume it's the same thing as gibbing - if you emit actors, you wont be able to control them. Still it can be easily done with a bit of Lua.
|
Sun May 24, 2009 7:13 pm |
|
|
Slayer0019
Joined: Sun May 24, 2009 1:16 pm Posts: 11
|
Re: Spawner Coding Help Needed
I figured Lua would be involved. Alright, how on earth is that done? I am Lua-challenged.
EDIT: Actually, why does the Zombie Generator have to be bound to the Lua file? Can't it be made so that emissions are enabled by default, regardless of any positions? Wouldn't this cut out the need for Lua?
|
Sun May 24, 2009 10:41 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Spawner Coding Help Needed
Slayer: A++ Code: AddEffect = AEmitter CopyOf = Zombie Generator PresetName = ZG Enabled Buyable = 1 AddToGroup = Bunker Systems EmissionsEnabled = 1
That'll spit out the standard zombie generator zombie, medium, constantly. Or should. If it doesn't work then I'll whip up a proper .rte.
|
Mon May 25, 2009 6:10 am |
|
|
Slayer0019
Joined: Sun May 24, 2009 1:16 pm Posts: 11
|
Re: Spawner Coding Help Needed
Thanks, I figured something like that would be ideal. Only problem is, I pasted that Onto the bottom of the .ini where the original Zombie Generator is, and it keeps rejecting the last line, the "EmissionsEnabled = 1" I tried rewording it to EnableEmissions = 1, but that didn't help. The code looks like it should work, but then, so does the code for the original Generator. Is it possible that EmissionsEnabled isn't a valid command? EDIT: It's not, but EmissionEnabled, without the "s", is. Zombie spawn works, now all I have to do is mess with it to spawn coalition lights pre-equipped with guns. Thanks guys! EDIT 2: Alright, I got the thing pumping out Coalition lights, but they aren't getting the guns I told them to. My code looks like this: Code: AddEmission = Emission EmittedParticle = AHuman CopyOf = Soldier Light AddInventory = HDFirearm CopyOf = Assault Rifle AddInventory = TDExplosive CopyOf = Grenade ParticlesPerMinute = 3 BurstSize = 1 Spread = 0 MaxVelocity = 1.0 MinVelocity = 0 PushesEmitter = 0 That's the whole chunk on the actor emission. Can the AddInventory code be there, or would it have to be with the Coalition Light?
|
Mon May 25, 2009 2:29 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Spawner Coding Help Needed
I'd say do it like this: Code: AddActor = AHuman CopyOf = Soldier Light PresetName = Spawned Soldier 1 AddInventory = HDFirearm blah blah blah
AddEffect = AEmitter CopyOf = Zombie Generator PresetName = Soldier Generator blah blah blah AddEmission = Emission spawned soldier 1 emission code goes here See, the thing with CC's copyofs is that if you don't change the presetname it usually won't load your changes; it's a simple fix but a bit odd.
|
Mon May 25, 2009 6:54 pm |
|
|
Slayer0019
Joined: Sun May 24, 2009 1:16 pm Posts: 11
|
Re: Spawner Coding Help Needed
Alright, now not only does everything work, but I have a better understanding of Cortex Command coding. Thanks Grif. I'll see what I can do with all this.
|
Mon May 25, 2009 10:04 pm |
|
|
|
|
Page 1 of 1
|
[ 13 posts ] |
|
Who is online |
Users browsing this forum: Google [Bot] |
|
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 post attachments in this forum
|
|