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.

Reload key

Discussion in 'Programming' started by Postal, Nov 11, 2001.

  1. Postal

    Postal I apear to have lost my pin.

    Joined:
    Nov 14, 1999
    Messages:
    1,388
    Likes Received:
    0
    I want the guns in C4 to reload when you hit a key

    but first when I tried Button bExtra3:
    simulated function Tick(float DeltaTime)
    {
    if (Pawn(Owner) != None && Pawn(Owner).Weapon == self)
    {
    if (PlayerPawn(Owner).bExtra3 != 0)
    {
    GoToState('NewClip');
    }
    }
    }

    I got lotss of access nones, or something or another warning in the ut log

    But when I when to using an exec function in the gun, sometime after a while in game it stops working.

    What do you all suggest?
     
  2. 2COOL4-U

    2COOL4-U New Member

    Joined:
    Mar 17, 2001
    Messages:
    505
    Likes Received:
    0
    could it be that the animations are not done for the weapons you want to reload, I think we here at Defence Alliance had a problem with no animations while the base weapon class was trying to play them, after that happend I couldn't do anything at all with the weapons until I killall'ed the weapon
     
  3. Postal

    Postal I apear to have lost my pin.

    Joined:
    Nov 14, 1999
    Messages:
    1,388
    Likes Received:
    0
    cant be that, alt fire currently also reloads the guns, no prob there.

    its just a ways into the game, sometime the exec reload just stops working, with out giving ut any errors.

    Oh, DA looks like it will be a real fun mod, looking foward to playing it, nice models too.
     
  4. Sg_Jack

    Sg_Jack New Member

    Joined:
    Nov 12, 2001
    Messages:
    12
    Likes Received:
    0
    I think the exec functions must be in a player class. You should make a subclass of Tournament player, and in this file put something like that :

    exec function Firemodes()
    {
    if (weapon != None && weapon.IsA('ATFireArms'))
    {
    ATFireArms(weapon).SwitchFireMode();
    }
    }

    I use this in my mod to add new functions for keys. They, you make a new keybinding class with this function. It's pretty easy.

    But maybe you have already test it ?
     
  5. Postal

    Postal I apear to have lost my pin.

    Joined:
    Nov 14, 1999
    Messages:
    1,388
    Likes Received:
    0
    The very last thing I want to do is make a new playerclass, in fact I wont even do that.

    Its possible to run execs in other classes too btw.

    And you can always use tick, which I am about to go back to, but I would rather not. Unfortunaly sometimes in game the the exec stops working, but after switching weapons, it sometimes works again, perhaps theres some confilict with a state?
     
  6. Sg_Jack

    Sg_Jack New Member

    Joined:
    Nov 12, 2001
    Messages:
    12
    Likes Received:
    0
    Don't understand...

    Ok, i didn't knew you don't want to make a player class...

    But there is somthing i don't understand : why don't you want to make binding keys ??? You could put your exec function in your weapon class, and assign it to a key.

    You're not forced to make a tick function ? Why don't you test the ammo level (in a clip) before fire ? If there is no more bullets, the code goto a reload state.

    I think it's better. If you use a tick function, you can (and you have ) conflicts if another function want to access a state in the same time of your tick...

    What do you think ?
     
  7. Postal

    Postal I apear to have lost my pin.

    Joined:
    Nov 14, 1999
    Messages:
    1,388
    Likes Received:
    0
    ARG!

    I dont want auto-reload, I spent a good bit a time a long time ago getting all of that out of there!

    I have an exec in my weap class, but it doesnt always work, thats what this post is about.

    Tick works fine for me ingame, but it make the logs hugh with its accessed nones, exec makes no errors, but doesnt always work, Im still wondering how to either make the tick not give accessed nones, or make the exec in gun work all the time.
     
  8. Sg_Jack

    Sg_Jack New Member

    Joined:
    Nov 12, 2001
    Messages:
    12
    Likes Received:
    0
    Hey, i'm trying to help you. So, don't answer me like this OK ??

    I don't say you to make autoreload... You can either make a new key... Making a new key doesn't mean that you'll not control your reload process...

    But you don't seem to understand that maybe your code don't work... So, if you want any solution, let's stay with your bug ok ?

    Cya
     
  9. Postal

    Postal I apear to have lost my pin.

    Joined:
    Nov 14, 1999
    Messages:
    1,388
    Likes Received:
    0
    Why is everyone so touchy at the moment? I am getting frustrated, for I am not getting a single answer that can help?

    I did make a new key, an exec function reload, but unforuntaly its doesnt always work, does anyone have an idea of why that may be?

    OR, should I go back to useing tick to check for the player hitting button bextra3

    there are no conflicts with my tick code, only access nones
    but my exec, while creating no errors in log, still sometimes does not work in game(will work a while, stop working, then sometimes work again)
     
  10. Sg_Jack

    Sg_Jack New Member

    Joined:
    Nov 12, 2001
    Messages:
    12
    Likes Received:
    0
    sorry

    Well, i'm not angry. I try to hlp you as best as i can, and you say me that you don't care about what i say...

    You could be more friendly with something trying to help you...

    About access nones, i have no idea sorry. Hope you'll find a solution :)
     
  11. eXoR

    eXoR Lead coder

    Joined:
    Oct 22, 2001
    Messages:
    36
    Likes Received:
    0
    Hey,

    I don’t know what the problem is with your exec function. I use exec functions in my mutator, in a subclass of Actor. It works great, all the time.

    Now, about your Tick implentation. The Accessed None’s should be very obvious. In your if statement, you check if the weapons Owner is a valid Pawn, and then if it’s current weapon is your gun. Then, if it is a Pawn and it is your gun, you cast the Owner reference to a PlayerPawn. Thus, if any Bot is holding your weapon, the Pawn check and the weapon check will be passed. But when you try to cast that Bot to a PlayerPawn, it won’t work and there you go – accessed none. So, changing your If statement to this:

    if (Playerpawn(Owner) != None && Pawn(Owner).Weapon == self)

    it will not pass if the Owner is a Bot, and thus the cast won’t be made, and thus there will be no accessed none’s. Hope this helps you,

    eXoR.
     
  12. Postal

    Postal I apear to have lost my pin.

    Joined:
    Nov 14, 1999
    Messages:
    1,388
    Likes Received:
    0
    Finally! Very gratefull.
     

Share This Page