No announcement yet.

Plastic Shield Gun

  • Filter
  • Time
  • Show
Clear All
new posts

    Plastic Shield Gun


    I learnt UnrealScript this week-end (well, the basics, at least), and I began with modifying the Shield Gun.

    After some work (why is the momentum called force is some cases and force in other ? ), I have something that is not balanced, but that actually works w/o code problems.
    However, I have a texture problem.
    I exported the original texture, modified it's hue to make it red, saved it as a bitmap, and imported it in UEd, setting the same parameters as the original one (LoD, etc).
    Then, I add the following line to my Inventory and Pickup class :
    Problem is, when seen in first person, the weapon has a stupid shiny / plastic look. But when I spawn the pickup, it has a normal texture. I tried looking at material, but I did not see anything I could have done wrong.
    I used the search function, but all I found was people actually wanting this effect and not knowing how to set it. I have it, and want to get rid of the plastic look

    I also have the following questions :
    1. Is there a reference or something ? Because the code is not always well documented, and having to start UEd to browse the whole Object class is a pain. I don't want to use WotGreal.
    2. How come this is called UnrealScript if it's not compiled at runtime ?
    3. For arrays, I tried Array(0) and Array[0]. Is there a difference ?
    4. I wasn't able to find the % of damage the ShieldAltFire is able to absorb instead of the player. Can somebody point me that out ?
    5. I think the source code is available on UDN. How much space does it take when uncompressed ? (I don't have wuch room on this comuter, and that would mean putting the source on another computer) Is it well documented ?

    Well, I think that's all (even if I feel i forgot something...)

    The consistance of what any one variable might be called between classes is a little sporadic, but never if they have to commnunicate...

    The texture I have no idea, maybe you have it too bright?

    The rest:
    1. Really UDE or WotGreal ar great but: is a great source of info (though sometimes it does require some digging to get what you want) for Uscript
    2. When you compile it with UCC it actually just takes it down to bytecode, sort of like shorthand for your code, then it's executed per instruction on the server, somewhat like old BASIC was, command by command, instead of compiling it down to a machine level instruciton (like C, or pascal)
    3. Depends where you use the brackets:
    var int intarray[2]; creates a static array of 3 lenght, and when you access it in code you have to use the [] as well ( x=intarray[1]; )
    However in defaultproperties you would use intarray(1)=2 to set it. Why defaultproperties is different I don't know, but using () in code will lead to a compile error.
    4. in ShieldGun:
    function AdjustPlayerDamage( out int Damage, Pawn InstigatedBy, Vector HitLocation,
    						         out Vector Momentum, class<DamageType> DamageType)
        local int Drain;
    	local vector Reflect;
        local vector HitNormal;
        local float DamageMax;
    	DamageMax = 100.0;
    	if ( DamageType == class'Fell' )
    		DamageMax = 20.0;
        else if( !DamageType.default.bArmorStops || (DamageType == class'DamTypeShieldImpact' && InstigatedBy == Instigator) )
        if ( CheckReflect(HitLocation, HitNormal, 0) )
            Drain = Min( AmmoAmount(1)*2, Damage );
    		Drain = Min(Drain,DamageMax);
    	    Reflect = MirrorVectorByNormal( Normal(Location - HitLocation), Vector(Instigator.Rotation) );
            Damage -= Drain;
            Momentum *= 1.25;
            if ( (Instigator != None) && (Instigator.PlayerReplicationInfo != None) && (Instigator.PlayerReplicationInfo.HasFlag != None) )
    			Drain = Min(AmmoAmount(1), Drain);
    5. A copule of megs (not 100% sure) you should get them anyways cause UCC export/UEd Script interface are both **** for getting all the code (some stuff does not export right, and UEd does not show defaultproperties blocks)

    And it's reaonsably well doctumented. Especially the low level stuff (Actor, Object etc...)


      Well, thanks (x 6, one per answer)
      I know bytecode, it's also used in Java

      I indeed brightened the texture, but it looks absolutely normal when seen as a pickup.
      Here's a screenie
      The shiny parts are not part of the texture, they move according to aim angle.

      Did not know about the UDE, I downloaded it. And I got the 3204 Source, too.

      Edit : Half-solved by reading the source. I specified the normal texture as HighDetailOverlay and now the weapon as no reflection of any kind, which is better than the shiny look anyway
      Looking deeper


        The newest aource should be up there as well (or o you nothave the newest patch?)

        As for your skin, try darkening it, i did not realize the pickups used the same skin, infact I'm sure they don't....


          Well, actually, it was not brigter
          But I managed to handle the AdjustPlayerDamage, thanks


            the shiny texture is caused by

            HighDetailOverlay=Material'UT2004Weapons.WeaponSpe cMap2'
            set in some weapons

            Just set it in MyWeapon.uc to :-



              Originally posted by TOP-Proto
              Just set it in MyWeapon.uc to :-

              Actually, that's what I thought and did, but thanks
              A pitty I don't have the nice-looking Material of the SG, though (same Material, but seems to be rendered in a different way)


                so its fixed now?


                  There's probably a spec mask in the alpha channel of the original texture, and if you lost this channel in the process of exporting/coloring/reimporting that would explain why it's completely shiny rather than being only partially shiny because of the spec mask.


                    Yes, it's somehow fixed. No more shiny look, which was the main problem.
                    I thought of the Alpha Channel, and will try to search in that direction. Will edit if I find a suitable answer, so that others can learn from my mistakes
                    Thanks guys.


                      if you changed the high detail overlay to none, that fixed it.
                      it places a texture OVER your texture (with transparancy) onto your gun, which is supposed to make metal look shinyier etc

                      open up unrealed's texture browser and look at


                      you will see its transparant and has lots of combiners on it.


                        how do you learn uscript, is there a book ou can buy, or a really good tutorial?


                          Originally posted by ellsal
                          how do you learn uscript, is there a book ou can buy, or a really good tutorial?

                          There is no Really good tutorial, but is a good place to start. It helps if you already know a language (c or java being choice)


                            ok which is better to start or which has more uses, java or c
                            and thanks for the link


                              if you want to learn programming you should look into taking a course.

                              I would recommend a nice easy read
                              Idiots Guide to C++

                              you will learn about fundamental elements such as
                              functions, loops, variable types (integers, strings etc)
                              Which are common though most popular programming languages.

                              The reason people choose between Java or C is for the simple reason C is faster (and you want the fastest programming code for game design)

                              Unrealscript is a little unique, it is a C/Java hybrid.

                              It has its code that needs to run as fast as possible in .dll (C classes) and its main low level game code is written in the unrealscript UC files. the unrealscript syntax is part C and part Java. basically Epic took the best from java and from C to try and improve their engines efficiancy.

                              I would also suggest taking education in it, you ALWAYS are learning, and its nice to have someone to ask questions to.