UE3 - UDK Attempting to get a team system set up for custom AI and Projectiles

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

LeviGratton

New Member
Oct 23, 2012
4
0
0
Our game is an attempt to make a sort of player vs computer, team vs team tower defense. Each side, one player, one AI, has a series of pawns on paths that are meant to kill each other.

Each side can also spawn towers that fire projectiles.

Our current problem is that everything can kill everything from the same actor factories. We're trying to figure out a way to create a team system for the AI to not kill each other on one team, but kill everyone else on the other team through both projectiles and melee combat.

Does anyone have any advice, tutorials, videos, or sample scripts?

This is a first year college game project, so assume we're all at the rank of beginner please.
 

Nathaniel3W

Member
Nov 11, 2012
48
0
6
It's really hard to say without any specifics. I think you must already know this, so if this is too basic, upload some code and we'll see what needs to change... But at the most general level you'll need to have two things:

1. In whatever class your soldiers or whatever are, add a variable that stores what team they're on. Set that variable when the soldier gets created.

2. In whatever function selects a target, check to see whether that actor is on the same team. It might look something like this:
Code:
if(target.team != myteam) attack(target); else selectNewTarget();
 

LeviGratton

New Member
Oct 23, 2012
4
0
0
To clarify some information.

We've set up triggers in front of each tower, and when a bot enters the trigger it activates a spawn projectile that damages any bot that enters the trigger, regardless of team.

so we're trying to make one set of spawned bots on one team immune to their own team's spawned projectiles. We have custom projectile scripts

Is there a way to make our custom bots immune to either the projectile type or a damage type

Code:
class CookieRocket extends UTProjectile;

simulated function PostBeginPlay()
{
	// force ambient sound if not vehicle game mode
	bImportantAmbientSound = !WorldInfo.bDropDetail;
	Super.PostBeginPlay();
}

defaultproperties
{
	ProjFlightTemplate=ParticleSystem'WP_RocketLauncher.Effects.P_WP_RocketLauncher_RocketTrail'
	ProjExplosionTemplate=ParticleSystem'WP_RocketLauncher.Effects.P_WP_RocketLauncher_RocketExplosion'
	ExplosionDecal=MaterialInstanceTimeVarying'WP_RocketLauncher.Decals.MITV_WP_RocketLauncher_Impact_Decal01'
	DecalWidth=128.0
	DecalHeight=128.0
	speed=1350.0
	MaxSpeed=1350.0
	Damage=35.0
	DamageRadius=300.0
	MomentumTransfer=85000
	MyDamageType=class'UTDmgType_Rocket'
	LifeSpan=8.0
	AmbientSound=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_Travel_Cue'
	ExplosionSound=SoundCue'A_Weapon_RocketLauncher.Cue.A_Weapon_RL_Impact_Cue'
	RotationRate=(Roll=50000)
	bCollideWorld=true
	CheckRadius=42.0
	bCheckProjectileLight=true
	ProjectileLightClass=class'UTGame.UTRocketLight'
	ExplosionLightClass=class'UTGame.UTRocketExplosionLight'

	bWaitForEffects=true
	bAttachExplosionToVehicles=false
}
 

VendorX

Member
Aug 2, 2010
231
7
18
BXL/Paris
The best place to do it it's function ReduceDamage in YourGameInfo or TakeDamage In YourPawn. Do the check on TeamIndex by calling OnSameTeam, but you need to override ScriptGetTeamNum in each - YourPawn and YourProjectile, because native code is looking for information about TeamInfo (which you should use instead of messing with coustom team info system...).
 
Last edited: