Gah - a solution with more questions. – EntropicLqd

Legacy:Sweavo/MutASTurretsInONS

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

This is a project to make Ion Cannon, Link Turret and Minigun Turret behave more like Onslaught turrets in an Onslaught game, in a mutator. The reason it's done as a mutator is so that a server admin can just chuck it on the server without having to edit all the maps it applies to. Maybe this is a mistake, if you were interested in this functionality, post something here and I'll adapt the scheme.


While fiddling with this, I was playing with setting the team property at runtime. The link turrets on ONS-MassDestruction start shooting at the enemy as soon as you set their team. I'm having trouble figuring out when the turret's controller gets created and the turret gets possessed. Creating a virgin onslaught map and placing an ASVehicleFactory_LinkTurret in it, I get the following:

  • By default the turret automatically fires at anyone on the map
  • Setting AIVisibility to 0 stopped the firing but it still scans the surroundings.

While playing with THAT, I realise how pitifully few entrypoints a link turret has. SO here's the current thought:

A subclass of ASLinkTurret called ONSLinkTurret, which will simply be an ASLinkTurret with more entry points DONE

A subclass of ONSVehicleFactory called ONSASTurretFactory, which should be designed to handle ASLinkTurret (therefore also ONSLinkTurret) and potentially the Ion Cannon too. At present, I have ONSLinkTurretFactory that is specific to linkturrets

  • make a factory that creates link turrets with correct ONS team, teamlocked, and with no automatic controller. DONE

Summary at 2005/06/22:[edit]

I have ONSLinkTurret which is a rip of ASTurret_LinkTurret (as opposed to a subclass) and subclasses ASTurret. Maybe if I'd subclasses something from ONS it would have given me more stuff for free... who can tell... [Sweavo I can ... i tried it and it was rubbish! ] ONSLinkTurret has a few default properties added to the source for ASTurret_LinkTurret:

     bTeamLocked=True
     bEnterringUnlocks=True
     EntryRadius=200.00
     AutoTurretControllerClass=Class'MutScratchMutator.PassiveTurretController'

... the first two are for more conventional ONS team play dynamics than MassDestruction currently has, and the next makes the turret much easier to get in and out of. The last prevents the turret from scanning side to side when no-one is in it, and more importantly, prevents it automatically shooting at the opposing team when spawned.

PassiveTurretController is a turret controller that simply enters state "psv" in which it takes no action.

I also have ONSLinkTurretFactory, extending SVehicleFactory

defaultproperties
{
     RedBuildEffectClass=Class'Onslaught.ONSPRVBuildEffectRed'
     BlueBuildEffectClass=Class'Onslaught.ONSPRVBuildEffectBlue'
     VehicleClass=Class'MutScratchMutator.ONSLinkTurret'
     bStatic=false;
     bNoDelete=false;
}

The last two are so that the class can be spawned by a mutator. I couldn't get the Mesh property to work. I wanted it to be StaticMesh=StaticMesh'AS_Weapons_SM.Turret.LinkTurret_STATIC' but it didn't seem to want to play ball.

Finally, the mutator, MutASTurretsInONS

function bool CheckReplacement( Actor Other, out byte bSuperRelevant )
{
 
	if ( ASVehicleFactory_LinkTurret(Other) != None )
	{
		Log("Replaced a link turret");
		// Can't seem to actually destroy the ASVehiclefactory so we just let it lie dormant
		ASVehicleFactory_LinkTurret(Other).VehicleClassStr="None";
		// Our custom vehiclefactory has bDeleteMe and bStatic set to false, just so that it
		// can be spawned in this way.
		ReplaceWith( Other, "MutScratchMutator.ONSLinkTurretFactory");
		return false;
	}
	else
		return true;
 
}

This has to use this rather unusual way of replacing the pawn because replacee is bNoDelete and/or bStatic.

Update at 2005/11/14[edit]

At this stage, the secondary fire on the link turret seemed to be coming from the map origin rather than the turret. This gave an error about instigator being none.

The beam-at-origin problem was only in first-person view (thanks Ghost3021!) and it turned out that the beameffect for the linkturret casts the turret to an ASLinkTurret in order to get the beam origin. My turret was not a subclass but a replacement for ASLinkTurret so it was returning NONE when attempting to cast to ASLinkTurret. I've solved this by creating weaponattachment, firemode, and beameffect to go with the replacement turret. This baby seems to be all go!

TODO:[edit]

  • Get hijacked announcement to trigger when ONSLinkTurret stolen
  • Get turrets to disappear or unlock when powernode nearby is destroyed.
  • BETTER: look at how ONS turrets are powered / unpowered, and look at using that approach instead.
  • Extend to miniguns