I am trying to make my own custom weapon, which will need up to 6 firemodes.
I been told that I have to modify the Inventory Manager class, and the PlayerController class to succefully implement the weapon with 6 firemodes.
The inventory manager will be needed to properly trigger the the Start Fire function.
The player controller will be needed so I can properly bind 4 additional keys to select the last 4 fire modes
The first two fire modes I am keeping them standard and using Fire, and Alt Fire
This is the code I have so far....
------------------------------------Pawn---------------------------------------
------------------------------------Weapon------------------------------------
----------------------------Inventory Manager-------------------------
-------------------------------Player Controller-------------------------
I think the way I have modify each class should work, but I do not know how to use my modify Inventory Manager and Player Controller class correctly.
var premInventory Invent;
Invent = premInventory(Instigator.InvManager);
var PlayerControlExt PC;
PC = PlayerControlExt(Instigator.Controller);
I am using those line to establish an instance of each class, but then I do not know how to use them or in which file to use them.
For example, I will need to use the "Invent" variable, and call what?
Invent."no clue what to type here"();
and where would I call such command.
Thank you very much for whatever help anybody can offer.
I been told that I have to modify the Inventory Manager class, and the PlayerController class to succefully implement the weapon with 6 firemodes.
The inventory manager will be needed to properly trigger the the Start Fire function.
The player controller will be needed so I can properly bind 4 additional keys to select the last 4 fire modes
The first two fire modes I am keeping them standard and using Fire, and Alt Fire
This is the code I have so far....
------------------------------------Pawn---------------------------------------
Code:
class premPawn extends UTPawn;
var bool bOwnGun;
function Reward()
{
local premPawn G;
local Inventory I;
bOwnGun = true;
G = premPawn(Instigator);
I = spawn(class'Sword'); // makes the sword part of the inventory
if (G != none)
{
I.GiveTo(G); // assigns the weapon to pawn G
I.AnnouncePickup(G); // announces that pawn G has pick up the weapon
}
}
DefaultProperties
{
bOwnGun = false;
}
Code:
class Sword extends UTWeap_ImpactHammer;
//local premInventory I;
//I = premInventory(Instigator.InvManager);
//local PlayerControlExt PC;
//PC = PlayerControlExt(Instigator.Controller);
function CustomFire0()
{
local premPawn P;
P = premPawn(owner);
P.PlayEmote('TauntA', -1);
}
function CustomFire1()
{
local premPawn P;
P = premPawn(owner);
P.PlayEmote('TauntB', -1);
}
function CustomFire2()
{
local premPawn P;
P = premPawn(owner);
P.PlayEmote('TauntC', -1);
}
function CustomFire3()
{
local premPawn P;
P = premPawn(owner);
P.PlayEmote('TauntD', -1);
}
function CustomFire4()
{
local premPawn P;
P = premPawn(owner);
P.PlayEmote('TauntE', -1);
}
function CustomFire5()
{
local premPawn P;
P = premPawn(owner);
P.PlayEmote('TauntF', -1);
}
simulated function CustomFire()
{
switch(CurrentFireMode)
{
case 0:
CustomFire0();
break;
case 1:
CustomFire1();
break;
case 2:
CustomFire2();
break;
case 3:
CustomFire3();
break;
case 4:
CustomFire4();
break;
case 5:
CustomFire5();
break;
default:
CustomFire0();
break;
}
Super.CustomFire();
}
simulated function DrawSphere() // this function is not currently in use
{ // this function will be used to calculate the range damage of each attack
local premPawn P;
local premPawn SpecialPawn;
ForEach DynamicActors(class 'premPawn', P)
{
if (P.PlayerReplicationInfo != none)
{
SpecialPawn = P;
}
}
SpecialPawn.DrawDebugSphere(SpecialPawn.Location,60.0f,10,0,255,1);
//SpecialPawn.DrawDebugSphere(RealImpact.HitLocation,20.0f,10,0,255,1);
}
simulated function Tick(float DeltaTime)
{
//DrawSphere();
Super.Tick(DeltaTime);
}
DefaultProperties
{
WeaponFireTypes(0)= EWFT_Custom
WeaponFireTypes(1)= EWFT_Custom
WeaponFireTypes(2)= EWFT_Custom
WeaponFireTypes(3)= EWFT_Custom
WeaponFireTypes(4)= EWFT_Custom
WeaponFireTypes(5)= EWFT_Custom
InventoryGroup = 4 // assigns the sword to the 4 slot in the player's inventory.
}
Code:
class premInventory extends InventoryManager;
function StartFire2(byte FireModeNum)
{
if( Instigator.Weapon != None )
{
Instigator.Weapon.StartFire(2);
}
}
function StopFire2( byte FireModeNum )
{
if( Instigator.Weapon != None )
{
Instigator.Weapon.StopFire(2);
}
}
function StartFire3(byte FireModeNum)
{
if( Instigator.Weapon != None )
{
Instigator.Weapon.StartFire(3);
}
}
function StopFire3( byte FireModeNum )
{
if( Instigator.Weapon != None )
{
Instigator.Weapon.StopFire(3);
}
}
function StartFire4(byte FireModeNum)
{
if( Instigator.Weapon != None )
{
Instigator.Weapon.StartFire(4);
}
}
function StopFire4( byte FireModeNum )
{
if( Instigator.Weapon != None )
{
Instigator.Weapon.StopFire(4);
}
}
function StartFire5(byte FireModeNum)
{
if( Instigator.Weapon != None )
{
Instigator.Weapon.StartFire(5);
}
}
function StopFire5( byte FireModeNum )
{
if( Instigator.Weapon != None )
{
Instigator.Weapon.StopFire(5);
}
}
DefaultProperties
{
}
Code:
class PlayerControlExt extends PlayerController;
//Declarations
var bool bStartFire0;
var bool bStartFire1;
var bool bStartFire2;
var bool bStartFire3;
var bool bStartFire4;
var bool bStartFire5;
exec function StartFire( optional byte FireModeNum )
{
`log("Start Attack Mode 1");
bStartFire0 = true;
super.StartFire(FireModeNum);
}
exec function StopFire( optional byte FireModeNum )
{
bStartFire0 = false;
super.StopFire(FireModeNum);
}
exec function StartAltFire( optional Byte FireModeNum )
{
`log("Start Attack Mode 2");
bStartFire1 = true;
super.StartFire(FireModeNum);
}
exec function StopAltFire( optional byte FireModeNum )
{
bStartFire1 = false;
super.StopAltFire(FireModeNum);
}
//Attack Mode 3
exec function StartFire2( optional byte FireModeNum )
{
`log("Start Attack Mode 3");
bStartFire2 = true;
StartFire( 2 );
}
exec function StopFire2( optional byte FireModeNum )
{
bStartFire2 = false;
StopFire( 2 );
}
//Defensive Mode 1
exec function StartFire3( optional byte FireModeNum )
{
`log("Start Attack Mode 4");
StartFire( 3 );
bStartFire3 = true;
}
exec function StopFire3( optional byte FireModeNum )
{
bStartFire3 = false;
StopFire( 3 );
}
//Defensive Mode 2
exec function StartFire4( optional byte FireModeNum )
{
`log("Start Attack Mode 5");
StartFire( 4 );
bStartFire4 = true;
}
exec function StopFire4( optional byte FireModeNum )
{
bStartFire4 = false;
StopFire( 4 );
}
//Defensive Mode 3
exec function StartFire5( optional byte FireModeNum )
{
`log("Start Attack Mode 6");
StartFire( 5 );
bStartFire5 = true;
}
exec function StopFire5( optional byte FireModeNum )
{
bStartFire5 = false;
StopFire( 5 );
}
DefaultProperties
{
}
I think the way I have modify each class should work, but I do not know how to use my modify Inventory Manager and Player Controller class correctly.
var premInventory Invent;
Invent = premInventory(Instigator.InvManager);
var PlayerControlExt PC;
PC = PlayerControlExt(Instigator.Controller);
I am using those line to establish an instance of each class, but then I do not know how to use them or in which file to use them.
For example, I will need to use the "Invent" variable, and call what?
Invent."no clue what to type here"();
and where would I call such command.
Thank you very much for whatever help anybody can offer.
Last edited by a moderator: