Announcement

Collapse
No announcement yet.

Unreal Development Kit Game Programming with UnrealScript: Beginner's Guide

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

    Hi
    Im stumped again and cant figure out what Im doing wrong. Page 104 part 4 compile code, I get errors.

    [0004.78] C:\UDK\UDK-AwesomeGame\Binaries\..\Development\Src\AwesomeGam e\Classes\AwesomePlayerController.uc : Error, End of script encountered while attempting to parse macro parameter

    AwesomePlayerController.uc
    Code:
     class AwesomePlayerController extends UTPlayerController;
    
    simulated function PostBeginPlay()
    {
          super.PostBeginPlay();
            `log("AwesomePlayerController spawned!";
    }
    defaultproperties
    {
    }

    AwesomeGame.uc
    Code:
      class AwesomeGame extends UTDeathmatch;
    
    defaultproperties
    {
        PlayerControllerClass=class'AwesomeGame.AwesomePlayerController'
    }
    AwesomeActor.uc
    Code:
      class AwesomeActor extends Actorplaceable;
    var() int MyInt;
    function PostBeginPlay()
    {
    `log(self @ MyInt);
    }
    defaultproperties
    {
    MyInt=4
    Begin Object Class=SpriteComponent Name=Sprite
    Sprite=Texture2D'EditorResources.S_NavP'
    HiddenGame=True
    End Object
    Components.Add(Sprite)
    }

    Comment


      Forgot the closing parenthesis before the semicolon in your log line in AwesomePlayerController.

      Comment


        Originally posted by Angel_Mapper View Post
        Forgot the closing parenthesis before the semicolon in your log line in AwesomePlayerController.
        WOW! Thanks, that was it, I dont know how I missed that.

        Your book is awesome! I have learned the MOST so far from your book. Your very good at teaching. I'm still struggling, but Im trying to follow your book step by step to the tee .

        I hope its ok to ask questions here.
        How did you figure out what my error was? Did you just read the code and noticed I left out the parenthesis, or did some software like ConText tip you off to which line the error was in ?

        Thanks again!

        Comment


          Experience. The error "End of script encountered while attempting to parse macro parameter" is almost always from a log line (I've rarely seen macros used for anything else in UnrealScript).

          Comment


            This is the best book on unrealscript to date, i recomend it to everyone who wants to learn

            Comment


              Originally posted by Angel_Mapper View Post
              Experience. The error "End of script encountered while attempting to parse macro parameter" is almost always from a log line (I've rarely seen macros used for anything else in UnrealScript).
              Thats great, I can only hope to be that good one day. The macro is what really had me confused and its nice to know macros are not used a lot.

              Comment


                Hello guys, I get stuck on chapter 3 and I'm not sure what's going on.

                It's suppose to change the camera to god view, but it's still on first person when i click on the auto exec.bat file after compile the code.

                AwesomePlayerControler.UE
                Code:
                class AwesomePlayerController extends UTPlayerController;
                
                var vector PlayerViewOffset;
                simulated event GetPlayerViewPoint(out vector out_Location, out Rotator out_Rotation)
                {
                    super.GetPlayerViewPoint(out_Location,out_Rotation);
                    
                    if(Pawn != none)
                        {
                            Pawn.Mesh.SetOwnerNoSee(false);
                            out_Location = Pawn.Location + PlayerViewOffSet;
                            out_Rotation = rotator(Pawn.Location - out_Location);
                        }
                }
                function Rotator GetAdjustedAimFor(Weapon W, vector StartFireLoc )
                {
                    return Pawn.Rotation;
                }
                defaultproperties
                {
                    PlayerViewOffset=(X=-64,Y=0,Z=1024)
                }
                AwesomeGame.uc
                Code:
                class AwesomeGame extends UTDeathmatch;
                defaultproperties
                {
                }
                AnotherGun.uc
                Code:
                class AnotherGun extends AwesomeGun;
                defaultproperties
                {
                    MyInt=4;
                }
                AwesomeActor.uc
                Code:
                class AwesomeActor extends Actor
                    placeable;
                
                var() int MyInt;
                function PostBeginPlay()
                {
                    `log(self @ MyInt);
                }
                defaultproperties
                {
                    MyInt=4
                    Begin Object Class=SpriteComponent Name=Sprite
                        Sprite=Texture2D'EditorResources.S_NavP'
                        HiddenGame=True
                    End Object
                    Components.Add(Sprite)
                }

                Comment


                  You have to add the following code to your AwesomeGame-class's defaultproperties if I recall correctly:

                  Code:
                  PlayerControllerClass=class'AwesomeGame.AwesomePlayerController'
                  I'm a beginner myself though!

                  Comment


                    Originally posted by HammelGammel View Post
                    You have to add the following code to your AwesomeGame-class's defaultproperties if I recall correctly:

                    Code:
                    PlayerControllerClass=class'AwesomeGame.AwesomePlayerController'
                    I'm a beginner myself though!
                    Worked like a charm, thank you so much!

                    I just following the book step by steep, unfortunately I never study any other programing language before.

                    Comment


                      For a people like me who was complete unfamiliar with programing language, what kind of devices can you guys give to me?

                      I pretend to read and practice everything inside the Unreal Script book, but i know its better to study other kind of language, so where's I can start?

                      It's better to keep going with UE book, or change to another kind of language to return later?

                      Thank you again.

                      Comment


                        I would suggest reading the UE book, because it is very easy to follow and will give a great grounding, but also making forays into C++ programming, as that is the language that the UDK will be using with UE4. Eyes on the future and all that.

                        Comment


                          So far the book has been an awesome help! Right now though I am stuck at Chapter 4, trying to get the UpgradeWeapon function to do anything.

                          AwesomeWeapon Code:
                          Code:
                          class AwesomeWeapon extends UTWeapon;
                          
                          var int CurrentWeaponLevel;
                          
                          function UpgradeWeapon()
                          {
                              CurrentWeaponLevel++;
                          }
                          
                          defaultproperties
                          {
                          
                          }
                          and AwesomeWeaponUpgrade Code:
                          Code:
                          class AwesomeWeaponUpgrade extends AwesomeActor
                              placeable;
                              
                          event Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal)
                          {
                              if(Pawn(Other) != none && AwesomeWeapon(Pawn(Other).Weapon) != none)
                              {
                                  AwesomeWeapon(Pawn(Other).Weapon).UpgradeWeapon();
                                  Destroy();
                              }
                          }
                          
                          function UpgradeWeapon()
                          {
                              CurrentWeaponLevel++;
                              `log("Current Weapon Level:" @ CurrentWeaponLevel);
                          }
                          
                          defaultproperties
                          {
                              bCollideActors=True
                              
                              Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
                                  bEnabled=TRUE
                              End Object
                              Components.Add(MyLightEnvironment)
                              
                              Begin Object Class=StaticMeshComponent Name=PickupMesh
                                  StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup'
                                  Materials(0)=Material'EditorMaterials.WidgetMaterial_Y'
                                  LightEnvironment=MyLightEnvironment
                                  Scale3D=(X=0.125,Y=0.125,Z=0.125)
                              End Object
                              Components.Add(PickupMesh)
                              
                              Begin Object Class=CylinderComponent Name=CollisionCylinder
                                  CollisionRadius=16.0
                                  CollisionHeight=16.0
                                  BlockNonZeroExtent=true
                                  BlockZeroExtent=true
                                  BlockActors=true
                                  CollideActors=true
                              End Object
                              CollisionComponent=CollisionCylinder
                              Components.Add(CollisionCylinder)
                          }
                          As far as I can tell this is correct (I even copy pasted it when I re-tried it). If I understand correctly, AwesomeWeapon(Pawn(Other).Weapon).UpgradeWeapon(); is supposed to make it so calling the function UpgradeWeapon in the AwesomeWeaponUpgrade class will execute it from the AwesomeWeapon class.

                          But when I compile I get this error: C:\UDK\UDK... ...AwesomeWeaponUpgrade.uc<15> : Error, 'CurrentWeaponLevel': Bad command or expression.
                          This means that AwesomeWeaponUpgrade is not reading the function from AwesomeWeapon, correct?

                          EDIT: this one slapped me in the face suddenly... I got the classes mixed up. fixed it!

                          Comment


                            Glad you got it sorted, let me know if you have any other problems.

                            Comment


                              Hi Angel i am currently studying a game development course in Australia they handed out your book to us to read as part of the apply object oriented programming unit. So far it is the only source of learning unreal script they have given us apart from leaving us to our own devices on the web.

                              Comment

                              Working...
                              X