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.

Help with Coding...

Discussion in 'Programming' started by Cieprus, Feb 19, 2002.

  1. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Ya Ya I know its the "Wrong Forum" But this is the UT for...But I need some serious serious help with creating a simple mutator...All I want to do Is make the enforcer shoot faster...Yes, Sound simple, but Ive done EVERYTHING, I seriously have, And I cant get it to work...Please someone help me...At this point I would pay...Well, Not literally. But Im desperate
     
  2. hal

    hal Dictator Staff Member

    Joined:
    Nov 24, 1998
    Messages:
    21,405
    Likes Received:
    18
    As you already know that it's the wrong Forum, I'll skip that part and just suggest that you try the Coding, Chimeric, Nali City, or one of the hosted mod Forums. You'll always get a better response if:

    A) You use the forums that pertain to your topic
    B) We insist that you do

    Otherwise people would just post every topic in the busiest forum, and nothing would ever get a good chance at getting properly discussed.

    It's just happened too many times: people post a topic in the wrong forum and get little or no response - we move the thread to the correct forum, and responses pour in. We want questions to get answered, and though sometimes there just aren't many people who can answer certain questions, this is really the best way. :)

    Sorry - I'm not directing this just to you, Cieprus, but to everyone as this problem is surfacing a lot lately. :cool:
     
  3. jb

    jb New Member

    Joined:
    May 22, 2000
    Messages:
    278
    Likes Received:
    0
    Cieprus,

    the folks over here can be very helpful but we will need to know what errors you had. Did it not complie? Did it not work in the game? Did it not work as a mut?
     
  4. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Well im not at my computer right now, But which class declaration should I use?

    class Superenfor expands Mutator;

    or

    class Superenfor expands Enforcer;

    The code is simple, it modifies the PlayAnim function to fire faster...
     
  5. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    You need to code the weapon (SuperEnforcer expands Enforcer) and a mutator to use it in the game:
    Code:
    class SuperEnforcerMutator expands Mutator;
    
    function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
    {
    	if ( Other.IsA('Enforcer') && !Other.IsA('SuperEnforcer') ) {
    		ReplaceWith(Other, "<yourPackage>.SuperEnforcer");
    		return true;
    	}
    	return false;
    }
    This is just the basic concept of a mutator replacing one weapon with a subclass of that weapon. As the Enforcer is the default weapon in UT games funny things might happen when players respawn, but it's good enough for testing your new weapon.
    If you don't want to write a mutator for testing stuff your (you need to make that mutator sooner or later) I suggest you use the "Summon" console command or my Arena Match mutator for the testing stuff.
     
  6. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Ahhh Its all coming to me now... So I will need 2 class files for my mutator to work....

    class Superenformutator expands Mutator;

    function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
    {
    if ( Other.IsA('Enforcer') && !Other.IsA('SuperEnforcer') ) {
    ReplaceWith(Other, "<yourPackage>.SuperEnforcer");
    return true;
    }
    return false;
    }

    ~AND~

    class Superenfor expands Superenformutator;
    {
    My mutator code...
    }
     
  7. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    Ah almost...
    it will be
    class Superenfor expands enforcer
    You're on the right track.
     
  8. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    So it will be

    class Superenformutator expands Mutator;

    (...)

    ~AND~

    class Superenfor expands mutator;

    (...)

    Then whats this for:

    class Superenformutator expands Mutator;

    ???????
     
  9. jb

    jb New Member

    Joined:
    May 22, 2000
    Messages:
    278
    Likes Received:
    0
    that is the key :)

    You need two. One for the mut which will replace the enforcers with yours. The other one defines your new enforces.
     
  10. Wormbo

    Wormbo Administrator Staff Member

    Joined:
    Jun 4, 2001
    Messages:
    5,913
    Likes Received:
    36
    Since your weapon is named Superenfor you have to write Superenfor instead of SuperEnforcer. And you have to replace <yourPackage> with the name of the package your new weapon is compiled to (the name of the .u file without ".u").

    /me wonders why n00bs often just copy and paste without using their brain...:con: (OK, maybe I should have pointed out these changes and should have read that upcomming programmer's code more carefully :rolleyes::p)

    Oh, yeah: It is "SuperEnforMutator extends Mutator" (use some capital letters, this makes it easier to understand the code) and "SuperEnfor extends Enforcer". (Why doesn't he use SuperEnforcer?)
     
  11. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    /me wonders why he doesnt use SuperEnforcer either...Thanks for the help...Im going to go try it and come up with more erros for you great coders to figure out!!
     
  12. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Here what I got sooo Far:

    SuperEnforcerMutator.uc

    class SuperEnforcerMutator extends Mutator;

    function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
    {
    if ( Other.IsA('Enforcer') && !Other.IsA('SuperEnforcer') ) {
    ReplaceWith(Other, "SuperEnforcer.SuperEnforcer");
    return true;
    }
    return false;
    }

    SuperEnforcer.uc

    //
    class SuperEnforcer extends SuperEnforcerMutator;

    simulated function PlayFiring()
    {
    PlayOwnedSound(FireSound, SLOT_None,2.0*Pawn(Owner).SoundDampening);
    bMuzzleFlash++;
    PlayAnim('Shoot',3.0 + 0.31 * FireAdjust, 0.02);
    }

    simulated function PlayAltFiring()
    {
    PlayAnim('T1', 1.3, 0.05);
    bFirstFire = true;
    }
     
  13. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    I got this error...



    Analyzing...
    Parsing SuperEnforcerMutator
    Parsing SuperEnforcer
    Compiling SuperEnforcerMutator
    Compiling SuperEnforcer
    F:\Games\Unreal Tournament\SuperEnforcer\Classes\SuperEnforcer.uc(6) : Error, Ca
    ll to 'PlayOwnedSound': bad or missing parameter 1
    Failed due to errors.

    History: CompileError <- TryCompile <- FScriptCompiler::CompileScript <- (Class
    SuperEnforcer.SuperEnforcer, Pass 1, Line 6) <- CompileScripts <- CompileScripts
    <- CompileScripts <- CompileScripts <- CompileScripts <- CompileScripts <- DoSc
    ripts <- UEditorEngine::MakeScripts <- UMakeCommandlet::Main

    Exiting due to error
     
  14. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Whats the difference between Expands & Extends??
     
  15. TURY

    TURY SAS Lead Coder

    Joined:
    Nov 4, 2001
    Messages:
    17
    Likes Received:
    0
    nothing really..basicly.
     
  16. TaoPaiPai

    TaoPaiPai Commisaire Van Loc

    Joined:
    Jun 13, 2000
    Messages:
    1,626
    Likes Received:
    0
    the secon class should be:
    Class SuperEnforcer EXTENDS ENFORCER
    capice?
     
  17. EasyRaider

    EasyRaider Crazy coder

    Joined:
    Sep 21, 2001
    Messages:
    74
    Likes Received:
    0
    It makes no difference to the compiler, but you might as well learn to use "extends" sooner instead of later. (AFAIK, "expands" will be taken out for Unreal 2).
     
  18. Cieprus

    Cieprus Mapper...In Progress

    Joined:
    Feb 17, 2002
    Messages:
    113
    Likes Received:
    0
    Ok well I tryed the
    Class SuperEnforcer extends Enforcer;

    But It still doesnt work...

    Capice:cool:
     
  19. Call me Erdrik

    Call me Erdrik Arch Mage

    Joined:
    Nov 24, 1999
    Messages:
    334
    Likes Received:
    0
    umm what about it doesn't work?

    GIVE ME THE DIRT MAaAaANNN!!!! lol :lol:
     
  20. TURY

    TURY SAS Lead Coder

    Joined:
    Nov 4, 2001
    Messages:
    17
    Likes Received:
    0
    ya, your error doesnt have to do with your class definition, check your ucc log, and paste here what he problem was.
     

Share This Page