1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. 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.

Started coding (Newbie question)

Discussion in 'Programming' started by ma2Wolf, Feb 7, 2002.

  1. jb

    jb New Member

    Joined:
    May 22, 2000
    Messages:
    278
    Likes Received:
    0
    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 :)
     
  2. Call me Erdrik

    Call me Erdrik Arch Mage

    Joined:
    Nov 24, 1999
    Messages:
    334
    Likes Received:
    0
    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 ...
     
  3. Call me Erdrik

    Call me Erdrik Arch Mage

    Joined:
    Nov 24, 1999
    Messages:
    334
    Likes Received:
    0
    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......
     
  4. phx

    phx New Member

    Joined:
    Feb 9, 2002
    Messages:
    5
    Likes Received:
    0
    i guess its time for the pain in the ass tactic of
    if(enemy!=none) {...}
    every few lines ;p
     
  5. Call me Erdrik

    Call me Erdrik Arch Mage

    Joined:
    Nov 24, 1999
    Messages:
    334
    Likes Received:
    0
    I was afraid of that :( *sigh*

    :p oh well
     
  6. ma2Wolf

    ma2Wolf all round stupid imbecile

    Joined:
    Feb 7, 2002
    Messages:
    22
    Likes Received:
    0
    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
     
  7. jb

    jb New Member

    Joined:
    May 22, 2000
    Messages:
    278
    Likes Received:
    0
    Usally this means that you have a missing "{" or "}" now finding where this one missing is not easy sometimes :)
     
    Last edited: Feb 19, 2002
  8. ma2Wolf

    ma2Wolf all round stupid imbecile

    Joined:
    Feb 7, 2002
    Messages:
    22
    Likes Received:
    0
    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.
     
  9. Call me Erdrik

    Call me Erdrik Arch Mage

    Joined:
    Nov 24, 1999
    Messages:
    334
    Likes Received:
    0
    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
     
  10. ma2Wolf

    ma2Wolf all round stupid imbecile

    Joined:
    Feb 7, 2002
    Messages:
    22
    Likes Received:
    0
    i don't know

    I am not sure, I used a tutorial so it is basically the same as it says in there. Please help i don't know what to to do...My Email is ma2wolf@yahoo.com
     
  11. ma2Wolf

    ma2Wolf all round stupid imbecile

    Joined:
    Feb 7, 2002
    Messages:
    22
    Likes Received:
    0
    Mistake!!!!

    Sorry... ma2wolf@yahoo.co.uk

    I really need help. feel free to Email me. Please don't think i'm being cheeky... Sorry for troubling everyone.
     
  12. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    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...
     
  13. Captain Kewl

    Captain Kewl I know kewl.

    Joined:
    Feb 13, 2001
    Messages:
    794
    Likes Received:
    0
    ??? 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.
     
  14. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    I guess there's one line missing in that tutorial:
    Code:
    Start = Owner.Location + CalcDrawOffset();
    That's why there's that confusing "Start = Start + ..." line in it.
     
  15. ma2Wolf

    ma2Wolf all round stupid imbecile

    Joined:
    Feb 7, 2002
    Messages:
    22
    Likes Received:
    0
    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 :)
     
  16. ma2Wolf

    ma2Wolf all round stupid imbecile

    Joined:
    Feb 7, 2002
    Messages:
    22
    Likes Received:
    0
    where does this go???

    Start = Owner.Location + CalcDrawOffset();

    I'm sorry to be asking but i don't know much...
     
  17. ma2Wolf

    ma2Wolf all round stupid imbecile

    Joined:
    Feb 7, 2002
    Messages:
    22
    Likes Received:
    0
    Hold On!!! Static Vectors?? Is that why i get PipeBombs all over the place??

    Just Asking:)
     
  18. ma2Wolf

    ma2Wolf all round stupid imbecile

    Joined:
    Feb 7, 2002
    Messages:
    22
    Likes Received:
    0
    This is the first forum ive been on...i've just found out how to use the "quote" button...Sorry for being extremely dumb;)
     
  19. Captain Kewl

    Captain Kewl I know kewl.

    Joined:
    Feb 13, 2001
    Messages:
    794
    Likes Received:
    0
    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.
     
  20. Call me Erdrik

    Call me Erdrik Arch Mage

    Joined:
    Nov 24, 1999
    Messages:
    334
    Likes Received:
    0
    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...
     

Share This Page