NewsUnrealEdFilesModsFragBULiandri Archives
BeyondUnreal Forums

Go Back   BeyondUnreal Forums > Unreal Development > Coding

Reply
 
Thread Tools Display Modes
Old 6th Nov 2001, 06:32 PM   #1
Silver_Ibex
Registered User
 
Join Date: Feb. 27th, 2001
Location: Equestria
Posts: 654
Question Help needed with Laser sight class

I’m working on a mold braking “laser sight” style aiming system mutator, it uses code based on the Agent X laser code and the “Laser sight” mutator by Glen Sharman that I downloaded from ModSquad.

So far it looks really sweet and works beautifully. Though there are several features that still need added before it’s finished

I need it to change to a different texture when it hits a target/pawn, and the draw scale needs to also increase, basically I’m having a small dot crosshairs turn into a large circle to encircle the target pawn.

Can “simulated” be used to modify the function so only the owners will be able to see their own “laser aimer” and if so, which function should be the simulated one?

If this would not affect it then how can I make it so only the owner can see it???

If it does not hit anything in between, then the laser dot needs to spawn at a fixed distance to hang in the air. Which part of the “start trace” “end trace” needs to be modified to get this rang limit???

Below is the original unmodified class so you can see what I’m talking about.

Quote:
class LSight expands TournamentPickup;
//Laser sight object for Laser Sights mutator - Glen Sharman, 2001
//Texture, sound and original concept - Jon Bartram (aka Mr White)

var ldot LD;



#exec TEXTURE IMPORT FILE=Textures\pdot.pcx NAME=LaserDot


function Activate()
{
GoToState('Activated');
}


state Activated
{
function BeginState()
{
LD = Spawn(Class'LDot', Owner);
bActive = true;
}


function Tick(float DeltaTime)
{
local vector X, Y, Z, StartTrace, EndTrace, HitLocation, HitNormal;


if ( Pawn(Owner).IsInState('FeigningDeath') && bActive )
{
LD.Destroy();
bActive = false;
}

if ( !bActive && !Pawn(Owner).Weapon.bMeleeWeapon && !Pawn(Owner).IsInState('FeigningDeath') )
{
LD = Spawn(Class'LDot', Owner);
bActive = true;
}

GetAxes(Pawn(Owner).ViewRotation, X, Y, Z);
StartTrace = Pawn(Owner).Location + CalcDrawOffset();
EndTrace = StartTrace + vector(Pawn(Owner).ViewRotation) * 10000;
Trace(HitLocation, HitNormal, EndTrace, StartTrace, True);
LD.SetLocation(HitLocation);
}


function EndState() //destroy laser dot if player dies
{
LD.Destroy();
bActive = false;
}


function Activate()
{
GoToState('DeActivated');
}
}
__________________
Infiltration 2.75 Extended 1.05 New Improved Realistic gun mod for UT99 that I highly recommend.
Silver_Ibex is offline   Reply With Quote
Old 6th Nov 2001, 10:57 PM   #2
Brood_of_Evil
Selene's martyr
 
Brood_of_Evil's Avatar
 
Join Date: Nov. 3rd, 2001
Location: Look outside your window!
Posts: 147
Simple really:

first you need to call PostBeginPlay() in the LDot actor and set bOnlyOwnerSee to true:

class LDot expands Actor;
//Laser dot object for Laser Sights mutator - Glen Sharman, March 2001

simulated function PostBeginPlay()
{
bOnlyOwnerSee = true; //**This mean only the owner can see the sight**
}


Then we modify the LSight class, check the comments with **'s:


class LSight expands TournamentPickup;
//Laser sight object for Laser Sights mutator - Glen Sharman, 2001
//Texture, sound and original concept - Jon Bartram (aka Mr White)

var ldot LD;


#exec AUDIO IMPORT FILE="Sounds\zoom.wav" NAME="ActLS" GROUP="Pickups"
#exec TEXTURE IMPORT FILE=Textures\pdot.bmp NAME=LaserDot

function Activate()
{
GoToState('Activated');
}


state Activated
{
function BeginState()
{
Owner.PlaySound(sound'ActLS', SLOT_None, Pawn(Owner).SoundDampening);
LD = Spawn(Class'LDot', Owner);
bActive = true;
}


function Tick(float DeltaTime)
{
local actor TargetedActor; //**Create an actor object**.
local vector X, Y, Z, StartTrace, EndTrace, HitLocation, HitNormal;

if ( Pawn(Owner).Weapon.bMeleeWeapon && bActive )
{
LD.Destroy();
bActive = false;
}

if ( Pawn(Owner).IsInState('FeigningDeath') && bActive )
{
LD.Destroy();
bActive = false;
}

if ( !bActive && !Pawn(Owner).Weapon.bMeleeWeapon && !Pawn(Owner).IsInState('FeigningDeath') )
{
LD = Spawn(Class'LDot', Owner);
bActive = true;
}

GetAxes(Pawn(Owner).ViewRotation, X, Y, Z);
StartTrace = Pawn(Owner).Location + CalcDrawOffset();
EndTrace = StartTrace + vector(Pawn(Owner).ViewRotation) * 10000;

//**The Trace function returns an actor type variable.**
TargetedActor = Trace(HitLocation, HitNormal, EndTrace, StartTrace, True);
LD.SetLocation(HitLocation);

if(TargetedActor.IsA('Pawn')) //**Verify that the actor is a Pawn**
{
//**Yes it's a Pawn**

LD.DrawScale = <New DrawScale>; //**you can change the drawscale here**
//**call SetDisplayProperties to change the texture**

LD.SetDisplayProperties(STY_Translucent,
Texture'<New Texture>', //**new texture goes here**
false,
false);
}
else //**Else, if there's not an actor at the end of the trace, reset the LDot tp it's default values**
{
LD.DrawScale = LD.Default.DrawScale;
LD.SetDisplayProperties(LD.Default.Style,
LD.Default.Texture,
false,
false);
}
}


function EndState() //destroy laser dot if player dies
{
LD.Destroy();
bActive = false;
}


function Activate()
{
GoToState('DeActivated');
}
}


state DeActivated
{
function BeginState()
{
Owner.PlaySound(Sound'ActLS', SLOT_None, Pawn(Owner).SoundDampening);
LD.Destroy();
bActive = false;
}
}


As for the distance limit, if you modify the following:
EndTrace = StartTrace + vector(Pawn(Owner).ViewRotation) * 10000; //**notice the 10000**

If you lower the 10000 you might be able to adjust the maximum distance of the LDot, you can even make a configurable variable so the user of your mutator can adjust this to it's liking.
I hope that helps good luck with your mut

Last edited by Brood_of_Evil; 6th Nov 2001 at 11:14 PM.
Brood_of_Evil is offline   Reply With Quote
Old 7th Nov 2001, 12:39 AM   #3
Silver_Ibex
Registered User
 
Join Date: Feb. 27th, 2001
Location: Equestria
Posts: 654
Talking

Thanks for the info, that really helped
__________________
Infiltration 2.75 Extended 1.05 New Improved Realistic gun mod for UT99 that I highly recommend.
Silver_Ibex is offline   Reply With Quote
Old 7th Nov 2001, 11:57 AM   #4
Silver_Ibex
Registered User
 
Join Date: Feb. 27th, 2001
Location: Equestria
Posts: 654
Question

The problem is that I need the aimer to work while the Behindview is set to true
The laser sight works great in first person, though now it disappears when in third person view, I need a way to tell it the third person camera is it’s owner
Here is the bit of the code where the camera gets setup in the character class.


Quote:
event PlayerCalcView( out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
{
ViewActor = Self;
bBehindView = true;
CalcBehindView(CameraLocation, CameraRotation, 200);//create a camera 200 units behind the player
}
The HUD info is still displayed when Behindview is turned on, so it must be possible.
__________________
Infiltration 2.75 Extended 1.05 New Improved Realistic gun mod for UT99 that I highly recommend.

Last edited by Silver_Ibex; 7th Nov 2001 at 12:06 PM.
Silver_Ibex is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:38 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.

Copyright ©1998 - 2012, BeyondUnreal, Inc.
Privacy Policy | Terms of Use
Bandwidth provided by AtomicGamer