I want to port the superberserk mutator that shipped with ut2k4 to ut2k3. It sounds like it should be a simple exercise, just doubling all the weapon firing rates.
I've basically copied the code from the ut2k4 version and used referential transparency to remove all the obfuscatory Object Oriented bullshit (ie, whenever there is a function/method call to another class, i just inline the function call and pray that it doesn't touch anything that was set to private. Surprisingly it compiles, lucky me).
I've inserted log messages at strategic locations throughout the code. Currently the only ones that show up in the log are the postbeginplay "hello world" one, and the "i'mouttaurloop" one. The "yoyoyoyo", "Il hombre!" and "dawg!" messages never get hit, which indicates that the foreach loop is never entered.
NOTE: This is ALL the code. It's not much
This code is the result of half an hour of mucking around. I've got 9 years coding experience in various other languages so feel free to use big words. I'm still a unrealscript n00b though, I have never mustered the ability to "be arsed" and properly learn the framework provided by ut2k4/ut2k3/unreal/UT. Now's a good time to start
I've basically copied the code from the ut2k4 version and used referential transparency to remove all the obfuscatory Object Oriented bullshit (ie, whenever there is a function/method call to another class, i just inline the function call and pray that it doesn't touch anything that was set to private. Surprisingly it compiles, lucky me).
I've inserted log messages at strategic locations throughout the code. Currently the only ones that show up in the log are the postbeginplay "hello world" one, and the "i'mouttaurloop" one. The "yoyoyoyo", "Il hombre!" and "dawg!" messages never get hit, which indicates that the foreach loop is never entered.
NOTE: This is ALL the code. It's not much
Code:
class SuperBerserk extends Mutator;
function PostBeginPlay()
{
Super.PostBeginPlay(); // Run the super class function (Mutator.PostBeginPlay).
Log("Hello World"); // Write our log message
}
auto state startup
{
function tick(float deltatime)
{
local Weapon W;
// local Ammunition A;
log("imouttaurloop");
// Level.GRI.WeaponBerserk = 3;
ForEach DynamicActors(class'Weapon', W)
{
Log("YOYOYOYO");
//W.CheckSuperBerserk();
if (W.FireMode[0] != None)
{
Log("Il hombre!");
//W.FireMode[0].StartSuperBerserk();
W.Firemode[0].FireRate = W.Firemode[0].default.FireRate * 0.75;
W.Firemode[0].FireAnimRate = W.Firemode[0].default.FireAnimRate/0.75;
W.Firemode[0].ReloadAnimRate = W.Firemode[0].default.ReloadAnimRate/0.75;
}
if (W.FireMode[1] != None)
{
Log("dawg!");
//W.FireMode[1].StartSuperBerserk();
W.Firemode[1].FireRate = W.Firemode[1].default.FireRate * 0.75;
W.Firemode[1].FireAnimRate = W.Firemode[1].default.FireAnimRate/0.75;
W.Firemode[1].ReloadAnimRate = W.Firemode[1].default.ReloadAnimRate/0.75;
}
}
// ForEach DynamicActors(class'Ammunition', A)
// A.AddAmmo(1);
GotoState('BegunPlay');
}
}
function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
return true;
}
state BegunPlay
{
ignores tick;
}
defaultproperties
{
FriendlyName="Super Berserk"
Description="Increases all weapon fire rates (Currently only successfully Logs 'Hello World'. :P)"
}
This code is the result of half an hour of mucking around. I've got 9 years coding experience in various other languages so feel free to use big words. I'm still a unrealscript n00b though, I have never mustered the ability to "be arsed" and properly learn the framework provided by ut2k4/ut2k3/unreal/UT. Now's a good time to start