Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //The APC itself.
- Class MarineArmoredCarrier : Actor
- {
- Default
- {
- //$Title Armored Personnel Carrier
- //$Category Vehicles
- Tag "Troop Transport";
- Species "Tank";
- Species "APC";
- Species "MarineAlly";
- //Defenses
- DamageFactor "TankCrush", 0.0;
- DamageFactor "AutocannonShell", 0.3;
- DamageFactor "TankShell", 0.9;
- DamageFactor "None", 0.6;
- RipLevelMin 2;
- //========
- FriendlySeeBlocks 32;
- MaxTargetRange 4096;
- Health 1200;
- Radius 56;
- Height 68;
- Speed 12;
- Mass 10000;
- //Flags
- Monster;
- -CountKill;
- +Friendly;
- +AvoidMelee;
- +LookAllAround;
- +NeverRespawn; //No infinite marine supply.
- +Telestomp;
- +NoBlockMonst;
- +MThruSpecies;
- +NoInfightSpecies;
- +DontDrain;
- +NoBlood;
- +PuffOnActors;
- }
- enum APCSoundSlots
- {
- CHAN_MOVING = 91837,
- CHAN_DOORS = 91838
- }
- int User_MarinesToSpawn; //The limit to how many marines the APC will spawn.
- int MarinesSpawned; //Keeps track of how many marines the APC has spawned.
- int RelativeAngle;//Used to make the APC turn 180 degrees to deploy troops.
- Override Void PostBeginPlay()
- {
- Super.PostBeginPlay();
- User_MarinesToSpawn = 6; //Default amount of marines to deploy;
- MarinesSpawned = User_MarinesToSpawn;
- }
- Override Void Tick()
- {
- Super.Tick();
- If (IsFrozen()) {A_StopSound (CHAN_MOVING);}
- If (InStateSequence (CurState, ResolveState ("See")))
- { A_StartSound ("APC/Moving",CHAN_MOVING,CHANF_LOOPING);} Else {A_StopSound (CHAN_MOVING);}
- }
- States
- {
- Spawn:
- APCM A 8 A_LookEx (maxseedist:8192,1536);
- Loop;
- See:
- APCM AB 4 A_Chase (null,"OpenDoors"); //SpinAround
- Loop;
- SpinAround:
- APCM AB 4 //Spins the APC until it has turned in a full 180 degree angle.
- {
- If (RelativeAngle >= 180)
- {
- RelativeAngle = 0;
- SetStateLabel ("OpenDoors");
- A_Log ("Deploying marines now...");
- }
- A_SetAngle (Angle+10,SPF_INTERPOLATE);
- RelativeAngle = RelativeAngle + 10;
- }
- Loop;
- OpenDoors: //Add a metal door opening sound.
- TNT1 A 0
- {
- //Don't deploy any more marines if MarinesSpawned is over the MarinesToSpawn user variable.
- If (MarinesSpawned <= 0){SetStateLabel ("See"); A_LOG ("no marines left");}
- }
- APCB A 16;
- APCB B 16;
- Goto DeployMarines;
- DeployMarines:
- APCB B 40
- {
- Bool Spawned = False;
- Actor SpawnedActor = Null;
- int RandomDoor = RandomPick (0,-24); //Picks a random door for the marine to come out from
- [Spawned,SpawnedActor] = A_SpawnItemEx ("APCInfantrySpawner",xofs:-96,yofs:RandomDoor,zofs:24);
- //If the APC has a target, transfer it to the spawner which then transfers it to the marines
- If (SpawnedActor && Self.Target)
- {
- SpawnedActor.Target = Self.Target;
- }
- If (Spawned == True) {MarinesSpawned--;}
- a_logint (marinesspawned);
- }
- //TNT1 A 0 A_Jump (72,"ChangePosition");
- Loop;
- CloseDoors:
- APCB BA 16;
- Goto See;
- ChangePosition:
- APCM ABABABAB 4 A_Wander();
- Goto See;
- }
- }
- //The spawner for the marines, hopefully I'll be able to make a suer variable that gives you multiple spawners to choose from for each APC
- Class APCInfantrySpawner : RandomSpawner
- {
- Default
- {
- DropItem "MarineAllyMG", 255, 140;
- DropItem "MarineAllyCG", 255, 96;
- DropItem "MarineAllySG", 255, 128;
- DropItem "MarineAllyPistol", 255, 96;
- DropItem "MarineAllySniper",255, 64;
- DropItem "MarineAllyMinigun", 255, 8;
- }
- //The marines have to be set to being friendly again because otherwise they get spawned
- //as enemies for some reason, also for some reason, this code seems to make the APC
- //drop off 3 more marines than what MarinesToSpawn is set to since before I added this
- //code that did not happen.
- Override Void PostSpawn (Actor Spawned)
- {
- If (Self.Target) {Spawned.Target = Self.Target;}
- Spawned.bFriendly = True;
- Super.PostSpawn (Spawned);
- }
- }
Add Comment
Please, Sign In to add comment