UE3:UT GR Info (UT3): Difference between revisions
m →Enums |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 13: | Line 13: | ||
}} | }} | ||
==Enums== | ==Enums== | ||
enum EnemyType | enum EnemyType<br> | ||
'''ET_Infantry,'''<br> | '''ET_Infantry,'''<br> | ||
'''ET_Hero,'''<br> | '''ET_Hero,'''<br> | ||
'''ET_Vehicle,'''<br> | '''ET_Vehicle,'''<br> | ||
'''ET_Rook,''' | '''ET_Rook,'''<br> | ||
'''ET_Knight,''' | '''ET_Knight,'''<br> | ||
'''ET_Bishop,''' | '''ET_Bishop,'''<br> | ||
'''ET_Turret'''<br> | '''ET_Turret'''<br> | ||
Line 39: | Line 39: | ||
==Functions== | ==Functions== | ||
===SetFirstGR=== | ====SetFirstGR==== | ||
function SetFirstGR() | function SetFirstGR() | ||
===OverridePickupQuery=== | ====OverridePickupQuery==== | ||
function [[bool]] OverridePickupQuery([[UE3:Pawn_(UT3)|Pawn]] Other, class<Inventory> ItemClass, [[UE3:Actor_(UT3)|Actor]] Pickup, out [[byte]] bAllowPickup) | function [[bool]] OverridePickupQuery([[UE3:Pawn_(UT3)|Pawn]] Other, class<Inventory> ItemClass, [[UE3:Actor_(UT3)|Actor]] Pickup, out [[byte]] bAllowPickup) | ||
===NetDamage=== | ====NetDamage==== | ||
function NetDamage([[int]] OriginalDamage, out [[int]] Damage, [[UE3:Pawn_(UT3)|Pawn]] injured, [[UE3:Controller_(UT3)|Controller]] instigatedBy, [[UE3: | function NetDamage([[int]] OriginalDamage, out [[int]] Damage, [[UE3:Pawn_(UT3)|Pawn]] injured, [[UE3:Controller_(UT3)|Controller]] instigatedBy, [[UE3:Object_structs_(UT3)#Vector|vector]] HitLocation, out [[UE3:Object_structs_(UT3)#Vector|vector]] Momentum, class<DamageType> DamageType) | ||
==Script== | ==Script== | ||
Line 51: | Line 51: | ||
// Class: UT_GR_Info | // Class: UT_GR_Info | ||
// Creation date: 12/12/2008 19:35 | // Creation date: 12/12/2008 19:35 | ||
// Last updated: | // Last updated: 11/04/2010 13:10 | ||
// Contributors: 00zX | // Contributors: 00zX | ||
//--------------------------------------------------- | //--------------------------------------------------- | ||
Line 61: | Line 61: | ||
`include(MOD.uci) | `include(MOD.uci) | ||
enum | enum PawnType | ||
{ | { | ||
ET_Infantry, | ET_Infantry, | ||
Line 75: | Line 75: | ||
{ | { | ||
var Pawn Pawn; | var Pawn Pawn; | ||
var | var PawnType Type; | ||
}; | }; | ||
Line 85: | Line 85: | ||
var int ModifiedDamage; //ConversionRatio>?? | var int ModifiedDamage; //ConversionRatio>?? | ||
var class<DamageType> DamageType; | var class<DamageType> DamageType; | ||
structdefaultproperties | |||
{ | |||
bIsBot=false | |||
bIsFriendly=false | |||
Damage=0 | |||
ModifiedDamage=0 | |||
DamageType=class'DmgType_Suicided' | |||
} | |||
}; | }; | ||
var | var UT_MDB_GameExp GameExp; | ||
var private UT_MDB_GameRules | var private UT_MDB_GameRules BaseGameRules; | ||
/* | /** wtf why am I grey? */ | ||
function SetBaseGameRules() | |||
{ | { | ||
if(GameExp == None) | |||
return; | |||
`logd("GameRules Info Controller Initalized!",,'GameRulesInfo'); | |||
BaseGameRules = GameExp.GetBaseGameRules(); | |||
`logd("BaseGameRules:"$BaseGameRules,,'GameRulesInfo'); | |||
} | } | ||
static function PawnType GetPawnType(Pawn Pawn) | |||
function | |||
{ | { | ||
if( | local PawnType PType; | ||
if(ClassIsChildOf(Pawn.class,class'UTPawn')) | |||
{ | |||
//Added Rook 2.0 | |||
if(Pawn.IsA('UTHeroPawn')) | |||
{ | |||
if(UTHeroPawn(Pawn).bIsHero && !UTHeroPawn(Pawn).bIsSuperHero) | |||
PType = ET_Hero; | |||
else if (!UTHeroPawn(Pawn).bIsHero && UTHeroPawn(Pawn).bIsSuperHero) | |||
PType = ET_Rook; | |||
} | |||
else | |||
PType = ET_Infantry; | |||
} | |||
if( | //isA UTVehicle | ||
else if(ClassIsChildOf(Pawn.class, class'UTVehicle')) | |||
{ | |||
if(ClassIsChildOf(Pawn.class, class'UTVehicle_TrackTurretBase')) | |||
PType = ET_Turret; | |||
else | |||
PType = ET_Vehicle; | |||
} | |||
return PType; | |||
} | |||
function bool HandleRestartGame() | |||
{ | |||
if((NextGameRules != None) && NextGameRules.HandleRestartGame()) | |||
return true; | |||
return false; | |||
} | } | ||
function bool | function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason) | ||
{ | { | ||
if(NextGameRules != None) | |||
return NextGameRules.CheckEndGame(Winner,Reason); | |||
return true; | |||
} | |||
if | function bool OverridePickupQuery(Pawn Other, class<Inventory> ItemClass, Actor Pickup, out byte bAllowPickup) | ||
{ | |||
if(GameExp == None || BaseGameRules == None) | |||
return false; | return false; | ||
if(Pickup != None && UTPawn(Other) != None) | if(Pickup != None && UTPawn(Other) != None) | ||
if(( | if((BaseGameRules != None) && BaseGameRules.PickupQuery(UTPawn(Other), ItemClass, Pickup)) | ||
return true; | return true; | ||
return false; | return false; | ||
} | |||
function ScoreObjective(PlayerReplicationInfo Scorer, Int Score) | |||
{ | |||
/* local UT_MDB_EventNotifier.NotifyMode HandleNotify; | |||
local int idx; | |||
HandleNotify = (EventName = ET_OnExit, NotifyName = NT_Vehicle); | |||
for(GR = BaseGameRules; GR != None; GR = GetNextGameRules(GR)) | |||
{ | |||
idx = GR.EventNotifier.Notifies.find(HandleNotify); | |||
if(idx != Index_None) | |||
GR.ScoreObjective(Scorer,Score); | |||
}*/ | |||
} | |||
function ScoreKill(Controller Killer, Controller Killed) | |||
{ | |||
/* local UT_MDB_EventNotifier.NotifyMode HandleNotify; | |||
local int idx; | |||
HandleNotify = (EventName = ET_OnExit, NotifyName = NT_Vehicle); | |||
for(GR = BaseGameRules; GR != None; GR = GetNextGameRules(GR)) | |||
{ | |||
idx = GR.EventNotifier.Notifies.find(HandleNotify); | |||
if(idx != Index_None) | |||
GR.ScoreKill(Killer,Killed); | |||
}*/ | |||
} | } | ||
Line 135: | Line 199: | ||
function NetDamage(int OriginalDamage, out int Damage, pawn injured, Controller instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType) | function NetDamage(int OriginalDamage, out int Damage, pawn injured, Controller instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType) | ||
{ | { | ||
local EnemyInfo Enemy | local EnemyInfo Enemy; | ||
if(GameExp == None) | if(GameExp == None || BaseGameRules == None) | ||
return; | return; | ||
if(!WorldInfo.Game.IsInState('MatchInProgress') || (injured == None && instigatedBy == None)) | |||
if(!WorldInfo.Game.IsInState('MatchInProgress') || | |||
{ | { | ||
Damage = 0; | Damage = 0; | ||
return; | return; | ||
} | } | ||
if( | //GameInfo.ReduceDamage // then check if carrying items that can reduce damage | ||
// if((damage > 0) && (injured.InvManager != None)) | |||
// injured.InvManager.ModifyDamage(Damage, instigatedBy, HitLocation, Momentum, DamageType); | |||
if(instigatedBy != None && instigatedBy.Pawn != None) | if(instigatedBy != None && instigatedBy.Pawn != None) | ||
{ | { | ||
Enemy.Pawn = InstigatedBy.Pawn; | Enemy.Pawn = InstigatedBy.Pawn; | ||
Enemy.Damage = OriginalDamage; | Enemy.Damage = OriginalDamage; | ||
Enemy.Type = GetPawnType(Enemy.Pawn); | |||
/* if(ClassIsChildOf(Enemy.Pawn.class,class'UTPawn')) | |||
{ | { | ||
//Added Rook 2.0 | //Added Rook 2.0 | ||
if(Enemy.Pawn.IsA('UTHeroPawn')) | if(Enemy.Pawn.IsA('UTHeroPawn')) | ||
{ | { | ||
if(UTHeroPawn(InstigatedBy.Pawn).bIsHero && !UTHeroPawn(InstigatedBy.Pawn).bIsSuperHero) | if(UTHeroPawn(InstigatedBy.Pawn).bIsHero && !UTHeroPawn(InstigatedBy.Pawn).bIsSuperHero) | ||
Enemy.Type=ET_Hero | Enemy.Type = ET_Hero; | ||
else if (!UTHeroPawn(InstigatedBy.Pawn).bIsHero && UTHeroPawn(InstigatedBy.Pawn).bIsSuperHero) | else if (!UTHeroPawn(InstigatedBy.Pawn).bIsHero && UTHeroPawn(InstigatedBy.Pawn).bIsSuperHero) | ||
Enemy.Type=ET_Rook | Enemy.Type = ET_Rook; | ||
} | } | ||
else | else | ||
Enemy.Type=ET_Infantry; | Enemy.Type = ET_Infantry; | ||
} | } | ||
//Enemy isA UTVehicle | |||
else if(ClassIsChildOf(InstigatedBy.Pawn.class, class'UTVehicle')) | else if(ClassIsChildOf(InstigatedBy.Pawn.class, class'UTVehicle')) | ||
{ | { | ||
if(ClassIsChildOf(InstigatedBy.Pawn.class, class'UTVehicle_TrackTurretBase')) | if(ClassIsChildOf(InstigatedBy.Pawn.class, class'UTVehicle_TrackTurretBase')) | ||
Enemy.Type=ET_Turret; | Enemy.Type = ET_Turret; | ||
else | else | ||
Enemy.Type=ET_Vehicle; | Enemy.Type = ET_Vehicle; | ||
} | }*/ | ||
//Enemy isA UTBot | //Enemy isA UTBot | ||
Line 204: | Line 250: | ||
//Self-Damage | //Self-Damage | ||
if(Enemy.Pawn == injured) | if(Enemy.Pawn == injured) | ||
Damage = | Damage = BaseGameRules.ModifySelfDamage(Enemy); | ||
//Damage From EnemyPawn | //Damage From EnemyPawn | ||
Line 213: | Line 259: | ||
{ | { | ||
if(instigatedBy.GetTeamNum() != injured.GetTeamNum()) | if(instigatedBy.GetTeamNum() != injured.GetTeamNum()) | ||
Damage = | Damage = BaseGameRules.ModifyDamageTaken(Enemy, Injured); | ||
else | else | ||
Enemy.bIsFriendly = true; | Enemy.bIsFriendly = true; | ||
Line 219: | Line 265: | ||
//FFA Damage | //FFA Damage | ||
else | else | ||
Damage = | Damage = BaseGameRules.ModifyDamageTaken(Enemy, Injured); | ||
} | } | ||
} | } | ||
} | } | ||
</uscript> | </uscript> |
Latest revision as of 10:31, 15 February 2011
Introduction
Code
- Package:
- UT_GameDex
Enums
enum EnemyType
ET_Infantry,
ET_Hero,
ET_Vehicle,
ET_Rook,
ET_Knight,
ET_Bishop,
ET_Turret
Structs
PawnInfo
EnemyInfo
Extends: PawnInfo
Functions
SetFirstGR
function SetFirstGR()
OverridePickupQuery
function bool OverridePickupQuery(Pawn Other, class<Inventory> ItemClass, Actor Pickup, out byte bAllowPickup)
NetDamage
function NetDamage(int OriginalDamage, out int Damage, Pawn injured, Controller instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType)
Script
<uscript> //=================================================== // Class: UT_GR_Info // Creation date: 12/12/2008 19:35 // Last updated: 11/04/2010 13:10 // Contributors: 00zX //--------------------------------------------------- // Attribution-Noncommercial-Share Alike 3.0 Unported // http://creativecommons.org/licenses/by-nc-sa/3.0/ //=================================================== class UT_GR_Info extends GameRules;
`include(MOD.uci)
enum PawnType { ET_Infantry, ET_Hero, ET_Vehicle, ET_Rook, //Castle ET_Knight, //Manta, Viper? ET_Bishop, //Hero ET_Turret };
struct PawnInfo { var Pawn Pawn; var PawnType Type; };
struct EnemyInfo extends PawnInfo { var bool bIsBot; var bool bIsFriendly; var int Damage; var int ModifiedDamage; //ConversionRatio>?? var class<DamageType> DamageType;
structdefaultproperties { bIsBot=false bIsFriendly=false Damage=0 ModifiedDamage=0 DamageType=class'DmgType_Suicided' } };
var UT_MDB_GameExp GameExp; var private UT_MDB_GameRules BaseGameRules;
/** wtf why am I grey? */ function SetBaseGameRules() { if(GameExp == None) return;
`logd("GameRules Info Controller Initalized!",,'GameRulesInfo');
BaseGameRules = GameExp.GetBaseGameRules(); `logd("BaseGameRules:"$BaseGameRules,,'GameRulesInfo'); }
static function PawnType GetPawnType(Pawn Pawn) { local PawnType PType;
if(ClassIsChildOf(Pawn.class,class'UTPawn')) { //Added Rook 2.0 if(Pawn.IsA('UTHeroPawn')) { if(UTHeroPawn(Pawn).bIsHero && !UTHeroPawn(Pawn).bIsSuperHero) PType = ET_Hero; else if (!UTHeroPawn(Pawn).bIsHero && UTHeroPawn(Pawn).bIsSuperHero) PType = ET_Rook; } else PType = ET_Infantry;
} //isA UTVehicle else if(ClassIsChildOf(Pawn.class, class'UTVehicle')) { if(ClassIsChildOf(Pawn.class, class'UTVehicle_TrackTurretBase')) PType = ET_Turret; else PType = ET_Vehicle; }
return PType; }
function bool HandleRestartGame() { if((NextGameRules != None) && NextGameRules.HandleRestartGame()) return true; return false; }
function bool CheckEndGame(PlayerReplicationInfo Winner, string Reason) { if(NextGameRules != None) return NextGameRules.CheckEndGame(Winner,Reason);
return true; }
function bool OverridePickupQuery(Pawn Other, class<Inventory> ItemClass, Actor Pickup, out byte bAllowPickup) { if(GameExp == None || BaseGameRules == None) return false;
if(Pickup != None && UTPawn(Other) != None) if((BaseGameRules != None) && BaseGameRules.PickupQuery(UTPawn(Other), ItemClass, Pickup)) return true; return false; }
function ScoreObjective(PlayerReplicationInfo Scorer, Int Score) { /* local UT_MDB_EventNotifier.NotifyMode HandleNotify; local int idx;
HandleNotify = (EventName = ET_OnExit, NotifyName = NT_Vehicle); for(GR = BaseGameRules; GR != None; GR = GetNextGameRules(GR)) { idx = GR.EventNotifier.Notifies.find(HandleNotify); if(idx != Index_None) GR.ScoreObjective(Scorer,Score); }*/ }
function ScoreKill(Controller Killer, Controller Killed) { /* local UT_MDB_EventNotifier.NotifyMode HandleNotify; local int idx;
HandleNotify = (EventName = ET_OnExit, NotifyName = NT_Vehicle); for(GR = BaseGameRules; GR != None; GR = GetNextGameRules(GR)) { idx = GR.EventNotifier.Notifies.find(HandleNotify); if(idx != Index_None) GR.ScoreKill(Killer,Killed); }*/ }
//Cumulative //TODO: SUPPORT OTHER MUTS, USE THE LINKED LIST ONTOP OF OBJECT LIST!!~ function NetDamage(int OriginalDamage, out int Damage, pawn injured, Controller instigatedBy, vector HitLocation, out vector Momentum, class<DamageType> DamageType) { local EnemyInfo Enemy;
if(GameExp == None || BaseGameRules == None) return;
if(!WorldInfo.Game.IsInState('MatchInProgress') || (injured == None && instigatedBy == None)) { Damage = 0; return; }
//GameInfo.ReduceDamage // then check if carrying items that can reduce damage // if((damage > 0) && (injured.InvManager != None)) // injured.InvManager.ModifyDamage(Damage, instigatedBy, HitLocation, Momentum, DamageType);
if(instigatedBy != None && instigatedBy.Pawn != None) { Enemy.Pawn = InstigatedBy.Pawn; Enemy.Damage = OriginalDamage; Enemy.Type = GetPawnType(Enemy.Pawn);
/* if(ClassIsChildOf(Enemy.Pawn.class,class'UTPawn')) { //Added Rook 2.0 if(Enemy.Pawn.IsA('UTHeroPawn')) { if(UTHeroPawn(InstigatedBy.Pawn).bIsHero && !UTHeroPawn(InstigatedBy.Pawn).bIsSuperHero) Enemy.Type = ET_Hero; else if (!UTHeroPawn(InstigatedBy.Pawn).bIsHero && UTHeroPawn(InstigatedBy.Pawn).bIsSuperHero) Enemy.Type = ET_Rook; } else Enemy.Type = ET_Infantry;
} //Enemy isA UTVehicle else if(ClassIsChildOf(InstigatedBy.Pawn.class, class'UTVehicle')) { if(ClassIsChildOf(InstigatedBy.Pawn.class, class'UTVehicle_TrackTurretBase')) Enemy.Type = ET_Turret; else Enemy.Type = ET_Vehicle; }*/
//Enemy isA UTBot if(UTBot(instigatedBy) != None && UTBot(injured.controller) == None && UTBot(injured.controller) != UTBot(instigatedBy)) Enemy.bIsBot = true;
//Self-Damage if(Enemy.Pawn == injured) Damage = BaseGameRules.ModifySelfDamage(Enemy);
//Damage From EnemyPawn else if(injured != instigatedBy) { //Team Damage if(WorldInfo.Game.bTeamGame) { if(instigatedBy.GetTeamNum() != injured.GetTeamNum()) Damage = BaseGameRules.ModifyDamageTaken(Enemy, Injured); else Enemy.bIsFriendly = true; } //FFA Damage else Damage = BaseGameRules.ModifyDamageTaken(Enemy, Injured); } } } </uscript>