Announcement

Collapse
No announcement yet.

[n00b] Basic vehicle mod: health + speed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [n00b] Basic vehicle mod: health + speed

    Hi,

    Sorry if this is a hilariously noob question but I'm trying to make my first UnrealScript, I started using UnrealEd yesterday and I've moved onto making a SuperLeviathan class, which I'd quite like to be a subclass of ONSMobileAssaultStation with 10,000 health and ~ 3x the normal acceleration / max speed of a typical leviathan.

    Unfortunately, no luck. I tried sifting through some of ONSMobileAssaultStation's superclasses to try to figure out how that class actually sets its speed and health, etc. itself, but couldn't find anything. I also tried a couple of things which seemed reasonably logical, to no avail. It behaves like a standard Leviathan.

    Here's my code for a SuperLeviathan:

    Code:
    class SuperLeviathan extends ONSMobileAssaultStation;
    
    simulated function PostBeginPlay()
     {
     OutputGas=500.0
     EngineInertia=500.0;
     EngineBrakeFactor=0.0;
     
     MaxDesiredSpeed=500.0;
     
     HealthMax=10000;
     
     Super.PostBeginPlay();
     }
    I also created a SuperLeviathanFactory subclass of ONSMASFactory, and used UnrealEd to insert a SuperLeviathanFactory into a modified version of the Torlan map, with the VehicleClass variable inherited from SVehicleFactory set to SuperLeviathan as appropriate (I think). Behaves just like a normal leviathan when I test it.

    Can anyone give me some getting started tips / anything I'm doing glaringly wrong? Sorry if this was a bit of a long / nooby post. I'm a pretty experienced programmer so once I get to grips the basics of UnrealScripts I should stop having such basic problems If anyone can point me to some good tutorials that'd be appreciated also.

    Thanks in advance for any help.

    Giftiger Wunsch


    ~~EDIT: This is for UT2004, if that's significant.

    #2
    have a look at ini's code tutorials if your just getting started - http://shaungoeppinger.com/tutorials.html

    your kinda on the right lines..ish, im sure the Health Max is set in the default properties, have a look at the old ONSMobileAssaultStation and looks at its default properties, and you apply them to your new class the same way

    Code:
    defaultproperties
    {
      healthmax=2000000
    }
    the default properties go at the bottom of the class

    Comment


      #3
      Thanks for the reply, I'll have a look at the tutorial.

      I tried what you suggested, but there's no defaultproperties section for ONSMobileAssaultStation, and when I tried the code you provided, it produced a compile time error: Unexpected 'defaultproperties'.

      I dumped ONSMobileAssaultStation into notepad to do a couple of searches for obvious phrases, but 'default', 'health', 'speed', and 'torque' all threw a blank. I've had a quick browse through the script and mainly it just seems to deal with transformation between the leviathan's deployed and undeployed states; I don't know how or where the leviathan sets its health, speed/handling, etc., but it doesn't seem to be in the script I'm looking at.

      Thanks for the help and the tutorial link, any further suggestions on what I'm missing here would be appreciated.

      Giftiger Wunsch

      Comment


        #4
        ok, there are alot of default prop's for it, how are you looking at the code? are you using unrealed to do so? if so unrealed does not show default prop's, best way is to download all the source code and look at it like that.

        link to source code - http://download.beyondunreal.com/fil...cripts3369.zip

        alternativly you can download a prog like UTPT or WOTgreal, WOTgreal is a big program to write script in too, i just use Context for my script tho..

        and there's 2 reason's i can think of why it says Unexpected 'defaultproperties', 1st one is normally when {'s and }'s are in wrong places, or to many/few etc, and other might be your using unrealed to do your script in too? just a guess, im not sure if you can compile default prop's in unrealed, iv never used it before

        code below Should work to change the health..

        Code:
        class SuperLeviathan extends ONSMobileAssaultStation;
        
        defaultproperties
        {
         Health=10000
         HealthMax=10000.000000
         
         // Blanked this out for now
         // never rly done Vehicle's so duno if these work, but they should be placed here in default prop's
         // OutputGas=500.0
         // EngineInertia=500.0;
         // EngineBrakeFactor=0.0;
        
         // MaxDesiredSpeed   // duno where you got this from, cannot find it in default lev class?
        
        }
        it is possible the default properties can be changed in unrealed tho, it depends on how your creating your code.. in urealed, you can extend a class, right click and change some of its default prop's there and save your new class, but not all default prop's are shown there, some things are not given the option to appear there.

        Comment


          #5
          I figured UnrealEd may have been the problem there; it did seem very strange that there was absolutely no mention of things like health, etc. which one way or another must be set somewhere. I was indeed using UnrealEd to edit the script, and I noticed that the Default Properties section didn't even contain an entry for ONSMobileAssaultStation.

          By the way, most of the stuff I changed were some random things to see if anything changed when I tested it, the MaxDesiredSpeed I believe I found in either the Pawn class or the Vehicle class.

          If I can't use UnrealEd to edit the script properly, am I going to need to download a command-line compiler as well? How would I compile the scripts and make my packages accessible in UnrealEd?

          Comment


            #6
            You can just write your scripts in notepad: go to your ut2004 directory create a new map in it called SuperLeviatan make a new map in it called Classes and put ur scripts in classes with a .uc extension which you have to open in notepad. if your done with your scripts compile it (easiest way to do this is using umake 1.1) if your using umake 1.1 than select your project map and click on compile. when its done it just says 'done' else it gives an failed message, and mostly when i cant solve the problem, i post the source and error here and always get help with it

            Comment


              #7
              Ah; I just found the location of this ucc.exe I have heard about. It's just in my UT2004 directory's System folder; this is the compiler, correct? If so I'll just add this folder to my system path and compile scripts from command line.

              I'll try NightMan's suggestion now that I've resolved that part...

              Comment


                #8
                Probably a stupid question, but after downloading the source from NightMan's link and adding my own source script to it, where should these files be placed?

                Comment


                  #9
                  Originally posted by [CD]Troy View Post
                  (...) go to your ut2004 directory create a new map in it called SuperLeviatan make a new map in it called Classes and put ur modified scripts in classes with a .uc extension which you have to open in notepad. if your done with your scripts compile it
                  And about ucc: use commendlet to compile things but first add one new line under EditPackages your new line has to be EditPackages=SuperLeviatan

                  now open commandlet and put in this command

                  Code:
                  YOUR_UT2004_DIRECTORY\System\Ucc.exe make
                  Hope this helps you understanding it a little more

                  Comment


                    #10
                    Sorry, but I didn't understand the quote the first time round and I still don't How do I create a map inside a map? And how to I put classes in a map? That doesn't make any sense to me; is there a piece of software I'm meant to be using? I'm assuming you mean folder rather than map. But that doesn't seem to be working.

                    When you say I need to add a new line under EditPackages, where would I find that? Where do I add this line?

                    Thanks.

                    Comment


                      #11
                      Right I discovered I need to edit the System\ut2004.ini file to include the line you mentioned; thanks for giving me that key piece of information and I put my package (which I named Giftig01) in the root UT2004 folder.

                      My class seems to be being compiling properly now, though putting package folders in the root directory seems a bit messy. How would I point the ini file to a different location to look for classes, so that I can put the source I downloaded and my own packages in a Packages subfolder for example? I assume there must be a way of doing this.

                      Thanks for the help so far.

                      EDIT:

                      Sorry for all the questions, but I tried SuperLeviathan script and it works now; but unfortunately it doesn't seem to be even compiling SuperLeviathanFactory, in the same package; I had to use the ONSMASFactory class to add the superlev to the map. The script doesn't exist when I look in UnrealEd, and when I add a syntax error to the script, it doesn't show any errors when running ucc make. Any ideas why?

                      SECOND EDIT:

                      The problem was that it won't recompile the package unless I delete the .u files from the System folder and then try again. Which is pretty inconvenient. Is there a way around that?

                      Comment


                        #12
                        Originally posted by giftiger_wunsch View Post
                        The problem was that it won't recompile the package unless I delete the .u files from the System folder and then try again. Which is pretty inconvenient. Is there a way around that?
                        ok here is what i did,

                        1. Copy your UT2004.ini file
                        2. keep it in your system folder but rename it (UT2004Make.ini for example)
                        3. The reason i did this, is because you can delete a lot of the edit packages out to make your code to compile much faster, you only need the packages that your code is an extension of, so if your extending the rocket launcher you need the package xweapons in the list as your extending that class. if you just add a ; before the line's you don't need it wont read that line
                        4. Create a New Batch File

                        so right click inside system folder - new text document, call it make, and change the extension to Bat, not txt, so full name will be Make.bat

                        5. Edit the Batch file so it looks like this

                        Code:
                        @echo off
                        del %1.u
                        ucc make -ini=ut2004make.ini

                        all done, now test

                        6. so, open command prompt (or use run, and type in cmd to do this if you don't know how)

                        7. locate your system folder, so something like cd UT2004\system

                        8. type in your new command - make yourpackagename.u

                        and it will run your batch file which will use your new ut2004make.ini and will delete your old compiled file for you.

                        9. if you use context you can make this to a key bind, so you just press 1 key and if runs your batch for you, so if you are planning on doing a lot of work in uscript i would tell you to go for context simply for that feature altho i bet wotgreal does that too but i never could get my head around that program lol

                        - of course you can just use the normal ut2004.ini, i like to have a separate one tho, choice is entirely yours


                        if you have any problems or there's any thing else you have prob's with feel free to ask

                        im guessing you worked out how to set up your class's in correct place as it compiles but just in case, ini made a quick tut

                        http://shaungoeppinger.com/devpackage.html


                        edit - and btw, this will give you a .u file, if you add things into your map using this .u file, you will need to send the .u file off with the map, people who dont have the .u file wont be able to load the map. however if your interested there is a way to embed your .u file into the map if you want it

                        http://wiki.beyondunreal.com/Legacy:Embedding_Code

                        Comment


                          #13
                          Environment mostly fine; couple of issues trying to increase speed though.

                          Thanks for the info NightMan; I had worked out most of that already, my main concern is just that I can't figure out how to direct the ini file to locate packages which aren't in the root folder, i.e. instead of my package Giftig01 being at UT2004/Giftig01, I want to put it out of the way in UT2004/CustomPackages/Giftig01 for example. If that's not possible or unnecessarily complicated then I'll put up with it I guess.

                          The compiler seems pretty poorly designed, especially in that the .u files need to be deleted prior to recompiling, rather than being automatically overwritten. I had already created a batch file to remove the appropriate .u files prior to recompiling, so I'll just stick with that.

                          Originally posted by NightMan
                          if you use context you can make this to a key bind, so you just press 1 key and if runs your batch for you, so if you are planning on doing a lot of work in uscript i would tell you to go for context simply for that feature altho i bet wotgreal does that too but i never could get my head around that program lol
                          I'm not a big fan of IDEs, I've always preferred just using a basic text editor (like notepad or Editpadpro) and a command-line compiler, so I'll stick with that.


                          Another quick question - since I have to delete the .u files prior to recompiling, I also have to restart UnrealEd everytime I modify a script at the moment. But I don't need to edit my test map at the moment, just my scripts; so is there a fast way of starting a test-play of a particular map without using UnrealEd? I notice that UnrealEd seems to start UT2004 with arguments to indicate it needs to start a particular map; is there an easy way of doing this from the command line?

                          Thanks for all the help. And just to reiterate, I'm a pretty experienced programmer so I'm happy with modifying / compiling the scripts, using the command line / batch files, etc., and I can pick things up pretty quickly; it's just unreal-specific stuff which I'm new to. Granted that's most of what I need to know to create UnrealScripts Thought that'd save you a bit of time explaining basic stuff.


                          So far I've got my SuperLeviathan's HP increased to 55,000 for the moment, and I've given it a new name and VehicleLocationString. I've given it a new torque curve, but I've made that based on a pure guess as to how Curves are constructed in UnrealScript. I've also changed the gear ratios to try to make it move more quickly, but so far the increase in speed seems minimal despite multiplying the gear ratios by 4 (though there does appear to be a change).

                          My SuperLeviathan class is below, with some comments added to show values set by ONSMobileAssaultStation:

                          Code:
                          class SuperLeviathan extends ONSMobileAssaultStation;
                          
                          DefaultProperties
                           {
                           Health=55000;
                           HealthMax=55000;
                           
                           TorqueCurve=(Points=((InVal=0,OutVal=36.0),(InVal=1200,OutVal=4.0),(InVal=3500,OutVal=5.5),(InVal=7500,OutVal=0.0))) //guessed how to change this. seems to significantly increase torque compared to normal Leviathan though.
                           SteerSpeed=180; // usually 120. doesn't really change much; need to change the steering angle curve to have a big effect. usually
                           RevMeterScale=8000; //tried playing with some gear controls
                           MaxBrakeTorque=40.0;
                           ChangeUpPoint=8000;
                           ChangeDownPoint=1000;
                           GearRatios[0]=-0.8; //reverse gear: usually -0.2
                           GearRatios[1]=0.8; //leviathan has a single forward gear: usually 0.2
                           
                           VehiclePositionString="in the Chariot of Death"
                           VehicleNameString="Giftig Destroyer";
                           
                           /* not a clue what Karma is all about, but KMaxSpeed caught my eye.
                            * not sure if doubling KMaxSpeed had any effect though.
                            */
                           Begin Object Class=KarmaParamsRBFull Name=KParams0
                            KStartEnabled=True
                            KFriction=0.5
                            KLinearDamping=0.05
                            KAngularDamping=0.05
                            KImpactThreshold=500
                            bKNonSphericalInertia=True
                            
                            bHighDetailOnly=False
                            bClientOnly=False
                            bKDoubleTickRate=True
                          
                            KInertiaTensor(0)=1.260000
                            KInertiaTensor(1)=0
                            KInertiaTensor(2)=0
                            KInertiaTensor(3)=3.099998
                            KInertiaTensor(4)=0
                            KInertiaTensor(5)=4.499996
                          
                            KMaxSpeed=1300.0 //usually 650.0
                          
                            KCOMOffset=(X=0,Y=0,Z=0)
                            bDestroyOnWorldPenetrate=True
                            bDoSafetime=True
                            Name="KParams0"
                           End Object
                           }

                          Comment


                            #14
                            Hmm no replies for a week, can anyone help? The main thing I want to know at the moment is how to make my SuperLeviathan go fast The rest is just minor stuff which I'll figure out as I go along if necessary.

                            Comment


                              #15
                              heres the easy way to adjust it
                              http://sayunkle.com/Mutators/2k4_vehiclestuff.zip

                              VehicleStuff is a mutator for UT2004 that allows you (through use of a GUI)Â
                              Â to change various vehicle properties, such as speed, friction, mass, health,
                              jumping, etc.

                              Comment

                              Working...
                              X