Tegleg Records

Tegleg Records
Tegleg Records

Thursday 24 March 2011

UDK Real 3D Menu Without Scaleform

Heres this then.
A menu made from in game 3D models.


The code below is for 2 types of 'button'.
1. TegButton_Actor.uc - this one has an OK button
2. TegButton_Ok - this is the ok button. can be used if you dont need an ok.

just change the StaticMesh in DefaultProperties to use your own.

Vid Here

class TegButton_Actor extends Actor
    placeable;

var() const editconst LightEnvironmentComponent LightEnvironment;
var() string Command;

auto state MenuActive
{
    event TakeDamage(int DamageAmount, Controller EventInstigator, vector HitLocation, vector Momentum, class DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    {
    local TegButton_Ok OkButon;
    local vector L;

 super.TakeDamage(DamageAmount,EventInstigator, HitLocation,Momentum,DamageType,HitInfo,DamageCauser);

    L=Location;
    L.Z=Location.Z + 100;

    //when taking damage, spawn an ok button and give it a console command
    OkButon = Spawn(class'TegButton_Ok',,,L, Rotation);
 OkButon.Command = Command;
    }

}

DefaultProperties
{
    Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
 bEnabled=TRUE
    End Object
    LightEnvironment=MyLightEnvironment
    Components.Add(MyLightEnvironment)

    begin object class=StaticMeshComponent Name=BaseMesh

        // change this staticmesh to your own 'button' model
 StaticMesh=StaticMesh'EngineMeshes.Cube'

 //LightEnvironment=MyLightEnvironment
    end object
    Components.Add(BaseMesh)

    CollisionComponent=BaseMesh
    bCollideActors=true
    bBlockActors=true

    //default console command
    Command="quit"

}

class TegButton_Ok extends Actor
    placeable;

var() const editconst LightEnvironmentComponent LightEnvironment;
var() string Command;


auto state MenuActive
{
    event TakeDamage(int DamageAmount, Controller EventInstigator, vector HitLocation, vector Momentum, class DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
    {
    local PlayerController PC;

 super.TakeDamage(DamageAmount,EventInstigator, HitLocation,Momentum,DamageType,HitInfo,DamageCauser);

    //on TakeDamage tell all the players the console command
 foreach WorldInfo.AllControllers(class'PlayerController', PC)
  {
   PC.ConsoleCommand(Command);
  }
    }

}

DefaultProperties
{
    Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
 bEnabled=TRUE
    End Object
    LightEnvironment=MyLightEnvironment
    Components.Add(MyLightEnvironment)

    begin object class=StaticMeshComponent Name=BaseMesh
 StaticMesh=StaticMesh'EngineMeshes.Cube'
 //LightEnvironment=MyLightEnvironment
    end object
    Components.Add(BaseMesh)

    CollisionComponent=BaseMesh
    bCollideActors=true
    bBlockActors=true

}
based on Mougli's SandboxSpinningBox

UDK Mobile Plug & Play Car

Name: VHm_Escort
Type: Package and scripts
Category: Vehicles
UDK version: March. 2011 (Mobile) and newer
Author: Tegleg Records
Many thanks to: moot
Model comes from Google Warehouse

Download Here

UDK Plug & Play Car with Weapon

heres a big vehicle for you to play with. For NOVEMBER UDK and newer.



contains Original Version and LookSteer Version
Download Here

it has:
* rotating turret that fires the manta weapon.
* 6 camera modes, with rear view function. Static cam when first enter vehicle.
* nicely ballanced with slippery tyres for drifting
* its fast

comes with the 3ds max model file so you can make your own vehicle. the model is a terrible 'placeholder', im no modeler :s
open it up in max, delete the mesh, add your own, skin the bones. (look for geodav tutorials if you dont know what im talking about)

HOW TO INSTALL:

place the files from the zip in your udk instalation folder.
the zip is arranged in folders to make it easy for you.

Development/Src/UTGame/Classes - Script Files.
Development/Src/UTGameContant/Classes - More Script Files. (wont work for udk versions older than august)

UDKGame/Content/Vehicles - the vehicle package (wont work for udk versions older than november)

Important:
add these lines to DefaultInput.ini for the camera control.
add to the bottom of ; Primary default bindings section
UDKGame/Config/DefaultInput.ini

.Bindings=(Name="R",Command="GBA_LookBack | OnRelease GBA_NotLookBack")
.Bindings=(Name="V",Command="GBA_Camchange")

Dynamicaly changing the Player Pawn

How to Dynamicaly change the Player Pawn.
Put this in your Player Controller. The example here is using an 'exec' function so it can be triggered from a button press or console command.


exec function FPress()
{
//declare the variables
local pawn p;
local vector l;
local rotator r; 

//set the variables 
p = Pawn;
l = Pawn.Location;
r = Pawn.Rotation; 

// get rid of the old pawn
UnPossess();
p.Destroy(); 

//spawn a new pawn and possess it
p = Spawn(class'SomePawnClass', , ,l,r);

//use false if you spawned a character and true for a vehicle
Possess(p, false);
}

UDK Easy Save System

How to save a variable in UDK unreal script.

class Something extends SomethingElse
config(SomeIni); //this points to an ini file where stuff is saved, in this case UDKSomeIni.ini

var config int SomeVar; // putting config allows you to save the variable

//your function where you set and save the variable
function SomeFunction()
{
SomeVar = 20; //give it a value

//SaveConfig() will save whatever variables have config
// it will create UDKSomeIni.ini (if it doesnt exist) and save the variable
SaveConfig();
}