For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

I feel REALLY stupid for saying this, but...

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
LOL_PEANUTS
OldUnreal Member
Posts: 11
Joined: Wed Mar 14, 2007 7:17 pm

I feel REALLY stupid for saying this, but...

Post by LOL_PEANUTS »

Spawn(AltProjectileClass,,, Start - 2 * VRand(), AltRotation)

Is it me, or are the arguments for Spawn() completely undocumented? Could someone please explain what each argument is?
User avatar
deathpax
OldUnreal Member
Posts: 21
Joined: Mon Apr 30, 2007 8:38 pm

Re: I feel REALLY stupid for saying this, but...

Post by deathpax »

It's you. lol

Engine.Actor has the definition

Code: Select all

native(278) final function actor Spawn
(
      class      SpawnClass,
      optional actor        SpawnOwner,
      optional name     SpawnTag,
      optional vector   SpawnLocation,
      optional rotator  SpawnRotation
);
User avatar
Turboman.
OldUnreal Member
Posts: 898
Joined: Tue Feb 04, 2003 6:40 pm

Re: I feel REALLY stupid for saying this, but...

Post by Turboman. »

since the original question already got more a less answered, and i don't feel opening a thread for something even more stupid, i just decided to post this here:

how do hitscan weapons like the asmd/automag/rifle/minigun exactly spawn their projectiles? nowhere can i find any definition of something along the lines of "spawn (class hitscanbullet)" or even any actor class called hitscanbullet or something similar.

at first i thought these weapons are hardcoded and impossible to recreate, but how could the upak or serpentine assault weapons exactly do the same with only uscript code?

and if most of these weapons are hardcoded, does that mean that i cannot make a weapon that behaves in a different way then the usual hitscan weapons? eg: have a machinegun that fires very inaccurate or fires in bursts of three shots?
Last edited by Turboman. on Sat Oct 13, 2007 12:25 pm, edited 1 time in total.
User avatar
Cookies
OldUnreal Member
Posts: 12
Joined: Sat Sep 15, 2007 11:17 am

Re: I feel REALLY stupid for saying this, but...

Post by Cookies »

Instanthit weapons don't spawn anything, they use a function called TraceFire to draw a line towards where the weapon is pointing, TraceFire then calls ProcessTraceHit which handles what needs to be done to the actor hit by the trace.

as in Engine.Weapon:

Code: Select all

function TraceFire( float Accuracy )
{
      local vector HitLocation, HitNormal, StartTrace, EndTrace, X,Y,Z;
      local actor Other;
      local Pawn PawnOwner;

      PawnOwner = Pawn(Owner);

      Owner.MakeNoise(PawnOwner.SoundDampening);
      GetAxes(PawnOwner.ViewRotation,X,Y,Z);
      StartTrace = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z; 
      AdjustedAim = PawnOwner.AdjustAim(1000000, StartTrace, 2.75*AimError, False, False);      
      EndTrace = StartTrace + Accuracy * (FRand() - 0.5 )* Y * 1000
            + Accuracy * (FRand() - 0.5 ) * Z * 1000;
      X = vector(AdjustedAim);
      EndTrace += (10000 * X); 
      Other = PawnOwner.TraceShot(HitLocation,HitNormal,EndTrace,StartTrace);
      ProcessTraceHit(Other, HitLocation, HitNormal, X,Y,Z);
}

function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
{
      //Spawn appropriate effects at hit location, any weapon lights, and damage hit actor
}
User avatar
Shivaxi
OldUnreal Member
Posts: 2232
Joined: Wed Mar 08, 2006 4:43 pm

Re: I feel REALLY stupid for saying this, but...

Post by Shivaxi »

yay for the new guy! ;D

Welcome to the forums Cookies :)
Image  Image
User avatar
Turboman.
OldUnreal Member
Posts: 898
Joined: Tue Feb 04, 2003 6:40 pm

Re: I feel REALLY stupid for saying this, but...

Post by Turboman. »

ah, many thanks for this, it all makes alot more sense now i see it!

i never really thought of tracefire having any use in it, i always figured it as a counterpart to a real world tracer bullet, only that it wasn't implented properly (i'm mainly thinking of the combat assault rifle here)

so interestingly in function tracefire accurancy can be determined and TraceFire( # ); should specify the firing rate, correct?
Last edited by Turboman. on Sun Oct 14, 2007 1:51 am, edited 1 time in total.
User avatar
.:..:
OldUnreal Member
Posts: 1637
Joined: Tue Aug 16, 2005 4:35 am

Re: I feel REALLY stupid for saying this, but...

Post by .:..: »

Instant hit weapons use a function in Engine.Actor:

Code: Select all

//
// Trace a line and see what it collides with first.
// Takes this actor's collision properties into account.
// Returns first hit actor, Level if hit level, or None if hit nothing.
//
native(277) final function Actor Trace
(
      out vector      HitLocation,
      out vector      HitNormal,
      vector          TraceEnd,
      optional vector TraceStart,
      optional bool   bTraceActors,
      optional vector Extent
);
1823223D2A33224B0 wrote:...and now im stuck trying to fix everything you broke for the next 227 release xD :P
(ಠ_ಠ)

Return to “UScript Board”