[Solved] No-Team Trigger Cannon (similar to TeamCannon)

Discussions about Coding and Scripting
Post Reply
User avatar
ANUBITEK
Adept
Posts: 261
Joined: Sun Dec 28, 2014 1:10 am
Location: Anubitek

[Solved] No-Team Trigger Cannon (similar to TeamCannon)

Post by ANUBITEK »

I'm working on an actor that uses UT99's TeamCannon code, right now it is still being put together but I've run into an issue. The way it is set up is straight forward: if it sees a player, begin shooting. If not, don't shoot. Problem is that the RPG_Cannon is taking about 7-8 seconds before beginning its "auto state idle", as seen below in the log (when idle begins, the actor rotates back to its original position then plays a sound). Does anyone know what would be wrong here? All I've done is edit the original script, pulling mostly animation-related code out and removing the ability to kill the actor.

First, log:

Code: Select all

Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.PlayerMove:0256) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.PlayerMove:0256) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.PlayerMove:0256) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.PlayerMove:0256) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.PlayerMove:0256) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.PlayerMove:0256) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.PlayerMove:0256) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
ScriptLog: StartDeactivate()
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.PlayerMove:0256) GetAnimGroup: No mesh
Log: RPG_LionPlatformer Autoplay.RPG_LionPlatformer0 (Function Engine.PlayerPawn.PlayerWalking.ProcessMove:00B5) GetAnimGroup: No mesh
ScriptLog: PlayDeactivate()
I will stand in front of the RPG_Cannon and after a couple of seconds, this is all I get along with a sound. So that means that it is taking a while before "auto state idle" even begins, which can be seen in the code below:

Code: Select all

//=============================================================================
// RPG_Cannon.
// TeamCannon from UT99, no team alliance and begins firing.
//	Cannot be destroyed.
//=============================================================================
class RPG_Cannon extends RPG_StationaryPawn;

var() localized string PreKillMessage, PostKillMessage;
var() Class<Projectile> ProjectileType;
var() sound FireSound;
var() sound ActivateSound;
var() sound DeActivateSound;
var() bool bLeadTarget;
var bool bShoot; 
var float Drop;					// How far down to drop spawning of projectile
var float SampleTime; 			// How often we sample Instigator's location
var int   TrackingRate;			// How fast Cannon tracks Instigator
var rotator StartingRotation;

function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType);
function Died(pawn Killer, name damageType, vector HitLocation);
//=============================================================================
// General functionality
//=============================================================================
function PostBeginPlay()
{
	Super.PostBeginPlay();
	StartingRotation = Rotation;
}

simulated function Destroyed()
{
	Super.Destroyed();
}

function string KillMessage( name damageType, pawn Other )
{
	return (PreKillMessage@Other.PlayerReplicationInfo.PlayerName@PostKillMessage);
}

function Trigger( actor Other, pawn EventInstigator )
{
	log("Was Triggered");
	GotoState('DeActivated');
}

/*simulated function SpawnBase()
{
	GunBase = Spawn(class'CeilingGunBase', self);
}*/
//=============================================================================
// Sounds
//=============================================================================
function PlayDeactivate()
{
	log("PlayDeactivate()");
	PlaySound(ActivateSound, SLOT_None,5.0);
}

function PlayActivate()
{
	log("PlayActivate()");
	PlaySound(ActivateSound, SLOT_None, 2.0);
}
//=============================================================================
// Combat
//=============================================================================
function StartDeactivate()
{
	log("StartDeactivate()");
	SetPhysics(PHYS_Rotating);
	DesiredRotation = StartingRotation;
}

function DropAdjust()
{
	log("DropAdjust()");
	if (DesiredRotation.Pitch < -13400 )
	{
		Drop = 35;
	}
	else if (DesiredRotation.Pitch < -10600 ) 
	{
		Drop = 30;
	}
	else if (DesiredRotation.Pitch < -7400 ) 
	{
		Drop = 25;
	}
	else if (DesiredRotation.Pitch < -4200 ) 
	{
		Drop = 20;
	}
	else if (DesiredRotation.Pitch < -1000 ) 
	{
		Drop = 15;
	}
	else 
	{
		Drop = 10;
	}
	log("Drop ="$Drop);
}
	
function Shoot()
{
	local Vector FireSpot, ProjStart;
	local Projectile p;

//	if (DesiredRotation.Pitch < -20000) Return;
	DropAdjust();
	PlaySound(FireSound, SLOT_None,5.0);
	ProjStart = Location+Vector(DesiredRotation)*100 - Vect(0,0,1)*Drop;
	log("Shoot");
	if ( bLeadTarget )
	{
		FireSpot = Target.Location + FMin(1, 0.7 + 0.6 * FRand()) * (Target.Velocity * VSize(Target.Location - ProjStart)/ProjectileType.Default.Speed);
		if ( !FastTrace(FireSpot, ProjStart) )
			FireSpot = 0.5 * (FireSpot + Target.Location);
		DesiredRotation = Rotator(FireSpot - ProjStart);
	}
	p = Spawn (ProjectileType,,,ProjStart,DesiredRotation);
	bShoot=False;
	SetTimer(0.05,True);
}	
//=============================================================================
// States
//=============================================================================
auto state Idle
{
	ignores EnemyNotVisible;

	function SeePlayer(Actor SeenPlayer)
	{
		local RPG_PlatformPawn PlatformPawn;
		
        if ( SeenPlayer.bCollideActors && ( ( Pawn(SeenPlayer) == class'RPG_PlatformPawn' ) ) )
		{
			Enemy = Pawn(SeenPlayer);
			GotoState('ActiveCannon');
		}
	}

	function BeginState()
	{
		log("BeginState - Idle");
		Enemy = None;
	}

Begin:
	Sleep(5.0);
	StartDeactivate();
	Sleep(0.0);
	PlayDeactivate();
	Sleep(2.0);
	SetPhysics(PHYS_None);
}

/*state DeActivated
{
	ignores SeePlayer, EnemyNotVisible;

Begin:
	Enemy = None;
	StartDeactivate();
	Sleep(0.0);
	PlayDeactivate();
	Sleep(6.0);
	SetPhysics(PHYS_None);
}*/

state ActiveCannon
{
	ignores SeePlayer;

	function EnemyNotVisible()
	{
		local Pawn P;

		log("EnemyNotVisible - ActiveCannon");
		Enemy = None;
		for ( P=Level.PawnList; P!=None; P=P.NextPawn )
            if ( ( P.bCollideActors && P.bIsPlayer ) && (P.Health > 0) && !P.IsA('RPG_Cannon') && LineOfSightTo(P) )
			{
				log("EnemyFound - EnemyNotVisible - ActiveCannon");
				Enemy = P;
				return;
			}
		GotoState('Idle');
	}

	function Timer()
	{
		DesiredRotation = rotator(Enemy.Location - Location);
		Shoot();
		bShoot=True;			
		SetTimer(SampleTime,True);
	}

	function BeginState()
	{
		Target = Enemy;
	}

Begin:
	Disable('Timer');
	PlayActivate();
	Enable('Timer');
	SetTimer(SampleTime,True);
	RotationRate.Yaw = TrackingRate;
	SetPhysics(PHYS_Rotating);
	bShoot=True;

FaceEnemy:
	TurnToward(Enemy);
	Goto('FaceEnemy');
}

state GameEnded
{
ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, TakeDamage, WarnTarget, Died;

	function BeginState()
	{
		Destroy();
	}
}

defaultproperties
{
	Health=1
}
Last edited by ANUBITEK on Sat Jan 23, 2016 5:13 pm, edited 1 time in total.
<<| http://uncodex.ut-files.com/ |>>

Code reference for UGold, UT99, Unreal2, UT2k3, UT3
Additional Beyond Unreal Wiki Links
wiki.beyondunreal.com/Legacy:Console_Bar
wiki.beyondunreal.com/Exec_commands#Load
wiki.beyondunreal.com/Legacy:Exec_Directive#Loading_Other_Packages
wiki.beyondunreal.com/Legacy:Config_Vars_And_.Ini_Files
wiki.beyondunreal.com/Legacy:INT_File
User avatar
Wormbo
Adept
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm
Contact:

Re: Modifying TeamCannon

Post by Wormbo »

This is really a long shot, but could it be that some "RPG_LionPlatformer" class lacks a mesh?

That RPG_LionPlatformer is a PlayerPawn (maybe even you yourself?), which may cause problems in your AutoCannon script. Note that the "auto" keyword only defines a default initial state in the absense of any explicitly set initial state. The InitialState can be set at any point up until the SetInitialState() event is called during initialization. Particularly, are you sure no parent class of your RPG_Cannon modifies the InitialState during initialization?
User avatar
ANUBITEK
Adept
Posts: 261
Joined: Sun Dec 28, 2014 1:10 am
Location: Anubitek

Re: Modifying TeamCannon

Post by ANUBITEK »

The state now switches properly based on any triggers tied to the actor, and the actor will shoot, but now I am getting accessed nones because I don't really know how to register RPG_PlatformPawn (or just PlayerPawn) as an enemy through any means of detection. Plus there are only 3 states, Idle, ActiveCannon (where I would assume any player detection code would need to go), and GameEnded.

tl;dr How do I detect PlayerPawns and register them as "Enemy" through pawn code?

Code: Select all

ScriptWarning: RPG_Cannon Autoplay.RPG_Cannon0 (State RPG_Game_dev.RPG_Cannon.ActiveCannon:0038) Accessed None 'Enemy'

Code: Select all

//=============================================================================
// States
//=============================================================================
auto state Idle
{
	ignores EnemyNotVisible;
	
	function BeginState()
	{
		Enemy = None;
		return;
	}
Begin:
	StartDeactivate();
	Disable('Timer');
	bShoot = false;
	Sleep(4.0);
	SetPhysics(PHYS_None);
}

state ActiveCannon
{
	function BeginState()
	{
		Target = Enemy;
		return;
	}
	
	function EnemyNotVisible()
	{
		local RPG_PlatformPawn P;
	
		log("EnemyNotVisible - ActiveCannon");

		if ( ( P.bCollideActors && LineOfSightTo(P) ) && ( P.Health > 0 ) )
		{
			log("EnemyFound - EnemyNotVisible - ActiveCannon");
			Enemy = P;
			return;
		}
		GotoState('Idle');
	}
	
	function Timer()
	{
		Shoot();
		bShoot = True;         
		SetTimer(SampleTime,True);
		return;
	}

Begin:
	Disable('Timer');
	PlayActivate();
	Enable('Timer');
	SetTimer(SampleTime,True);
//	RotationRate.Yaw = TrackingRate;
	SetPhysics(PHYS_Rotating);
	bShoot=True;

FaceEnemy:
	DesiredRotation = rotator(Enemy.Location - Location);
//	TurnToward(Enemy);
	Goto('FaceEnemy');
}

state GameEnded
{
	ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, TakeDamage, WarnTarget, Died;
	
	function BeginState()
	{
		Destroy();
	}
}

defaultproperties
{
	SampleTime=1.0
	Health=1
}
<<| http://uncodex.ut-files.com/ |>>

Code reference for UGold, UT99, Unreal2, UT2k3, UT3
Additional Beyond Unreal Wiki Links
wiki.beyondunreal.com/Legacy:Console_Bar
wiki.beyondunreal.com/Exec_commands#Load
wiki.beyondunreal.com/Legacy:Exec_Directive#Loading_Other_Packages
wiki.beyondunreal.com/Legacy:Config_Vars_And_.Ini_Files
wiki.beyondunreal.com/Legacy:INT_File
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: Modifying TeamCannon

Post by sektor2111 »

Firsts problems.
Default cannons Lacks in codes and they need completions not lines removed.
You have a screwed Player if Cannon cannot see it or you have messed up SeePlayer without to develop a replacement.

By Example I was able to extent MHCannon's intelligence in order to see it helping player or hunting player dependant on team-setup. Team = 0 No hunt player but attack even monsters. Team = 1 leave alone monsters by default but hunt player. These happens out of bIsPlayer featured trash.
User avatar
EvilGrins
Godlike
Posts: 9698
Joined: Thu Jun 30, 2011 8:12 pm
Personal rank: God of Fudge
Location: Palo Alto, CA
Contact:

Re: Modifying TeamCannon

Post by EvilGrins »

When you say "actor" are you talking a gun on a swivel-mount or are you talking something like a playerpawn that functions as a team-cannon?

Though I'm sure sektor will develop an ulcer for my suggesting it, are you familiar with TeamMonsters.u? It uses monsters for teams, like the name says, but instead of being under scripted pawns, they're listed under TeamCannons.

Just a thought. Maybe give it a look over, see if there's anything in there you can use.
http://unreal-games.livejournal.com/
Image
medor wrote:Replace Skaarj with EvilGrins :mrgreen:
Smilies · viewtopic.php?f=8&t=13758
MrLoathsome
Inhuman
Posts: 958
Joined: Wed Mar 31, 2010 9:02 pm
Personal rank: I am quite rank.
Location: MrLoathsome fell out of the world!

Re: Modifying TeamCannon

Post by MrLoathsome »

LannFyre wrote:The state now switches properly based on any triggers tied to the actor, and the actor will shoot, but now I am getting accessed nones because I don't really know how to register RPG_PlatformPawn (or just PlayerPawn) as an enemy through any means of detection. Plus there are only 3 states, Idle, ActiveCannon (where I would assume any player detection code would need to go), and GameEnded.

tl;dr How do I detect PlayerPawns and register them as "Enemy" through pawn code?

Code: Select all

ScriptWarning: RPG_Cannon Autoplay.RPG_Cannon0 (State RPG_Game_dev.RPG_Cannon.ActiveCannon:0038) Accessed None 'Enemy'
That ScriptWarning is because you do not check to see if (Enemy != None) in the BeginState() function there in your ActiveCannon State. (I think...)

Re: Setting PlayerPawns (or ScriptedPawns) as Enemy.

Noticed that you have not done anything with function SetEnemy() in any of the code you posted. :noidea
Here is the SetEnemy() function I used a while back to make some FlockPawns attack Players, Bots or ScriptedPawns.
*Added comment regarding line I would have done different. (You could rip that first line out, unless you want to add an option for the cannons to ignore monsters....)

Code: Select all

function bool SetEnemy(Pawn NewEnemy)
{
	if (NewEnemy.IsA('ScriptedPawn') && bIgnoreSP) return false;
//    Above line would be better as:     if ((ScriptedPawn(NewEnemy) != None) && bIgnoreSP) return false;
	if ((Enemy != None) && (NewEnemy != Self) && (Enemy == NewEnemy))
		return true;
	if (Enemy == Self) { Enemy = None; }
	if ((NewEnemy == None) || (Bird3(NewEnemy) != None) || (NewEnemy == Self) || (NewEnemy.Health <= 0) || (NewEnemy.Region.Zone.bWaterZone)
		|| (NewEnemy.Location == vect(0,0,0)) || (Spectator(NewEnemy) != None))
	{
		if ((NewEnemy == None) || (NewEnemy == Self)) { Enemy = None; }
		return false;
	}
	Enemy = NewEnemy;
	return true;
}
This code is right out of the NewBIrds pawns I did a few years back. Haven't looked at it for a while.
The number of sanity checks might seem excessive, but I am pretty sure I found conditions in testing that made
them necessary.
You would want to change the cast to Bird3 to the RPG_Cannon thingy you are working with.
Take out the bWaterZone check, unless you want your cannons to ignore things in the water....

Have you tracked down those mesh errors?

As Wombo pointed out, check the parent classes out. Both for the InitalState stuff, and to see if you need to do something
different to get the mesh issue resolved.

**If the way teamcannons/RPG_Cannons acquire and deal with "Enemy" is totally different than the way Flock/Scripted Pawns do, then disregard most of this post. :roll:
blarg
User avatar
ANUBITEK
Adept
Posts: 261
Joined: Sun Dec 28, 2014 1:10 am
Location: Anubitek

Re: Modifying TeamCannon

Post by ANUBITEK »

Here is the finished script, you guys were right there was an issue with target acquisition in that there was no code for it. I'm still not quite sure why it would still see the player then fire in a completely random angle, but this has also been fixed. Not only this, but now it can be triggered on/off, while it is on it is idle but once it sees the player it will continue to track them even when it can't see them. Once the player is visible, it will begin shooting at them. Projectile speed and projectile firing rate can be set, as well as activate/deactivate/firing sounds. Also I'm not sure if the player not having a mesh was even an issue, because nothing was changed in regard to that and yet the code seems to work. This is the code for finding the player:

Code: Select all

	function SeePlayer(Actor SeenPlayer)
	{
        if ( SeenPlayer.bCollideActors )
		{
			Enemy = Pawn(SeenPlayer);
			GotoState('ActiveCannon');
		}
	}
Final script:

Code: Select all

//=============================================================================
// RPG_Cannon.
// TeamCannon from UT99, no team alliance and begins firing.
//   Cannot be destroyed.
//=============================================================================
class RPG_Cannon extends RPG_StationaryPawn;

#exec OBJ LOAD FILE=Textures\GenFX.utx PACKAGE=GenFX

var() localized string		PreKillMessage, PostKillMessage;
var() Class<Projectile>		ProjectileType;
var() sound 				FireSound;
var() sound 				ActivateSound;
var() sound 				DeActivateSound;
var() float				ProjectileSpeed;	// How fast the projectile travels
var() float 				FireRate;			// How often the cannon fires
var bool 				bShoot;
var rotator 				StartingRotation;

function TakeDamage( int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, name damageType);
function Died(pawn Killer, name damageType, vector HitLocation);
//=============================================================================
// General functionality
//=============================================================================
function PostBeginPlay()
{
	Super.PostBeginPlay();
	StartingRotation = Rotation;
}

simulated function Destroyed()
{
	Super.Destroyed();
}

function string KillMessage( name damageType, pawn Other )
{
	return (PreKillMessage@Other.PlayerReplicationInfo.PlayerName@PostKillMessage);
}

function StartDeactivate()
{
	log("StartDeactivate()");
	SetPhysics(PHYS_Rotating);
	DesiredRotation = StartingRotation;
}
//=============================================================================
// Sounds
//=============================================================================
function PlayDeactivate()
{
	log("PlayDeactivate()");
	PlaySound(DeActivateSound, SLOT_None,5.0);
	DrawType = DT_None;
	LightType = LT_None;
}

function PlayActivate()
{
	log("PlayActivate()");
	PlaySound(ActivateSound, SLOT_None, 2.0);
	DrawType = DT_Sprite;
	LightType = LT_Steady;
}
//=============================================================================
// Combat
//=============================================================================
function Shoot()
{
	local Vector ProjStart;
	local Projectile p;

	PlaySound(FireSound, SLOT_None,5.0);
	ProjStart = Location+Vector(DesiredRotation)*100 + Vect(0,0,20);
	log("Shoot");
	p = Spawn(ProjectileType,,,ProjStart,DesiredRotation);
	p.Velocity *= ProjectileSpeed;
	bShoot=False;
	SetTimer(0.05,True);
}
//=============================================================================
// States
//=============================================================================
auto state InactiveCannon
{
	ignores SeePlayer, EnemyNotVisible;
	
	function Trigger(Actor A, Pawn EventInstigator)
	{
		GotoState('Idle');
	}

Begin:
	PlayDeactivate();
	SetPhysics(PHYS_None);
} 

state Idle
{
	ignores EnemyNotVisible;
	
	function BeginState()
	{
		Enemy = None;
		return;
	}
	
	function Trigger(Actor A, Pawn EventInstigator)
	{
		GotoState('InactiveCannon');
	}
	
	function SeePlayer(Actor SeenPlayer)
	{
        if ( SeenPlayer.bCollideActors )
		{
			Enemy = Pawn(SeenPlayer);
			GotoState('ActiveCannon');
		}
	}
	
Begin:
	PlayActivate();
	Disable('Timer');
	bShoot = false;
	Sleep(4.0);
	SetPhysics(PHYS_None);
}

state ActiveCannon
{
	function BeginState()
	{
		Target = Enemy;
		return;
	}

	function Trigger(Actor A, Pawn EventInstigator)
	{
		GotoState('InactiveCannon');
	}
	
	function EnemyNotVisible()
	{
		local Pawn P;

		for (P = Level.PawnList; P != none; P = P.NextPawn)
			if (P.bCollideActors && P.bIsPlayer && P.Health > 0 && LineOfSightTo(P))
			{
				Enemy = P;
				return;
			}
		if (Enemy == none || Enemy.bDeleteMe || Enemy.Health <= 0)
			GotoState('Idle');
	}
	function Timer()
	{
		if (Enemy == none || Enemy.bDeleteMe || Enemy.Health <= 0)
			EnemyNotVisible();
		else
		{
			DesiredRotation = rotator(Enemy.Location - Location);
			DesiredRotation.Yaw = DesiredRotation.Yaw & 65535;
			if (LineOfSightTo(Enemy))
			{
				if (bShoot && DesiredRotation.Pitch < 2000 &&
					(Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) < 1000 ||
				 	Abs(DesiredRotation.Yaw - (Rotation.Yaw & 65535)) > 64535))
				{
					Shoot();
				}
				else
				{
					bShoot = true;
					SetTimer(FireRate, true);
				}
			}
		}
	} 

Begin:
	Disable('Timer');
	Sleep(0.0);
	Enable('Timer');
	SetTimer(FireRate,True);
//	RotationRate.Yaw = TrackingRate;
	SetPhysics(PHYS_Rotating);
	bShoot=True;

FaceEnemy:
	TurnToward(Enemy);
	Goto('FaceEnemy');
}

state GameEnded
{
	ignores SeePlayer, HearNoise, KilledBy, Bump, HitWall, HeadZoneChange, FootZoneChange, ZoneChange, Falling, TakeDamage, WarnTarget, Died;

	function BeginState()
	{
		Destroy();
	}
}

defaultproperties
{
	bCanTeleport=False
	bEdShouldSnap=True
	DrawType=DT_Sprite
	bBlockActors=False
	bBlockPlayers=False
	bCollideActors=False
	bCollideWorld=True
	bPathCollision=False
	bProjTarget=False
	Texture=Texture'GenFX.LensFlar.flare5'
	Style=STY_Translucent
	LightEffect=LE_TorchWaver
	LightBrightness=255
	LightHue=21
	LightSaturation=127
	LightRadius=10
	FireRate=1.0
	ProjectileSpeed=1.0
	Health=1
	ProjectileType=Class'UnrealShare.SkaarjProjectile'
}
<<| http://uncodex.ut-files.com/ |>>

Code reference for UGold, UT99, Unreal2, UT2k3, UT3
Additional Beyond Unreal Wiki Links
wiki.beyondunreal.com/Legacy:Console_Bar
wiki.beyondunreal.com/Exec_commands#Load
wiki.beyondunreal.com/Legacy:Exec_Directive#Loading_Other_Packages
wiki.beyondunreal.com/Legacy:Config_Vars_And_.Ini_Files
wiki.beyondunreal.com/Legacy:INT_File
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Modifying TeamCannon

Post by JackGriffin »

LannFyre wrote:I'm still not quite sure why it would still see the player then fire in a completely random angle, but this has also been fixed.
When a projectile is spawned it assumes the default orientation and location. You have to change those in the spawn code either by expressly setting them or allowing them to inherit those from the parent class/instigator. More than once I've forgotten this and saw my projectiles spawn at some crazy angle or even spawn across the map.
So long, and thanks for all the fish
User avatar
ANUBITEK
Adept
Posts: 261
Joined: Sun Dec 28, 2014 1:10 am
Location: Anubitek

Re: Modifying TeamCannon

Post by ANUBITEK »

lol Makes sense. This is what was implemented to make it so the projectile would actually rotate toward the player and adjust the projectile's spawn location.

Shoot

Code: Select all

	ProjStart = Location+Vector(DesiredRotation)*100 + Vect(0,0,20);
ActiveCannon

Code: Select all

FaceEnemy:
	TurnToward(Enemy);
	Goto('FaceEnemy');
<<| http://uncodex.ut-files.com/ |>>

Code reference for UGold, UT99, Unreal2, UT2k3, UT3
Additional Beyond Unreal Wiki Links
wiki.beyondunreal.com/Legacy:Console_Bar
wiki.beyondunreal.com/Exec_commands#Load
wiki.beyondunreal.com/Legacy:Exec_Directive#Loading_Other_Packages
wiki.beyondunreal.com/Legacy:Config_Vars_And_.Ini_Files
wiki.beyondunreal.com/Legacy:INT_File
Post Reply