Announcement

Collapse
No announcement yet.

UScript noob needs help on first mutator

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Originally posted by HsoolienIt should not reitterate infinitly, try logging Recs.Length, and what ever 'i' is each loop, see if it is at least going up the list....
    It doesn't reiterate infinitely until partway through play, so I think it's just weapon overload I'll try logging though.

    Thanks for the config code, I'll get to it as soon as I can.

    Leave a comment:


  • replied
    It should not reitterate infinitly, try logging Recs.Length, and what ever 'i' is each loop, see if it is at least going up the list....

    As for the syntex, oops, I don't use Cache lists all that much since they do tend to list ALLL weapons, even stuff you don't need (Ball launcher from Bombing run)

    as for config files, what I do know is if you do this:

    Code:
    class mymut extends mutator
         config(OptionalFilename);
    
    var config bool bStuff;
    
    function PreBeginPlay();
    {
         log(bstuff);
    }
    
    static function FillPlayInfo(PlayInfo PlayInfo)
    {
         PlayInfo.AddSetting(default.RulesGroup, "Stuff", default."Hello", 0, 1, "Check");
    }
    
    static event string GetDescriptionText(string PropName)
    {
         if (PropName == "bStuff")
              return default."Stuff";
    }
    When you run the mut whatever you select for bStuff will be saved to either the UT200X.ini under:
    Code:
    [filename.mymut]
    bStuff=Whatever
    if you don't put a filename after config in the class declaration
    or it will make the above entry in .ini file called whatever file name you entered.


    As a note mut's with their own config cause UT200X to pause while loading their config screen

    Leave a comment:


  • replied
    Well, I know the next thing I need to implement: blacklisting/whitelisting, so I don't get the UT2004 AVRiL, the Soulrage Audio Mod AVRiL, the Excessive AVRiL, etc... for every weapon!

    My UT2004 crashed about a minute into the game with an "infinite iteration" error

    Can someone now give me a tutorial on how to use configuration files? I'll try to figure the rest out.

    Thanks!

    Leave a comment:


  • replied
    *cough*
    Code:
    Obj.GiveWeapon(Recs[i].ClassName);
    *cough*



    Thanks! After that little fix, it compiled smoothly... going to go try it now...

    Leave a comment:


  • replied
    You could have the mutator give all wepaons availble on a system using:
    Code:
    local array<CacheManager.WeaponRecord> Recs;
    class'CacheManager'.static.GetWeaponList(Recs);
    This will fill the Recs array with all the weapons installed ona system

    Then you can use an iterator to give them all to the players like so:
    Code:
    local int i;
    for (i = 0; i < Recs.Length; i++)
    {
         Obj.GiveWeapon(Recs[i]);
    }
    And so on and so forth

    Leave a comment:


  • replied
    http://www.ataricommunity.com/forums...hreadid=389400
    Basically, when I turn on only the mutator, I get all the UT2004 weapons. When I also add, say, SwitchArsenal, configuring it to give me a mix of CUT, Excessive, and UT2004 weapons, I want to start off with the CUT, Excessive, and UT2004 weapons I've picked. Instead, the mutator as written still gives me the default UT2004 weapons.

    Leave a comment:


  • replied
    Originally posted by neoflame

    However, I do not get:
    1. weapons replaced by other mutators
    2. infinite ammo for non-UT2004 weapons

    So you want your mutator to see what .u files are in your system dir, see if theres weapons inside of them, then have you spawn with them? I'm trying to better understand what you really want to do. Perhaps linking me to your concept idea thread would help?

    Leave a comment:


  • replied
    Right now, it seems to me that I can't directly check what weapons other mutators have replaced. So if I really want the functionality, I might have to reimplement WoRM/SwitchArsenal in my mutator :cry:

    CheckReplacement probably won't work for me, because it looks like it only functions when spawning an Actor. I need an event or something to trap when other mutators change weaponry...

    Leave a comment:


  • replied
    OK, I've "fixed" infinite ammo by throwing together an ugly, "decieve the user into thinking they're starting off with infinite ammo" hack:
    Code:
    function Timer()
    {
        local Controller Obj;
        for (Obj = Level.ControllerList; Obj != None; Obj = Obj.NextController)
        {
            if (Obj.Pawn != None)
            {
                Obj.Pawn.Weapon.MaxOutAmmo();
            }
        }
    }
    ...when in reality they only start getting infinite ammo when they pull out their gun!

    But I'm still getting regular UT2004 weapons :cry:
    Edit: I'll take a look at CheckReplacement.

    Leave a comment:


  • replied
    part of ies1.04V2:
    Code:
    function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
    {
    	local int i,arraynum;
    	if(bUseConfig && Other.IsA('Monster'))
    	{
    		for(i=0;i<24;i++)
    		{
    			if(Other.class==LoadMonsterClass[i])
    			{
                    Other.Acceleration*=MonsterConfigs[i].AccelScale;
    				Monster(Other).groundspeed*=MonsterConfigs[i].SpeedScale;
    				Monster(Other).airspeed*=MonsterConfigs[i].SpeedScale;
    				Monster(Other).waterspeed*=MonsterConfigs[i].SpeedScale;
    				Monster(Other).health*=MonsterConfigs[i].HealthScale;
    				Monster(Other).ScoringValue=MonsterConfigs[i].ScoreValue;
    				Other.SetDrawScale(Other.drawscale*MonsterConfigs[i].SizeScale);
    				Other.SetCollisionSize(Other.CollisionRadius*MonsterConfigs[i].SizeScale,Other.CollisionHeight*MonsterConfigs[i].SizeScale);
    				Pawn(Other).SkillModifier=MonsterConfigs[i].SkillModifier;
                 	break;
    
    			}
    
    		}
    
    	}
    
    	return true;
    }
    anyway, it checks of some thinges have to change before placing them. i guess it works for the player pawn, or controller (who gets the weapons?) so you can change his stuff too

    Leave a comment:


  • replied
    With the code above, I get:
    1. the configuration dialog
    2. all UT2004 weapons
    3. infinite ammo for the UT2004 weapons

    However, I do not get:
    1. weapons replaced by other mutators
    2. infinite ammo for non-UT2004 weapons

    Bartje321, what's checkreplacement?

    Leave a comment:


  • replied
    why dont use the checkreplacement
    (dont know if it will work, only once used for ies1.04v2, and copyed from the smp, with permission)

    Leave a comment:


  • replied
    A few questions, with the code above, what exactly DOES work? |(Do you get the weapons?, do you get max ammo on the default weapons?, do you see anything in the mutator config?)

    Leave a comment:


  • replied
    Downloadable? Probably not a good idea, since I just found out it doesn't work properly with chaining :cry:

    I turned on CUT2, but the mutator gave me regular weapons

    Any more help? Here's a link to a zip with the source code and the compiled .u/.ucl/.int files if anyone wants to try them. (So yes, it's downloadable )

    The code:
    Code:
    // MutLoadout - Player Loadout Mutator
    // Gives players alternate starting health and shield, all weapons, and infinite ammo.
    // By Neoflame, 11 June 2004
    
    class MutLoadout extends Mutator;
    
    var() config float StartingHealth; // player starting health
    var() config float StartingArmor; // player starting armor
    var config bool bInfiniteAmmo; // whether the player has infinite ammo, or just starts with maximum
    var config bool bGiveONSWeapons; // whether the player gets ONS-specific weapons
    var config bool bGiveSuperWeapons; // whether the player gets superweapons
    
    var localized string GUINameText[5];
    var localized string GUIDescText[5];
    
    event PreBeginPlay()
    {
        if (bInfiniteAmmo)
        {
            SetTimer(0.25, true);
        }
    }
    
    function GiveAmmo(Pawn Obj)
    {
        // Check if infinite ammo is on
        if (bInfiniteAmmo)
        {
            // Give 999 ammo
            // Give basic weapon ammo
            Weapon(Obj.FindInventoryType(class'AssaultRifle')).SuperMaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'BioRifle')).SuperMaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'ClassicSniperRifle')).SuperMaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'FlakCannon')).SuperMaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'LinkGun')).SuperMaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'Minigun')).SuperMaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'RocketLauncher')).SuperMaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'ShockRifle')).SuperMaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'SniperRifle')).SuperMaxOutAmmo();
            // Give ONS weapon ammo (if applicable)
            if (bGiveONSWeapons)
            {
                Weapon(Obj.FindInventoryType(class'ONSAVRiL')).SuperMaxOutAmmo();
                Weapon(Obj.FindInventoryType(class'ONSGrenadeLauncher')).SuperMaxOutAmmo();
                Weapon(Obj.FindInventoryType(class'ONSMineLayer')).SuperMaxOutAmmo();
            }
            // Give superweapon ammo (if applicable)
            if (bGiveSuperWeapons)
            {
                Weapon(Obj.FindInventoryType(class'Redeemer')).SuperMaxOutAmmo();
                Weapon(Obj.FindInventoryType(class'Painter')).SuperMaxOutAmmo();
                Weapon(Obj.FindInventoryType(class'ONSPainter')).SuperMaxOutAmmo();
            }
        }
        else
        {
               // Give maximum ammo
            // Give basic weapon ammo
            Weapon(Obj.FindInventoryType(class'AssaultRifle')).MaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'BioRifle')).MaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'ClassicSniperRifle')).MaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'FlakCannon')).MaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'LinkGun')).MaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'Minigun')).MaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'RocketLauncher')).MaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'ShockRifle')).MaxOutAmmo();
            Weapon(Obj.FindInventoryType(class'SniperRifle')).MaxOutAmmo();
            // Give ONS weapon ammo (if applicable)
            if (bGiveONSWeapons)
            {
                Weapon(Obj.FindInventoryType(class'ONSAVRiL')).MaxOutAmmo();
                Weapon(Obj.FindInventoryType(class'ONSGrenadeLauncher')).MaxOutAmmo();
                Weapon(Obj.FindInventoryType(class'ONSMineLayer')).MaxOutAmmo();
            }
            // Give superweapon ammo (if applicable)
            if (bGiveSuperWeapons)
            {
                Weapon(Obj.FindInventoryType(class'Redeemer')).MaxOutAmmo();
                Weapon(Obj.FindInventoryType(class'Painter')).MaxOutAmmo();
                Weapon(Obj.FindInventoryType(class'ONSPainter')).MaxOutAmmo();
            }
        }
    }
    
    function Timer()
    {
        local Controller Obj;
        for (Obj = Level.ControllerList; Obj != None; Obj = Obj.NextController)
        {
            if (Obj.Pawn != None)
            {
                GiveAmmo(Obj.Pawn);
            }
        }
    }
    
    function ModifyPlayer(Pawn Obj)
    {
        Obj.Health = StartingHealth;
        Obj.ShieldStrength = StartingArmor;
    
        Obj.GiveWeapon("XWeapons.BioRifle");
        Obj.GiveWeapon("XWeapons.FlakCannon");
        Obj.GiveWeapon("XWeapons.LinkGun");
        Obj.GiveWeapon("XWeapons.Minigun");
        Obj.GiveWeapon("XWeapons.RocketLauncher");
        Obj.GiveWeapon("XWeapons.ShockRifle");
        Obj.GiveWeapon("XWeapons.SniperRifle");
        Obj.GiveWeapon("UTClassic.ClassicSniperRifle");
        // Give ONS weapons if applicable
        if (bGiveONSWeapons)
        {
            Obj.GiveWeapon("Onslaught.ONSAVRiL");
            Obj.GiveWeapon("Onslaught.ONSGrenadeLauncher");
            Obj.GiveWeapon("Onslaught.ONSMineLayer");
        }
        // Give superweapons if applicable
        if (bGiveSuperWeapons)
        {
            Obj.GiveWeapon("XWeapons.Redeemer");
            Obj.GiveWeapon("XWeapons.Painter");
            Obj.GiveWeapon("OnslaughtFull.ONSPainter");
        }
    
        GiveAmmo(Obj);
    
        Super.ModifyPlayer(Obj);
    }
    
    static function FillPlayInfo(PlayInfo PlayInfo)
    {
        Super.FillPlayInfo(PlayInfo);
        PlayInfo.AddSetting(default.RulesGroup, "StartingHealth", default.GUINameText[0], 0, 0, "Text", "3;1:199");
        PlayInfo.AddSetting(default.RulesGroup, "StartingArmor", default.GUINameText[1], 0, 0, "Text", "3;0:150");
        PlayInfo.AddSetting(default.RulesGroup, "bInfiniteAmmo", default.GUINameText[2], 0, 0, "Check");
        PlayInfo.AddSetting(default.RulesGroup, "bGiveONSWeapons", default.GUINameText[3], 0, 0, "Check");
        PlayInfo.AddSetting(default.RulesGroup, "bGiveSuperWeapons", default.GUINameText[4], 0, 0, "Check");
    }
    
    static event string GetDisplayText(string PropName)
    {
        switch (PropName)
        {
            case "StartingHealth": return default.GUINameText[0];
            case "StartingArmor": return default.GUINameText[1];
            case "bInfiniteAmmo": return default.GUINameText[2];
            case "bGiveONSWeapons": return default.GUINameText[3];
            case "bGiveSuperWeapons": return default.GUINameText[4];
        }
    }
    
    static event string GetDescriptionText(string PropName)
    {
        switch (PropName)
        {
            case "StartingHealth": return default.GUIDescText[0];
            case "StartingArmor": return default.GUIDescText[1];
            case "bInfiniteAmmo": return default.GUIDescText[2];
            case "bGiveONSWeapons": return default.GUIDescText[3];
            case "bGiveSuperWeapons": return default.GUIDescText[4];
            default: return Super.GetDescriptionText(PropName);
        }
    }
    
    defaultproperties
    {
    StartingHealth=100
    StartingArmor=100
    bInfiniteAmmo=true
    bGiveONSWeapons=true
    bGiveSuperWeapons=false
    GUINameText[0]="Starting Health"
    GUINameText[1]="Starting Shield"
    GUINameText[2]="Infinite Ammo"
    GUINameText[3]="Onslaught Weapons"
    GUINameText[4]="Superweapons"
    GUIDescText[0]="Amount of health players start with."
    GUIDescText[1]="Amount of shield players start with."
    GUIDescText[2]="If this box is checked, all weapons will have infinite ammo. If not, all players will start off with the maximum amount of ammo for their weapons, but ammo will be finite."
    GUIDescText[3]="If this box is checked, Onslaught weapons will be included in the loadout."
    GUIDescText[4]="If this box is checked, superweapons will be included in the loadout."
    GroupName="Loadout"
    FriendlyName="Player Loadout"
    Description="Starts players off with a configurable amount of health and shield, as well as every weapon and full ammo."
    }

    Leave a comment:


  • replied
    i have seen your tread on the idea's forums
    good you did it yourself
    is it already downloadable ?

    Leave a comment:

Working...
X