Started coding (Newbie question)

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

jb

New Member
May 22, 2000
278
0
0
www.planetunreal.com
Good point Erdrik. However for me I just use a bunch of log statements to break up the function. This way I can look to see what was done "correctly" and get a better feel for where the error may be. Just don't forget to remove the log statements our your'll be back to that huge log file :)
 

Call me Erdrik

Arch Mage
Nov 24, 1999
334
0
0
43
Spring Hill, FL, USA
www.geocities.com
I said I was lazy when It came to Access None's not that I didn't know who important it is to get rid of them... :p

Im having a MAJOR problem with my DarkMagic Summons generating too many Access Nones... I can't figure out how to get rid of the buggers....

Maybe Ill post the code for help... but umm... its kinda BIG..(as Coding pawns usualy is..)

is there anything specific that I should look for to tell if a peice of code is generating an access none?

/EDIT
to give ya an idea of how bad it was (I fixed some of them, but not all) The log file was 400+ megs after only a few minutes of play :eek2:

But I fixed som and got it down to 100+megs but that is still grossly Fuxxored :p I don't want any if at all possible ...
 

Call me Erdrik

Arch Mage
Nov 24, 1999
334
0
0
43
Spring Hill, FL, USA
www.geocities.com
there are times when the pawn has no enemy... and there are functiontions commands, ect involving the enemy... Im thinking that may be it but... In the Unreal1 Scripted Pawns, and UT bots there is code that involves enemy when it = none and it doesn't generate the accessed none......
 

ma2Wolf

all round stupid imbecile
Feb 7, 2002
22
0
0
Manchester, England
Visit site
I'm Back

Hello, im back. Ive just got off halfterm.

I Made a pipebomb launcher a couple of days (with alot of help from a tutorial). It works but there is a big problem. I put it in a small room and fire it. it seems you can only fire in a certain position. I think it is most probably something to do with the fireoffset. I'll post the code tomorrow.

Plus i tried to make a quadshotgun but it says something like "unexpected ending" something like that.

I don't have much time to post at the moment. but i'll try to post tomorrow or thursday.

seeya thx for the help
 

ma2Wolf

all round stupid imbecile
Feb 7, 2002
22
0
0
Manchester, England
Visit site
Hello, I still don't know what's wrong with my code.
Here is the code for the pipe bomb launcher and it's projectile.

//=============================================================================
// Pipebomb.
//=============================================================================
class Pipebomb expands FlakCannon;

var int Createdby;

function Fire(float value)
{
local Vector Start, X,Y,Z;

if (AmmoType.UseAmmo(1))
{
CheckVisibility();

Owner.PlaySound(Misc1Sound, SLOT_None, 0.6*Pawn(Owner).SoundDampening);
Owner.PlaySound(AltFireSound, SLOT_None,Pawn(Owner).SoundDampening*4.0);
PlayAnim('AltFire',1.3,0.05);
bPointing=True;
Owner.MakeNoise(Pawn(Owner).SoundDampening);
GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
Start = Start + FireOffset.X * X + Fireoffset.Y * Y + FireOffset.Z * Z;
AdjustedAim = Pawn(owner).AdjustAim(AltProjectileSpeed, Start,AimError,True, bAltWarnTarget);
Spawn(class'pbomb2',,,Start,AdjustedAim);
If (PlayerPawn(Owner) !=None)
PlayerPawn(Owner).shakeview(ShakeTime, ShakeMag, ShakeVert);
GoToState('Firing');
}
}

function AltFire(float Value)
{
local actor A;
foreach Allactors(class 'Actor', A)
{
if( A.IsA('Pbomb2'))
{
if(pbomb2(A).ownerb == self.owner)
pbomb2(A).explode(a.location,a.location);
}
}
gotostate('AltFiring');
}

state Firing
{
Begin:
FinishAnim();
PlayAnim('Eject',1.5, 0.05);
Owner.PlaySound(Misc3Sound, SLOT_None,0.6*Pawn(Owner).SoundDampening);
FinishAnim();
PlayAnim('Loading',1.4, 0.05);
owner.PlaySound(CockingSound, SLOT_None,0.5*Pawn(Owner).SoundDampening);
FinishAnim();
Finish();
}

state AltFiring
{
Begin:
Owner.PlaySound(Misc1Sound,SLOT_None, 0.6*Pawn(Owner).SoundDampening);
Owner.PlaySound(AltFireSound, SLOT_None,Pawn(Owner).SoundDampening*4.0);
PlayAnim('Altfire', 1.3, 0.05);
Owner.MakeNoise(Pawn(Owner).SoundDampening);
PlayAnim('Loading', 1.4, 0.05);
Owner.PlaySound(CockingSound, SLOT_None,0.5*Pawn(Owner).SoundDampening);
FinishAnim();
Finish();
}

defaultproperties
{
}

Here is the code for the projectile.

//=============================================================================
// pbomb2.
//=============================================================================
class pbomb2 expands Grenade;

var Actor Createdby;
var() Actor Ownerb;

simulated function PostBeginPlay()
{
Super.PostBeginPlay();
SetTimer(29.0,False);
Ownerb = Instigator;
}

function Explode(vector HitLocation, vector HitNormal)
{
Local vector start;

HurtRadius(damage, 150, 'exploded', MomentumTransfer, HitLocation);
Start = Location;
Spawn(class'SpriteBallExplosion',,,Start);
Destroy();
}

function ProcessTouch (Actor Other, vector HitLocation)
{
if ((Other != Instigator) && (FlakShell(Other) == none))
Explode(HitLocation,Normal(HitLocation-Other.Location));
}

simulated function Timer()
{
Explode(Location,Location);
}

defaultproperties
{
}

I don't know what it could be...I think it's the fireoffset but i don't know.
 

Call me Erdrik

Arch Mage
Nov 24, 1999
334
0
0
43
Spring Hill, FL, USA
www.geocities.com
not really sure but I think:
Start = Start + FireOffset.X * X + Fireoffset.Y * Y + FireOffset.Z * Z;
_______^

do you really need the second start? I mean it looks like it hasn't even been defined yet, in fact you are defining it in that line?!

hope this helps.... :p
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
Originally posted by Call me Erdrik
not really sure but I think:
Start = Start + FireOffset.X * X + Fireoffset.Y * Y + FireOffset.Z * Z;
_______^

do you really need the second start? I mean it looks like it hasn't even been defined yet, in fact you are defining it in that line?!

hope this helps.... :p

It has been defined before (local vector start, ...) but putting it here is nonsense, because it has not been used before in that function.

/me asks himself when people will start using the [code] [/code] tags as this really helps to make the code readable...
 

Captain Kewl

I know kewl.
Feb 13, 2001
794
0
0
IN YOUR HOUSE
Visit site
??? The tutorial told you to type that? You sure? That'll give you a static vector not relevant to where the player is positioned. Try:

Code:
Start = Owner.Location + CalcDrawOffset() + FireOffset.X * X + FireOffset.Y * Y + FireOffset.Z * Z;

Owner.Location is where (surprise) the owner is located.
 

Captain Kewl

I know kewl.
Feb 13, 2001
794
0
0
IN YOUR HOUSE
Visit site
Static as in, "Not changing". Start represents where your projectiles are created, in world coordinates (look at the Spawn call a few lines down). Since FireOffSet is constant, so will the location where the projectiles are generated be.

It would sort of make sense that you'd want the projectiles to be generated somewhere near where the player currently actually is, right? :) That's why you want to get Owner.Location in there somewhere -- try putting that line right before the "Start = Start + FireOffset.X * X..." line.
 

Call me Erdrik

Arch Mage
Nov 24, 1999
334
0
0
43
Spring Hill, FL, USA
www.geocities.com
Originally posted by ma2Wolf
erm..i don't know what that means. I just wrote what the tutorial
told me to... The static vector bit... I am not sure what you mean.
After all i am really new to this :)

vectors are simply the x,y,z cooridents that tell where an actor is located. Location is a default vector all actor have. so even tho the vector Start was declared:
Code:
var vector Start;

The vector start wasn't defined, and thus used a default 'static vector'.
This is right:
Code:
var vector Start;

Start = YourActor.Location;
this defines 'Start' as the 'location' of YourActor.

there Wormbo I used me [ code ] [ /code ] tags :p

Place it just before the first Start is declared. like so:
Code:
Start = Owner.Location + CalcDrawOffset(); 
Start = Start + FireOffset.X * X + Fireoffset.Y * Y + FireOffset.Z * Z;

tada!! :)
Note that this is all to the best of my knowledge...