Announcement

Collapse
No announcement yet.

vechicle weapon scaling...

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

    vechicle weapon scaling...

    ok, so scaling a vehicle I just spawned is simple enough, but I'm having difficulty figuring out the right code to scale the weapons on it (like if you spawn a scorpion, the gun that shoots the green web thing out).

    Here's what i've tried, any tips would be great....

    Code:
            if (class<onsvehicle>(VehicleClass)!=none) {
                for (i = 0; i < onsvehicle(newvehicle).DriverWeapons.Length  ; i++) {
                    onsvehicle(newvehicle).DriverWeapons[i].WeaponClass.SetDrawScale(vehiclescale);
    //                 onsvehicle(newvehicle).DriverWeapons[i].WeaponClass;
    //              vehicleweap = onsvehicle(newvehicle).DriverWeapons[i].WeaponClass;
    //              onsweapon(onsvehicle(newvehicle).DriverWeapons[i].WeaponClass).SetDrawScale(vehiclescale);
    //              onsvehicle(newvehicle).DriverWeapons[i].WeaponClass.SetDrawScale3d(drawscale3d);
                }
                for (i = 0; i < onsvehicle(newvehicle).PassengerWeapons.Length  ; i++) {
    //              onsvehicle(newvehicle).PassengerWeapons[i].WeaponClass.SetDrawScale(vehiclescale);
    //              onsvehicle(newvehicle).PassengerWeapons[i].WeaponClass.SetDrawScale3d(drawscale3d);
                }
            }
    currently on compile it says SetDrawScale is not a member of class 'class'.

    #2
    Dude, you set that property in the weapon that you want to scale.

    Something like this:

    class MyClass extends ONSWeapon (or subclass of onsweapon)

    *blah*

    default properties
    {
    Drawscale= 1.00 <- Adjust this, or
    DrawScale3d= (x=1.00,y=1.00,z=1.00) <- or this

    Comment


      #3
      yes, I know how to set it if I were compiling it. What I'm doing is changing the size of the vehicles in-game when I spawn ones with a command I issue. For instance....

      I type: mutate vehicle goliath self 0.5
      and from my code, it currently spawns a:
      goliath tank
      self = person to spawn it next to (just outside collision radius so it doesn't crush me)
      0.5 is the scale to spawn it at (1 beind normal).

      Well, this works fine for things like the toilet car and manta, where there are no additional weapon bones attached. When I spawn something like the scorpion, leviathan, hellbender, etc...those extra weapons appear at normal size, whether i scale the vehicle up or down. With the scorpion, the weapon sticking up that shoots the green web stays the same. When I spawn a scorpion at 0.1 scale (just to make my point) there is a micromachine sized scorpion with a gun attached to the top of it 10 times the size of the actual car because the weapon is still normal size.

      Goal: scale the weapons down WITH the vehicle when I do so.

      Comment


        #4
        I think you should be able to simply iterate through the vehicle's Weapons[] array, as in (for example, off the top of my head):
        Code:
        myVehicle.Weapons[i].SetDrawScale(myDrawScale)
        without any of that typecasting you're doing. If I'm not mistaken, all the weapons on a vehicle are in that array, whether they belong to passengers or the driver. Open up Onslaught.ONSVehicle to see where and how the weapons are stored in the Weapons[] array.

        Comment


          #5
          I guess I didnt understand what you were doing the first time.

          onsvehicle(newvehicle).PassengerWeapons[i].WeaponClass.SetDrawScale3d(drawscale3d);
          It should be:
          onsvehicle(newvehicle).PassengerWeapons[i].Gun.SetDrawScale3d(drawscale3d);

          You dont need the WeaponClass in there, as the PassengerWeapons array already contains them. However, it will return the weapon pawn, so you have to access the 'Gun' which is conviently called the same thing.

          Comment


            #6
            CMan, that line returns:
            Error, Unknown member 'Gun' in struct 'PassengerWeaponStruct'.

            Xyx, thanks.

            onsvehicle(newvehicle).Weapons[i].SetDrawScale3D(drawscale3d);

            works.



            Another quick question, how do you change the collision radius and height for the vehicle? newvehicle.setcollision.... didn't seem to work.

            Comment

            Working...
            X