• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Adding tank feature

otester

Grizzled Veteran
Mar 7, 2006
366
5
For example:

You start looking through binocs, scroll down one, you are in top of turret cupola thing, scroll down one again, you are in the cupola with hatch shut, scroll down again and your looking through the tanks optics.

How can I add a feature so if was to; scroll down one again (while looking through optics)..... it would run a command or execute a script etc. ?

I've tried making a mutator with this:

class IS2A2 extends IS2CannonPawn;

function PostBeginPlay()
{
Super.PostBeginPlay(); // Run the super class function (Mutator.PostBeginPlay).
Log("IS2A2"); // Write our log message
}
defaultproperties
{
FriendlyName="IS2A2 Mutator"
Description="Log 'IS2A2'."
DriverPositions(4)=(ViewLocation=(X=-200,Y=-25,Z=10),ViewFOV=21,PositionMesh=Mesh'allies_is2_anm.IS2_turret_int',DriverTransitionAnim=none,ViewPitchUpLimit=6000,ViewPitchDownLimit=64500,ViewPositiveYawLimit=19000,ViewNegativeYawLimit=-20000,bDrawOverlays=true,bExposed=false)
}

The IS2CannonPawn.uc is in the same folder as the IS2A2.uc

For some reason, it don't work? Can anyone figure out why? I followed the wiki BeyondUnreal thing on changing vehicle settings, but its not working :(
 
Last edited:
The current code is setup to (obviously) change driver positions when you scroll the mouse.. much like next/prev weapon.

What you would have to do is override the NextWeapon and Previous Weapon functions found in ROVehicleWeaponPawn.

I recommend everyone setting up for coding get UnCodeX and generate the UnCodeX docs for the provided Red Orchestra source files. It makes getting around the RO codebase super-easy, and helps you figure out how everything is peiced together.
 
Upvote 0
I currently have the folder "IS2A2" with "IS2A2.uc" and "IS2CannonPawn.uc".

Could I include an edited version of "ROVehicleWeaponPawn.uc" inside the "IS2A2" folder as well? Will all three run when I run The mod or just the "IS2A2.uc" file?

I would just like to clarify this.
 
Upvote 0
I'm going to have to agree that there are some fundementals of OOP (Object Orienteed Programming) that you should understand here that will help you out.

Again, UnCodeX documentation will help you peice all the relationships together.

For example a vehicle inheirtence tree is like this:
Code:
Core.Object
|   
+-- Engine.Actor
   |   
   +-- Engine.Pawn
      |   
      +-- Engine.Vehicle
         |   
         +-- Engine.SVehicle
            |   
            +-- ROEngine.ROVehicle
               |   
               +-- ROEngine.ROWheeledVehicle
                  |   
                  +-- ROEngine.ROTreadCraft
                     |   
                     +-- ROVehicles.KV1Tank

So, the KV1Tank class inheirets the methods and properties of ROTreadCraft.. which in turn inheirets the methods and properties of ROWheeledVehicle.. to ROVehicle.. to SVehicle.. etc.. up the tree.

When you 'override' a method, you are saying:

ClassX already knows how to do 'PrevWeapon'.. because it got that from ROVehicle.. but I want you to do it MY way.
What you do it just add the replacement code for the method you want in your class.

So in your IS2A2 class, you would define a method for PrevWeapon, and re-write that method to do what you want. which would be something like:
"if the current postion is 0 and you want to go lower, instead do this..."..etc.


Then.. once you got that..

you can test it in game by summoning it via the console.

To get it on game servers, you would either have to create a new map with your specific tank factory class in it.. or write a mutator that changes out regular IS2Factory's with your IS2A2Factory..
 
Upvote 0