New NitroVehicles

Discuss the Race / Assault server here.
Post Reply
User avatar
Azarael
UT2004 Administrator
Posts: 5365
Joined: Thu 11 Feb , 2010 10:52 pm

Re: New NitroVehicles

Post by Azarael » Thu 30 Dec , 2010 6:07 pm

Sure is rage in here.

iZumo
Disappeared Administrator
Posts: 4196
Joined: Fri 19 Mar , 2010 1:21 am
Location: Earth
Contact:

Re: New NitroVehicles

Post by iZumo » Sat 01 Jan , 2011 7:24 pm

Aza, can you add this to ini when you have the chance?

Code: Select all

VehicleReplacementConfig=(OldClassName="ScorpionType4.ScorpionT4Plasma",NewClassName="NitroVehicles2.NitroRVPlasma")
To replace plasma scorps on IndustrialRace and Warmachines.

User avatar
KimiRäikkönen
Member
Posts: 287
Joined: Sat 13 Feb , 2010 12:48 am
Location: the hood
Contact:

Re: New NitroVehicles

Post by KimiRäikkönen » Sun 02 Jan , 2011 6:28 pm

[/begin/]KimiRäikkönenConfig("Thug"=True."60-0np"=Confirmed)[/end/]

┌∩┐(◣_◢)┌∩┐

iZumo
Disappeared Administrator
Posts: 4196
Joined: Fri 19 Mar , 2010 1:21 am
Location: Earth
Contact:

Re: New NitroVehicles

Post by iZumo » Sun 02 Jan , 2011 7:00 pm

No worries, there is one more unarmed scorpion with special horn.

Image

User avatar
Azarael
UT2004 Administrator
Posts: 5365
Joined: Thu 11 Feb , 2010 10:52 pm

Re: New NitroVehicles

Post by Azarael » Sun 02 Jan , 2011 7:09 pm

OH SHIT

iZumo
Disappeared Administrator
Posts: 4196
Joined: Fri 19 Mar , 2010 1:21 am
Location: Earth
Contact:

Re: New NitroVehicles

Post by iZumo » Sun 02 Jan , 2011 7:46 pm

It's not ingame (yet) coz I didn't want to add map dependency ...

Anyway - the v3 revsion is ready to submit. So is it only ShockScorpRace (dependency) and IndustrialRace (boost) that needs updating?

User avatar
Azarael
UT2004 Administrator
Posts: 5365
Joined: Thu 11 Feb , 2010 10:52 pm

Re: New NitroVehicles

Post by Azarael » Sun 02 Jan , 2011 7:59 pm

I assume so?

iZumo
Disappeared Administrator
Posts: 4196
Joined: Fri 19 Mar , 2010 1:21 am
Location: Earth
Contact:

Re: New NitroVehicles

Post by iZumo » Mon 03 Jan , 2011 3:45 am

Revision 3

- ingame menu to bind extra keys
- interaction now sends console command rather than direct calling of the function
- nitro overall performace increased by 10%
- there is special boost bonus when your speed is low (this isn't very realistic, aimed to bring back several tricks with vehicles and reduce tedious parts on slopes)
- shield shader is team color based
- fixed a dependency on TWBv5 in textures
- more fixes to effects (now properly clientside)
- stat command nvwheeldebug should work for passenger and spectator too
- two easter-egg unarmed scorps (special horns and names) :p

Link: http://upload-it.ch/upload/NewNitroVehicles3.zip
Maps: http://upload-it.ch/upload/RACE-ShockSc ... e[nv3].rar and http://upload-it.ch/upload/RACE-Industr ... tFix3].rar

Oh and when updating ini, don't forget on the SPMA and PlasmaScorp :p

iZumo
Disappeared Administrator
Posts: 4196
Joined: Fri 19 Mar , 2010 1:21 am
Location: Earth
Contact:

Re: New NitroVehicles

Post by iZumo » Mon 03 Jan , 2011 2:20 pm

The way how the ingame menu thing works:

1) Interaction adds the tab via tick (._.)
2) Then in MidGamePanel you draw the menu; all items are declared automated and you do it all in default properties
3) KeyBindEdit (for Unwheel better copy & paste it, don't create dependency) uses two delegates OnInitKey (when loading tab) and OnKeyChange (when changed key). So just assign them and add there the load / save code.
4) That's it. Only notice that the interactions references the keys via class.default. (so it's updated immediatelly)

Posting the code because you can't view it in editor well.

Interaction:

Code: Select all

//=============================================================================
// NitroVehiclesInteractions.
//=============================================================================
class NitroVehiclesInteractions extends Interaction
config(NitroVehicles);

var config EInputKey NitroKey;
var config EInputKey RepairKey;
var config EInputKey ShieldKey;
var config bool bNitroKeyEnabled, bRepairKeyEnabled, bShieldKeyEnabled;
var bool bShowWheeledDebug;

var localized string MenuName;
var localized string MenuHelp;

// Needed so that we don't call ModifyMenu again even when when it already added the new tab.
var private editconst bool bMenuModified;

final private function ModifyMenu()
{
	local UT2K4PlayerLoginMenu Menu;
	local GUITabPanel Panel;
 
	// Try get the menu, will return none if the menu is not open!.
	Menu = UT2K4PlayerLoginMenu(GUIController(ViewportOwner.Actor.Player.GUIController).FindPersistentMenuByName( UnrealPlayer(ViewportOwner.Actor).LoginMenuClass ));
	if( Menu != none )
	{
		// You can use the panel reference to do the modifications to the tab etc.
		Panel = Menu.c_Main.AddTab(MenuName, string( class'NitroVehiclesMenuPanel' ),, MenuHelp);
		bMenuModified = true;
 
		// Uncomment if tick is not needed for anything else than ModifyMenu.
		Disable('Tick');
		bRequiresTick = false;
 	}
}
 
function Tick( float DeltaTime )
{
	if( !bMenuModified )
		ModifyMenu();
}

function bool KeyEvent(EInputKey Key, EInputAction Action, FLOAT Delta )
{
	if (ViewPortOwner.Actor.Pawn == None)
		return Super.KeyEvent(Key,Action,Delta);
		
	//Check for ONS vehicle -> coz this is the superclass of them
	//If it exists then send console commands
	if (ViewPortOwner.Actor.Pawn.IsA('ONSVehicle'))
	{
		if ((Action == IST_Press) && bNitroKeyEnabled && (Key == class'NitroVehiclesInteractions'.default.NitroKey))
			ConsoleCommand("NitroOn");
		else if ((Action == IST_Release) && bNitroKeyEnabled && (Key == class'NitroVehiclesInteractions'.default.NitroKey))
			ConsoleCommand("NitroOff");
		else if ((Action == IST_Press) && bRepairKeyEnabled && (Key == class'NitroVehiclesInteractions'.default.RepairKey))
			ConsoleCommand("Repair");
		else if ((Action == IST_Press) && bShieldKeyEnabled && (Key == class'NitroVehiclesInteractions'.default.ShieldKey))
			ConsoleCommand("Shield");
	}
		
	return Super.KeyEvent(Key,Action,Delta);
}

exec function NVWheelDebug()
{
	//don't bother if someone wishes to use it on server
	//doesn't show anything "forbidden"
	//instead if something fails, it would be good if this is noted
	bShowWheeledDebug = !bShowWheeledDebug;
}

exec function NVSaveConfig()
{
	StaticSaveConfig();
}

function PostRender( canvas Canvas )
{	
	local float XL, YL, PosY;
	local ONSWheeledCraft Veh;
	local InterpCurve BoostForceMagnitude;
	local InterpCurve SlopeForceModifier;
	local bool CountBoostForce;
	local float BoostForce, SlopeModifier;
	
	if (!bShowWheeledDebug || ViewPortOwner.Actor.ViewTarget == None)
		return;
		
	if (ViewPortOwner.Actor.ViewTarget.IsA('ONSWheeledCraft'))
		Veh = ONSWheeledCraft(ViewPortOwner.Actor.Pawn);
	else if (ViewPortOwner.Actor.ViewTarget.IsA('ONSWeaponPawn') && ONSWeaponPawn(ViewPortOwner.Actor.ViewTarget).VehicleBase != None && ONSWeaponPawn(ViewPortOwner.Actor.ViewTarget).VehicleBase.IsA('ONSWheeledCraft'))
		Veh = ONSWheeledCraft(ONSWeaponPawn(ViewPortOwner.Actor.ViewTarget).VehicleBase);
	
	if (Veh != None)
	{
		Canvas.Font = ViewPortOwner.Actor.MyHud.GetConsoleFont(Canvas);

		Canvas.SetDrawColor(0, 255, 0);
		Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
		Canvas.TextSize("Nitro Vehicles v3 Debug Info", XL, YL);	
		Canvas.DrawText("Nitro Vehicles v3 Debug Info");
		PosY += YL + 5;

		//plot some properties		
		Canvas.SetDrawColor(255, 255, 255);
		Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
		Canvas.TextSize("EngineRPM: ", XL, YL);		
		Canvas.DrawText("EngineRPM: ");
		Canvas.SetDrawColor(255, 255, 0);
		Canvas.SetPos(5 + XL, 0.55 * Canvas.ClipY + PosY);
		Canvas.DrawText(Veh.EngineRPM);
		PosY += YL + 5;
		
		Canvas.SetDrawColor(255, 255, 255);
		Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
		Canvas.TextSize("CarMPH: ", XL, YL);		
		Canvas.DrawText("CarMPH: ");
		Canvas.SetDrawColor(255, 255, 0);
		Canvas.SetPos(5 + XL, 0.55 * Canvas.ClipY + PosY);
		Canvas.DrawText(Veh.CarMPH);
		PosY += YL + 5;
		
		Canvas.SetDrawColor(255, 255, 255);
		Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
		Canvas.TextSize("Throttle: ", XL, YL);		
		Canvas.DrawText("Throttle: ");
		Canvas.SetDrawColor(255, 255, 0);
		Canvas.SetPos(5 + XL, 0.55 * Canvas.ClipY + PosY);
		Canvas.DrawText(Veh.Throttle);
		PosY += YL + 5;
		
		Canvas.SetDrawColor(255, 255, 255);
		Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
		Canvas.TextSize("ForwardVel: ", XL, YL);		
		Canvas.DrawText("ForwardVel: ");
		Canvas.SetDrawColor(255, 255, 0);
		Canvas.SetPos(5 + XL, 0.55 * Canvas.ClipY + PosY);
		Canvas.DrawText(Veh.ForwardVel);
		PosY += YL + 5;
				
		Canvas.SetDrawColor(255, 255, 255);
		Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
		Canvas.TextSize("Gear: ", XL, YL);		
		Canvas.DrawText("Gear: ");
		Canvas.SetDrawColor(255, 255, 0);
		Canvas.SetPos(5 + XL, 0.55 * Canvas.ClipY + PosY);
		Canvas.DrawText(Veh.Gear);
		PosY += YL + 5;	
		
		Canvas.SetDrawColor(255, 255, 255);
		Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
		Canvas.TextSize("Pitch: ", XL, YL);		
		Canvas.DrawText("Pitch: ");
		Canvas.SetDrawColor(255, 255, 0);
		Canvas.SetPos(5 + XL, 0.55 * Canvas.ClipY + PosY);
		Canvas.DrawText(Veh.Rotation.Pitch);
		PosY += YL + 5;
		
		CountBoostForce = false;
		
		if (Veh.IsA('NitroPRV'))
		{
			BoostForceMagnitude = NitroPRV(Veh).BoostForceMagnitude;
			SlopeForceModifier = NitroPRV(Veh).SlopeForceModifier;
			CountBoostForce = true;
		}
		else if (Veh.IsA('NitroRV'))
		{
			BoostForceMagnitude = NitroRV(Veh).BoostForceMagnitude;
			SlopeForceModifier = NitroRV(Veh).SlopeForceModifier;
			CountBoostForce = true;
		}
		else if (Veh.IsA('NitroSPMA'))
		{
			BoostForceMagnitude = NitroSPMA(Veh).BoostForceMagnitude;
			SlopeForceModifier = NitroSPMA(Veh).SlopeForceModifier;
			CountBoostForce = true;
		}
		
		if (CountBoostForce)
		{
			if (Veh.Gear == 0)
				BoostForce = InterpCurveEval(BoostForceMagnitude, 0);
			else
				BoostForce = InterpCurveEval(BoostForceMagnitude, Veh.CarMPH);
			
			if (Veh.Rotation.Pitch < 0)
				SlopeModifier = InterpCurveEval(SlopeForceModifier, 0);
			else
				SlopeModifier = InterpCurveEval(SlopeForceModifier, Veh.Rotation.Pitch);
			
			//not below zero
			BoostForce = FMax(BoostForce, 0);
			SlopeModifier = FMax(SlopeModifier, 0);
			
			Canvas.SetDrawColor(255, 255, 255);
			Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
			Canvas.TextSize("BoostForce: ", XL, YL);		
			Canvas.DrawText("BoostForce: ");
			Canvas.SetDrawColor(255, 255, 0);
			Canvas.SetPos(5 + XL, 0.55 * Canvas.ClipY + PosY);
			Canvas.DrawText(BoostForce);
			PosY += YL + 5;
		
			Canvas.SetDrawColor(255, 255, 255);
			Canvas.SetPos(5, 0.55 * Canvas.ClipY + PosY);
			Canvas.TextSize("SlopeModifier: ", XL, YL);		
			Canvas.DrawText("SlopeModifier: ");
			Canvas.SetDrawColor(255, 255, 0);
			Canvas.SetPos(5 + XL, 0.55 * Canvas.ClipY + PosY);
			Canvas.DrawText(SlopeModifier);
			PosY += YL + 5;
		}
	}
}

//remove myself if level changed
event NotifyLevelChange()
{
	Master.RemoveInteraction(self);
}

defaultproperties
{
	bNitroKeyEnabled=true
	bRepairKeyEnabled=true
	bShieldKeyEnabled=true
	NitroKey=IK_Shift
	RepairKey=IK_J
	ShieldKey=IK_K
	bVisible=true
	bRequiresTick=true
	
	MenuName="Nitro Vehicles"
	MenuHelp="Nitro Vehicles Configuration"
}
MidGamePanel:

Code: Select all

class NitroVehiclesMenuPanel extends MidGamePanel
	dependsOn(Interactions);

var automated KeyBindEdit e_NitroEdit;
var automated KeyBindEdit e_RepairEdit;
var automated KeyBindEdit e_ShieldEdit;

var automated GUILabel l_NitroLabel;
var automated GUILabel l_RepairLabel;
var automated GUILabel l_ShieldLabel;

var automated GUIEditBox b_Caption;

var localized string NitroText;
var localized string RepairText;
var localized string ShieldText;
var localized string CaptionText;

function InitComponent( GUIController InController, GUIComponent InOwner )
{
	b_Caption.Caption = CaptionText;
	l_NitroLabel.Caption = NitroText;
	l_RepairLabel.Caption = RepairText;
	l_ShieldLabel.Caption = ShieldText;
	Super.InitComponent(InController, InOwner);
}

function NitroKeyInit(out byte keyCode)
{
	keyCode = class'NitroVehiclesInteractions'.default.NitroKey;
}

function RepairKeyInit(out byte keyCode)
{
	keyCode = class'NitroVehiclesInteractions'.default.RepairKey;
}

function ShieldKeyInit(out byte keyCode)
{
	keyCode = class'NitroVehiclesInteractions'.default.ShieldKey;
}

function NitroKeyChanged(byte keyCode)
{
	class'NitroVehiclesInteractions'.default.NitroKey = EInputKey(keyCode);
	class'NitroVehiclesInteractions'.static.StaticSaveConfig();
}

function RepairKeyChanged(byte keyCode)
{
	class'NitroVehiclesInteractions'.default.RepairKey = EInputKey(keyCode);
	class'NitroVehiclesInteractions'.static.StaticSaveConfig();
}

function ShieldKeyChanged(byte keyCode)
{
	class'NitroVehiclesInteractions'.default.ShieldKey = EInputKey(keyCode);
	class'NitroVehiclesInteractions'.static.StaticSaveConfig();
}

defaultProperties
{	
	CaptionText="Key Assignments"
	NitroText="Nitro"
	RepairText="Repair"
	ShieldText="Shield"
	
	Begin Object Class=GUIEditBox Name=MyBorder
		WinWidth				=	0.980000
		WinHeight				=	0.040000
		WinLeft					=	0.010000
		WinTop					=	0.025000
		bReadOnly				= true
		bTabStop				=	false
		bNeverFocus			= true
	End Object
	b_Caption=MyBorder
	
	
	
	Begin Object Class=GUILabel Name=NitroLabel
		TextColor				= (R=255,G=255,B=255,A=255)
		WinWidth				=	0.150000
		WinHeight				=	0.040000
		WinLeft					=	0.345000
		WinTop					=	0.090000
		bBoundToParent 	= False
		bScaleToParent 	= False
	End Object
	l_NitroLabel=NitroLabel
	
	Begin Object Class=KeyBindEdit Name=NitroEdit
		WinWidth				=	0.150000
		WinHeight				=	0.040000
		WinLeft					=	0.550000
		WinTop					=	0.090000
		OnInitKey				= NitroKeyInit
		OnKeyChanged		= NitroKeyChanged
		bBoundToParent 	= False
		bScaleToParent 	= False
	End Object
	e_NitroEdit=NitroEdit
	
	
	
	Begin Object Class=GUILabel Name=RepairLabel
		TextColor				= (R=255,G=255,B=255,A=255)
		WinWidth				=	0.150000
		WinHeight				=	0.040000
		WinLeft					=	0.345000
		WinTop					=	0.155000
		bBoundToParent 	= False
		bScaleToParent 	= False
	End Object
	l_RepairLabel=RepairLabel
	
	Begin Object Class=KeyBindEdit Name=RepairEdit
		WinWidth				=	0.150000
		WinHeight				=	0.040000
		WinLeft					=	0.550000
		WinTop					=	0.155000
		OnInitKey				= RepairKeyInit
		OnKeyChanged		= RepairKeyChanged
		bBoundToParent 	= False
		bScaleToParent 	= False
	End Object
	e_RepairEdit=RepairEdit
	
	
	
	Begin Object Class=GUILabel Name=ShieldLabel
		TextColor				= (R=255,G=255,B=255,A=255)
		WinWidth				=	0.150000
		WinHeight				=	0.040000
		WinLeft					=	0.345000
		WinTop					=	0.220000
		bBoundToParent 	= False
		bScaleToParent 	= False
	End Object
	l_ShieldLabel=ShieldLabel
	
	Begin Object Class=KeyBindEdit Name=ShieldEdit
		WinWidth				=	0.150000
		WinHeight				=	0.040000
		WinLeft					=	0.550000
		WinTop					=	0.220000
		OnInitKey				= ShieldKeyInit
		OnKeyChanged		= ShieldKeyChanged
		bBoundToParent 	= False
		bScaleToParent 	= False
	End Object
	e_ShieldEdit=ShieldEdit
}
KeyBindEdit:

Code: Select all

class KeyBindEdit extends GUIEditBox
	dependsOn(Interactions);

var byte KeyCode;
var string KeyStr;
var bool bCapturing;

Delegate OnInitKey(out byte Key) { Key = 0; }
Delegate OnKeyChanged(byte Key) {}

function InitComponent( GUIController InController, GUIComponent InOwner )
{
	OnInitKey(KeyCode);
	KeyStr = class'Interactions'.static.GetFriendlyName(EInputKey(KeyCode));
	
	if (InStr(KeyStr, "Unknown") != -1 || KeyStr == "Escape")
		KeyStr = "None";
		
	Caption = KeyStr;
	bReadOnly = true;
	Super.InitComponent(InController, InOwner);	
}

function MenuStateChange(eMenuState Newstate)
{
	Super.MenuStateChange(Newstate);
	
	if(Newstate == MSAT_Blurry)
	{
		bCapturing = false;
		Caption = KeyStr;
	}
}

function bool MouseClick(GUIComponent Sender)
{
	bCapturing = true;
	Caption = "";
	return true;
}

function bool InternalOnKeyType(out byte Key, optional string Unicode)
{	
	return false;
}

function bool InternalOnKeyEvent(out byte Key, out byte State, float delta)
{
	local string keyName;
	
	if (State != 1 || !bCapturing)
		return false;
	
	//get the keyName from the interaction
	keyName = class'Interactions'.static.GetFriendlyName(EInputKey(Key));
	
	if (InStr(keyName, "Unknown") != -1 || keyName == "Escape")
	{
		KeyCode = 0;
		KeyStr = "None";
		
	}
	else
	{
		KeyCode = Key;
		KeyStr = keyName;
	}
	
	Caption = KeyStr;	
	OnKeyChanged(KeyCode);
	bCapturing = false;
	return true;
}

defaultproperties
{
	bCaptureMouse=True
	OnClick=MouseClick;
}

TheDejaVuPl@yer

Re: New NitroVehicles

Post by TheDejaVuPl@yer » Mon 03 Jan , 2011 5:59 pm

ADMIN: please enable forum spoilers.

Post Reply

Who is online

Users browsing this forum: No registered users and 39 guests