Re: Spawn Ratios (and other, lesser questions for the lua savvy)
Hoo boy, this turned out pretty lengthy, hope it answers everything okay.
math.random or RangeRand would be what you want. I'd suggest setting up a timer with a pretty long interval and after that timer has hit its interval, do something like:
Code:
if math.random() < 0.25 then
self:SpawnStuff etc.
end
math.random by default goes from 0 to 1 (though I don't think it can actually be zero) so 0.25 would be a quarter chance. You can also just use the math.random by itself and check if it's < something a lot lower or greater than something a lot higher (remember 1 is max). For what it's worth, RangeRand is similar to math.random except that when you put in arguments for math.random to set a max and min, it will only give integers, where RangeRand will always give numbers with decimals (and I think it always needs to have arguments put in, though I'm not 100% sure of this).
Next:
1) Look at maginot mission for how to do this, or look at many of the shield missions. If you need a more full explanation don't hesitate to ask, but it's relatively lengthy and I'm sure you can figure it out with examples.
2) Yes, there are a few ways to do this depending on what you want. The easiest one is to simply switch back to the actor you want to keep controlled when it's not controlled like so:
Code:
if not self.DesiredActor:IsPlayerControlled() then
for player = 0, self.PlayerCount - 1 do
self:SwitchToActor(self.DesiredActor, player, self.PlayerTeam);
end
end
self.DesiredActor and self.PlayerTeam need to be defined ahead of time of course.
You can also keep the player from scrolling away at all (i.e. holding down q or e and looking around) with
Code:
for player = 0, self.PlayerCount - 1 do
SceneMan:SetScrollTarget(self.DesiredActor.Pos, 0.02, true, player);
end
The second argument is the speed it scrolls at, 1 being instantly, which is unimportant here. The third checks for scenewrapping I think.
I can't remember the other way to do this off the top of my head, but you should be able to simply make it so the other actors don't have the selection circle at all, and the wouldn't show up at all as a selectable actor when holding q or e. I can look into it if you want (and should for my own knowledge either way).
3. Here you go:
Code:
if not MovableMan:IsActor(self.DesiredActor) or self.DesiredActor.Health == 0 then
if self.ActivityState ~= Activity.OVER then
self.WinnerTeam = self.PlayerTeam;
ActivityMan:EndActivity();
AudioMan:StopAll();
for player = 0, self.PlayerCount - 1 do
self.braindead[player] = true;
end
end
end