Skip to content

Instantly share code, notes, and snippets.

@rroa
Created May 14, 2014 15:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rroa/579a2a4e634de3790144 to your computer and use it in GitHub Desktop.
Save rroa/579a2a4e634de3790144 to your computer and use it in GitHub Desktop.
class ACF_DecoyGun extends UTWeapon;
/************************************************************************************
* States
***********************************************************************************/
var() class<ACF_Bot> BotClass;
var() bool Spawned;
simulated function InstantFire()
{
local UTGame game;
local ACF_Bot decoyBot;
local Vector decoyBotPosition;
local Vector shotDirection;
local PlayerController pawnOwner;
local vector POVLoc;
local rotator POVRot;
local vector Transform;
game = UTGame( self.WorldInfo.Game ); // Getting current game info instance
pawnOwner = PlayerController( self.Owner );
if( pawnOwner != None )
{
//theController = PlayerController( pawnOwner );
pawnOwner.ClientMessage( "Location: " @ pawnOwner.Location.X @ ", " @ pawnOwner.Location.Y @ ", " @ pawnOwner.Location.Z );
}
if( game != None && !Spawned ) // If the player hasn't spawned a bot for this instance the do it!
{
Spawned = true; // setting the spawned state to true
GetActorEyesViewPoint(POVLoc, POVRot);
Transform = vector(POVRot);
// Retrieving in what direction I'm shooting!
//
shotDirection = Vector( GetAdjustedAim( self.Location ));
// Calculating the decoy bot position based on the shot direction
//
//decoyBotPosition = ( self.Location ) + Normal(shotDirection) * WeaponRange;
decoyBotPosition = POVLoc + ( Normal( Transform ) * WeaponRange );
// Spawning the decoy bot!
//
decoyBot = Spawn(BotClass,,,decoyBotPosition);
decoyBot.SpawnDefaultController();
// If bot was created then set its team name
//
if( decoyBot != None )
{
decoyBot.SetTeamNumber( self.owner.GetTeamNum() );
}
}
}
simulated event vector GetPhysicalFireStartLoc(optional vector AimDir)
{
local SkeletalMeshComponent compo;
local SkeletalMeshSocket socket;
compo = SkeletalMeshComponent(Mesh);
if (compo != none)
{
socket = compo.GetSocketByName('MussleFlashSocket');
if (socket != none)
{
return compo.GetBoneLocation(socket.BoneName);
}
}
}
DefaultProperties
{
// Decoybot info
//
BotClass=class'ACF_Bot'
// Weapon SkeletalMesh
Begin Object class=AnimNodeSequence Name=MeshSequenceA
bCauseActorAnimEnd=true
End Object
Begin Object Name=FirstPersonMesh
SkeletalMesh=SkeletalMesh'poct_weapons.skeletal_mesh.tgp2_assault_firstperson_01'
AnimSets(0)=AnimSet'poct_weapons.skeletal_mesh.assault_animset_01'
Animations=MeshSequenceA
Scale=0.9
FOV=60.0
End Object
PlayerViewOffset=(X=16.0,Y=-18,Z=-18.0)
InventoryGroup=3
AttachmentClass=class'ACF_Decoy_Attachment';
Begin Object Name=PickupMesh
SkeletalMesh=SkeletalMesh'poct_weapons.skeletal_mesh.tgp2_assault_thirdperson_01'
End Object
WeaponFireSnd(0)=SoundCue'POCT_TEMP_SOUNDS.Cues.GUN_FIRE1_Cue'
WeaponEquipSnd=SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_RaiseCue'
WeaponPutDownSnd=SoundCue'A_Weapon_ShockRifle.Cue.A_Weapon_SR_LowerCue'
PickupSound=SoundCue'A_Pickups.Weapons.Cue.A_Pickup_Weapons_Shock_Cue'
// Ammo
ShotCost(0)=1
LockerAmmoCount=1
MaxAmmoCount=1
AmmoCount=1
// Range
WeaponRange(0)=200.0
MuzzleFlashSocket=MuzzleFlashSocket
MuzzleFlashPSCTemplate=ParticleSystem'WP_LinkGun.Effects.P_FX_LinkGun_MF_Primary'
MuzzleFlashAltPSCTemplate=ParticleSystem'WP_LinkGun.Effects.P_FX_LinkGun_MF_Primary'
bMuzzleFlashPSCLoops=true
MuzzleFlashLightClass=class'UTGame.UTLinkGunMuzzleFlashLight'
WeaponColor=(R=0,G=255,B=0,A=255)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment