View Full Version : How to give players duals at start
Help please.
I am trying to make a mutator for this now.
Using this:
function PostBeginPlay()
{
local UTGame Game;
Super.PostBeginPlay();
Game = UTGame(WorldInfo.Game);
if (Game != None)
{
Game.DefaultInventory.Length = 2;
Game.DefaultInventory[0] = class'UTWeap_Enforcer';
Game.DefaultInventory[1] = class'UTWeap_Enforcer';
}
}
But it gives only ONE. No dual welding. That to do?
SwaTz0rs
11-24-2007, 04:55 AM
i'd say check the utweap_enforcer file
Lotus
11-24-2007, 04:56 AM
From UTMutator_Handicap:
Enforcer = UTWeap_Enforcer(PlayerPawn.FindInventoryType(Handi capInventory[1]));
if ( Enforcer != None )
{
Enforcer.DualMode = EDM_DualEquipping;
Enforcer.BecomeDual();
}
From UTMutator_Handicap:
Thanks for this one but i can't figure out there to put it?
I'm scripting noob. :o
MysTikal
11-24-2007, 04:14 PM
Just copy and paste it in. It should work.
Kohan
11-24-2007, 06:38 PM
No, I don't believe that PostBeginPlay() would be the function to use, because that would only run once; after the game begins. For such an approach as your original idea, that would be appropriate, but that last snippet of code would need to be put in a ModifyPawn() function, so that it would be called whenever a Pawn is spawned.
Indeed. Check out UTMutator_Handicap.uc and just get rid of the parts you don't want.
Any class (well, most) can use a PostBeginPlay() which is called when it is spawned into the world if I'm not mistaken. So its not necessarily the beginning of the match, but the beginning of the life of the object in-game.
DS3:
Your original code would most likely (if it even allowed it) just place two separate enforcers in their own inventory slot. Check the enforcer code and I'm sure you'll find what you need.
Further searching:
Subclass your UTWeap_Enforcer and place BecomeDual() in your PostBeginPlay(). Should work.
Nereid
11-25-2007, 01:48 AM
Better yet, put this in the ModifyPlayer function in your mutator so you don't have to subclass anything (which is what kisk's idea is), because that might conflict with other weapon mutators.
From UTMutator_Handicap:
Enforcer = UTWeap_Enforcer(PlayerPawn.FindInventoryType(Handi capInventory[1]));
if ( Enforcer != None )
{
Enforcer.DualMode = EDM_DualEquipping;
Enforcer.BecomeDual();
}
One of my general rules is: avoid making subclasses of things to override them if you can.
In fact, you can pretty much copy UTMutator_Handicap and remove the stuff that isn't related to dual enforcers:
class UTMutator_DualEnforcers extends UTMutator;
function ModifyPlayer(Pawn P)
{
local UTPawn PlayerPawn;
local UTWeap_Enforcer Enforcer;
PlayerPawn = UTPawn(P);
if ( PlayerPawn == None )
{
return;
}
Enforcer = UTWeap_Enforcer(PlayerPawn.FindInventoryType(class 'UTWeap_Enforcer'));
if ( Enforcer != None )
{
Enforcer.DualMode = EDM_DualEquipping;
Enforcer.BecomeDual();
}
Super.ModifyPlayer(PlayerPawn);
}
There, I did your work for you. :)
edit: Yeah, what Kohan said.
There, I did your work for you. :)
edit: Yeah, what Kohan said.
Thanks :D It works now.
Scha11enkrigor
11-29-2007, 10:47 AM
Then we want to have it too!!!!^^
i love dual enforcers!!!!
gravity0
12-19-2007, 11:41 AM
i had your idea too... it's too much funny to kill everyone with the dual enforcer... send me the mut when you finish
Powered by vBulletin® Version 4.1.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.