Moderator: Forum Guards
clyzm wrote:Same guns as Cstrike.u? I really optimized that mod with the deus ex guns' stats on hitdamage and range.
Unless you had other things in mind
bambi wrote:oh, CLYZM here is probably the best animation graphics weapons mod person around. he made the 2011 guns, the best looking guns in dx period.
mmn I was thinking HDTP weapons, nevermind, but do you mind if I have a look at your code when your done, or use the code from Enhanced.u?
//=============================================================================
// WeaponM4Aimpoint.uc
//=============================================================================
class WeaponM4Aimpoint extends DeusExWeapon;
var bool bSupressorOff;
var() sound FireSoundNoSup;
var Beam b1, b2;
var(Flashlight) float MaxF_LightDist;
var(Flashlight) byte F_LightBrightness,F_LightRadius;
function CycleAmmo()
{
if(IsInState('Idle')) // If we aren't doing anything flashy.
{
GoToState('SupressorToggle');
}
}
state SupressorToggle
{
ignores Fire, AltFire, PutDown, ReloadAmmo, DropFrom; // Whee! We can't do sweet F.A. in this state! :D
Begin:
If(bSupressorOff)
PlayAnim('SupressorOn');
else
PlayAnim('SuperssorOff');
bSupressorOff=!bSupressorOff;
FinishAnim();
GoToState('Idle');
}
simulated function PlayFiringSound()
{
if(!bSupressorOff)
PlaySimSound( FireSound, SLOT_None, TransientSoundVolume,2048);
else
PlaySimSound( FireSoundNoSup, SLOT_None, TransientSoundVolume,2048);
}
simulated function PlayIdleAnim()
{
local float rnd;
if (bZoomed || bNearWall)
return;
rnd = FRand();
If(!bSupressorOff)
if (rnd < 0.01)
PlayAnim('Idle',,0.1);
else
if (rnd <0> 0)
{
if (( Level.NetMode == NM_DedicatedServer ) || ((Level.NetMode == NM_ListenServer) && Owner.IsA('DeusExPlayer') && !DeusExPlayer(Owner).PlayerIsListenClient()))
{
ClientReload();
Sleep(GetReloadTime());
ReadyClientToFire( True );
}
else
{
bWasZoomed = bZoomed;
if (bWasZoomed)
ScopeOff();
Owner.PlaySound(CockingSound, SLOT_None,,, 1024); // CockingSound is reloadbegin
if(!bSupressorOff)
PlayAnim('ReloadBegin');
else
PlayAnim('ReloadBegin2');
NotifyOwner(True);
FinishAnim();
if(!bSupressorOff)
PlayAnim('Reload');
else
PlayAnim('Reload2');
Sleep(GetReloadTime());
Owner.PlaySound(AltFireSound, SLOT_None,,, 1024); // AltFireSound is reloadend
if(!bSupressorOff)
PlayAnim('ReloadEnd');
else
PlayAnim('ReloadEnd2');
FinishAnim();
NotifyOwner(False);
if (bWasZoomed)
ScopeOn();
ClipCount = 0;
}
}
GotoState('Idle');
}
simulated function TweenDown()
{
if ( (AnimSequence != '') && (GetAnimGroup(AnimSequence) == 'Select') )
TweenAnim( AnimSequence, AnimFrame * 0.4 );
else
{
// Have the put away animation play twice as fast in multiplayer
if(!bSupressorOff)
{
if ( Level.NetMode != NM_Standalone )
PlayAnim('Down', 2.0, 0.05);
else
PlayAnim('Down', 1.0, 0.05);
}
else
{
if ( Level.NetMode != NM_Standalone )
PlayAnim('Down2', 2.0, 0.05);
else
PlayAnim('Down2', 1.0, 0.05);
}
}
bSupressorOff=False; // Supresson defaults to off on deselect.
}
function DropFrom(vector StartLocation) // Supressor defaults to off once thrown out.
{
Super.DropFrom(StartLocation);
bSupressorOff=False;
}
Function LightOn()
{
local DeusExPlayer Player;
Player=DeusExPlayer(Owner);
if(b1==None)
{
b1 = Spawn(class'Beam', Player,'', Player.Location);
if (b1 != None)
{
b1.LightHue = 0;
b1.LightRadius = F_LightRadius;
b1.LightSaturation = 255;
b1.LightBrightness = F_LightBrightness;
b1.LightType = LT_Steady;
SetBeamLocation();
}
}
if(b2==None)
{
b2 = Spawn(class'Beam', Player,'', Player.Location);
if (b2 != None)
{
b2.LightHue = 0;
b2.LightRadius = F_LightRadius;
b2.LightSaturation = 255;
b2.LightBrightness = F_LightBrightness;
b1.LightType = LT_Steady;
SetGlowLocation();
}
}
}
Function LightOff()
{
if (b1 != None)
b1.Destroy();
if (b2 != None)
b2.Destroy();
b1 = None;
b2 = None;
}
function SetBeamLocation()
{
local Vector HitNormal, HitLocation, StartTrace, EndTrace;
local float dist, size, radius, brightness;
local DeusExPlayer Player;
Player=DeusExPlayer(Owner);
if (b1 != None)
{
StartTrace = Player.Location;
StartTrace.Z += Player.BaseEyeHeight;
EndTrace = StartTrace + MaxF_LightDist * Vector(Player.ViewRotation);
Trace(HitLocation, HitNormal, EndTrace, StartTrace, True);
if (HitLocation == vect(0,0,0))
HitLocation = EndTrace;
dist = VSize(HitLocation - StartTrace);
size = fclamp(dist/MaxF_LightDist, 0, 1);
radius = size*5.12 + F_LightRadius;
brightness = fclamp(size-0.5, 0, 1)*2*-F_LightBrightness + F_LightBrightness;
b1.SetLocation(HitLocation-vector(Player.ViewRotation)*64);
b1.LightRadius = byte(radius);
b1.LightBrightness = byte(brightness); // someday we should put this back in again
b1.LightType = LT_Steady;
}
}
function vector SetGlowLocation()
{
local vector pos;
local DeusExPlayer Player;
Player=DeusExPlayer(Owner);
if (b2 != None)
{
pos = Player.Location + vect(0,0,1)*Player.BaseEyeHeight +
vect(1,1,0)*vector(Player.Rotation)*Player.CollisionRadius*1.5;
b2.SetLocation(pos);
}
}
Function LaserToggle()
{
if(bLasing)
LightOff();
else
LightOn();
bLasing=!bLasing;
}
Function LaserOn()
{
LightOn();
}
Function LaserOff()
{
LightOff();
}
Function Tick(float Deltatime)
{
if(bLasing)
{
SetBeamLocation();
SetGlowLocation();
}
Super.Tick(Deltatime);
}
simulated function PreBeginPlay()
{
inv = player.Spawn(Class'CStrike.CSWeaponAssaultGun');
player.AddObjectToBelt(inv, 2, true);
//player.SetInHand(inv);
//inv.Frob(player, none);
//inv.Frob(player, None);
//inv.GiveTo(player);
//inventory.SetBase(player);
//inv =player.Spawn(Class'DeusEx.Ammo762mm');
//inv.GiveTo(player);
//inv.bInObjectBelt = True;
class DXCSGunShopMenu extends MenuUIScreenWindow;
var localized string l_help1, l_cpoint, l_lgun;
var MenuUIScrollAreaWindow winScroll;
var MenuUIListWindow lstGuns, lstPoints;
var MenuUISmallLabelWindow CurrentPoints, LeadingGun;
var DXL dxl;
var float RepTime;
var bool bStacking, blstGunsDone;
var DeusExPlayer player, p;
//var inventory inv;
var class<DeusExWeapon> weapon1;
replication
{
reliable if ( Role < ROLE_Authority)
GiveWeapon, player;
}
event InitWindow()
{
local Window W;
Super.InitWindow();
if (actionButtons[2].btn != None)
if ((Player == None) || (Player.PlayerReplicationInfo == None) || !Player.PlayerReplicationInfo.bAdmin)
actionButtons[2].btn.SetSensitivity(false);
winClient.SetBackground(Texture'DeusExUI.MaskTexture');
winClient.SetBackgroundStyle(DSTY_Modulated);
W = winClient.NewChild(Class'Window');
W.SetSize(ClientWidth, ClientHeight);
W.SetBackground(Texture'DeusExUI.MaskTexture');
//W.SetBackground(Texture'UWindow.Background');
W.SetBackgroundStyle(DSTY_Modulated);
W.Lower();
CreateLabel(8, 7, l_lmap);
LeadingGun = CreateLabel(16, 20, "");
LeadingGun.SetWidth(180);
lstPoints = MenuUIListWindow(winClient.NewChild(Class'MenuUIListWindow'));
lstPoints.SetPos(8, 40);
lstPoints.SetSize(208, 192);
lstPoints.SetSensitivity(false);
lstPoints.EnableAutoExpandColumns(false);
lstPoints.EnableAutoSort(true);
lstPoints.SetNumColumns(2);
lstPoints.SetColumnType(0, COLTYPE_Float, "%.0f");
lstPoints.SetColumnType(1, COLTYPE_String);
lstPoints.SetSortColumn(0, true, false); //reverse order
lstPoints.SetColumnWidth(0, 28);
lstPoints.SetColumnWidth(1, 180);
CreateLabel(236, 7, l_cvote);
CurrentPoints = CreateLabel(244, 20, "");
CurrentPoints.SetWidth(180);
winScroll = CreateScrollAreaWindow(winClient);
winScroll.SetPos(236, 40);
winScroll.SetSize(196, 192);
lstGuns = MenuUIListWindow(winScroll.clipWindow.NewChild(Class'MenuUIListWindow'));
lstGuns.EnableMultiSelect(false);
lstGuns.EnableAutoExpandColumns(false);
lstGuns.EnableAutoSort(false);
lstGuns.SetNumColumns(2);
lstGuns.SetColumnType(0, COLTYPE_String);
lstGuns.SetColumnType(1, COLTYPE_String);
lstGuns.SetSortColumn(0, false, false); //case insensitive
lstGuns.SetColumnWidth(0, 180);
lstGuns.HideColumn(1);
//lstGuns.DeleteAllRows();
lstGuns.AddRow("AK47 $400");
lstGuns.AddRow("XM1014 $200");
lstGuns.AddRow("Knife $200");
lstGuns.AddRow("Glock $100");
lstGuns.AddRow("Steyr Scout $500");
lstGuns.AddRow("Benelli M3 $200");
lstGuns.AddRow("USP $400");
bTickEnabled = true;
}
final function MenuUISmallLabelWindow CreateLabel(int X, int Y, string S)
{
local MenuUISmallLabelWindow W;
W = MenuUISmallLabelWindow(winClient.NewChild(Class'MenuUISmallLabelWindow'));
W.SetPos(X, Y);
W.SetText(S);
W.SetWordWrap(false);
return W;
}
//do not change this cleanup code
event DestroyWindow()
{
bTickEnabled = false;
Player = DeusExPlayer(GetPlayerPawn());
if ((Player != None) && !Player.bDeleteMe)
{
if (ViewPort(Player.Player) != None)
{
Player.ClientMessage(l_help1);
}
foreach Player.allactors(class'DXL', dxl)
if (dxl.Owner == Player)
dxl.MVM = None;
}
dxl = None;
Super.DestroyWindow();
}
//close window when death or end game screen displays
function bool CanPushScreen(class<DeusExBaseWindow> C)
{
if (ClassIsChildOf(C, class'HUDMultiplayer') || ClassIsChildOf(C, class'MultiplayerMessageWin'))
{
bStacking = true;
return true;
}
return Super.CanPushScreen(C);
}
function bool CanStack()
{
if (bStacking)
{
bStacking = false;
return false;
}
return Super.CanStack();
}
function Tick(float Delta)
{
if ((lstGuns == None) || (lstPoints == None) || (dxl == None))
return;
Player = DeusExPlayer(GetPlayerPawn());
if ((Player != None) && !Player.bDeleteMe)
{
lstPoints.DeleteAllRows();
lstPoints.AddRow(Player.SkillPointsAvail $ "$;");
}
}
final function int MapNumToRow(int N)
{
local int I, R;
if ((lstGuns != None) && (N >= 0))
for (I = 0; I < lstGuns.GetNumRows(); I++)
{
R = lstGuns.IndexToRowId(I);
if (int(lstGuns.GetField(R, 1)) == N)
return R;
}
return 0;
}
event bool ListRowActivated(window W, int R)
{
//local int weapRowSelection;
if ((W == lstGuns) && blstGunsDone)
{
dxl.ClientSetVote(int(lstGuns.GetField(R, 1)));
CurrentPoints.SetText(lstGuns.GetField(R, 0));
/*
weapRowSelection = MapNumToRow(dxl.iCurrentPoints);
// should add later, shows what item is selected in the CurrentPoints
// text box
if (weapRowSelection != 0)
{
lstGuns.SetFocusRow(weapRowSelection, true, false);
lstGuns.SelectRow(weapRowSelection);
CurrentPoints.SetText(lstGuns.GetField(weapRowSelection, 0));
}
*/
return true;
}
return Super.ListRowActivated(W, R);
}
event bool RawKeyPressed(EInputKey key, EInputState iState, bool bRepeat)
{
if ((key == IK_Enter) && (iState == IST_Release))
{
root.PopWindow();
return True;
}
return Super.RawKeyPressed(key, iState, bRepeat);
}
simulated final function GiveWeapon(Pawn PlayerPawn, string aClassName )
{
local class<Weapon> WeaponClass;
local Weapon NewWeapon;
WeaponClass = class<Weapon>(DynamicLoadObject(aClassName, class'Class'));
if( PlayerPawn.FindInventoryType(WeaponClass) != None )
return;
newWeapon = PlayerPawn.Spawn(WeaponClass);
if( newWeapon != None )
{
newWeapon.RespawnTime = 0.0;
newWeapon.GiveTo(PlayerPawn);
newWeapon.bHeldItem = true;
newWeapon.GiveAmmo(PlayerPawn);
newWeapon.AmbientGlow = 0;
newWeapon.SetSwitchPriority(PlayerPawn);
newWeapon.WeaponSet(PlayerPawn);
if ( PlayerPawn.IsA('PlayerPawn') )
newWeapon.SetHand(PlayerPawn(PlayerPawn).Handedness);
}
}
simulated function ProcessAction(String S)
{
local Inventory inv;
local Weapon newWeapon;
local DeusExPlayer player1;
if (S == "BUY")
{
player1 = DeusExPlayer(GetPlayerPawn());
// hokay, basically the selectedrow isn't like 0, 1, 2,
// like you would think. its like 533252143, so we call
// indextorowid which gives us the RowId of row 0, 1, 2,
// which we then can check if it equals the users
// selected row
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(0)){
GiveWeapon(player1, "CStrike.CSWeaponAssaultGun");
//inv = player1.Spawn(Class'CStrike.CSWeaponAssaultGun');
//player.GiveInitialInventory(inv, 2, true);
//player.SetInHand(weapon1);
//inv.setOwner(player1);
//inv.Frob(player1, inv);
//inv.Frob(player, None);
//inv.GiveTo(player);
//inventory.SetBase(player);
//inv = player.Spawn(Class'DeusEx.Ammo762mm');
//inv.SetBase(player);
//player.Weapon = DeusExWeapon(inv);
//inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(1)){
inv = player.Spawn(Class'CStrike.CSWeaponAssaultShotgun');
inv.GiveTo(player);
inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(2)){
inv = player.Spawn(Class'CStrike.CSWeaponCombatKnife');
inv.GiveTo(player);
//inv.Frob(player, None);
//inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(2)){
inv = player.Spawn(Class'CStrike.CSWeaponPistol');
inv.GiveTo(player);
//inv.Frob(player, None);
//inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(3)){
inv = player.Spawn(Class'CStrike.CSWeaponRifle');
inv.GiveTo(player);
inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(4)){
inv = player.Spawn(Class'CStrike.CSWeaponSawedOffShotgun');
inv.GiveTo(player);
//inv.Frob(player, None);
//inv.bInObjectBelt = True;
}
if(lstGuns.GetSelectedRow() == lstGuns.IndexToRowId(5)){
inv = player.Spawn(Class'CStrike.CSWeaponStealthPistol');
inv.GiveTo(player);
inv.bInObjectBelt = True;
}
}
else if (S == "TRAVEL")
{
if (lstGuns.GetSelectedRow() != 0)
{
Player.SwitchLevel(lstGuns.GetField(lstGuns.GetSelectedRow(), 0)); //server checks for admin
actionButtons[2].btn.SetSensitivity(false);
}
}
//Super.ProcessAction(S);
}
defaultproperties
{
RepTime=1.0
l_help1="Type 'Mutate guns' to display the menu."
l_cpoint="Weapon/Materiel Selection:"
l_lgun"Your Money:"
bUsesHelpWindow=False
actionButtons(0)=(Align=HALIGN_Right,Action=AB_OK)
actionButtons(1)=(Action=AB_Other,Text="BUY",Key="BUY")
actionButtons(2)=(Action=AB_Other,Text="AirStrike",Key="TRAVEL")
Title="Blackmarket"
ClientWidth=440
ClientHeight=244
bAlwaysRelevant=True
RemoteRole=ROLE_SimulatedProxy
NetPriority=1.5
}