Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21

Thread: How to set different pawns for different characters in game?

  1. #11
    MonsOlympus
    Guest
    Just use FamilyInfo's then

  2. #12
    anomaly_a
    Guest
    I got it working I think. Heres what I did:

    My player controller class:

    Code:
    class MyPlayerController extends UTPlayerController;
    
    var int team;
    
    simulated function PostBeginPlay()
    {
    	super.PostBeginPlay();
    	local PlayerPawn0 NewPlayer;
    	NewPlayer = Spawn(class'PlayerPawn0');
    	super.Possess(NewPlayer, false);
    	team = 0;	
    }
    
    function int getMyTeam()
    {
    	return team;
    }
    
    
    DefaultProperties
    {
    }
    and my pawn class:

    Code:
    class PlayerPawn0 extends UTPawn
    	placeable;
    
    var int team;
    
    simulated event PostBeginPlay()
    {
    	super.PostBeginPlay();
    	team = 0;
    }
    
    function int getMyTeam()
    {
    	return team;
    }
    
    DefaultProperties
    {
    	Begin Object Name=CollisionCylinder
    		CollisionHeight=+44.000000
        	end object
        	bJumpCapable=true
        	bCanJump=true
        	GroundSpeed=300.0	
    }
    So this pawn can jump and runs faster then my bot pawn. Also I give them different inventories. At some point I will work on setting the pawn in game or at a menu or something.

  3. #13
    MonsOlympus
    Guest
    You'll have the same issue as what I suggested, all human players will use that class.

  4. #14
    anomaly_a
    Guest
    Hmmmm I guess you're right, so what is the solution. There has to be a way for there to be different characters in a game.

  5. #15
    MonsOlympus
    Guest
    There is! You use UTFamilyInfo, to set pawn defaults hook SetPlayerDefaults in your GameInfo and assign them through a static function in your UTFamilyInfo subclass. Its exactly the same as the species code in UT2004.

  6. #16
    anomaly_a
    Guest
    I only understood about half of that, you mind if i send you a private message for some additional details?

  7. #17
    anomaly_a
    Guest
    There is a way to set different bots as different pawns in kismet. Are kismets capabilities based on the capabilities of unreal script? If so you should be able to set different pawns for each instance of a player. Along those lines is there a way in kismet to set the pawn of a players (not a bot, I already know that can be done).

  8. #18
    MonsOlympus
    Guest
    Keep the posts on here please then anyone can view them later and the PM boxes are tiny.

    Code:
    class mGame extends UTDeathmatch;
    	dependson(mFamilyInfo);
    
    var class<UTFamilyInfo> DefaultFamily;
    
    function SetPlayerDefaults(Pawn PlayerPawn)
    {
    	local class<UTFamilyInfo> FamilyC;
    
    	FamilyC = UTPawn(PlayerPawn).GetFamilyInfo();
    	if(class<mFamilyInfo>(FamilyC) != None)
    		class<mFamilyInfo>(FamilyC).static.SetPlayerDefaults(PlayerPawn);
    
    	PlayerPawn.AirControl = PlayerPawn.Default.AirControl;
    	PlayerPawn.GroundSpeed = PlayerPawn.Default.GroundSpeed;
    	PlayerPawn.WaterSpeed = PlayerPawn.Default.WaterSpeed;
    	PlayerPawn.AirSpeed = PlayerPawn.Default.AirSpeed;
    	PlayerPawn.Acceleration = PlayerPawn.Default.Acceleration;
    	PlayerPawn.AccelRate = PlayerPawn.Default.AccelRate;
    	PlayerPawn.JumpZ = PlayerPawn.Default.JumpZ;
    /*	if ( BaseMutator != None )
    		BaseMutator.ModifyPlayer(PlayerPawn);*/
    	PlayerPawn.PhysicsVolume.ModifyPlayer(PlayerPawn);
    }
    
    function AddDefaultInventory(Pawn PlayerPawn)
    {
    	local class<inventory> inv;
    	local class<UTFamilyInfo> FamilyC;
    	local UTFamilyInfo Family;
    
    	FamilyC = UTPawn(PlayerPawn).GetFamilyInfo();
    	if(FamilyC != None)
    	{
    /*		foreach mFamilyInfo(FamilyC).FamilyInventory(inv)
    			if(PlayerPawn.InventoryMgr.FindInventoryType(inv) == None)
    				PlayerPawn.InventoryMgr.CreateInventory(inv);*/
    		Family = new(PlayerPawn) FamilyC;
    		if(mFamilyInfo(Family) != None)
    		{
    			foreach mFamilyInfo(Family).FamilyInventory(inv)
    				if(PlayerPawn.InvManager.FindInventoryType(inv) == None)
    					PlayerPawn.InvManager.CreateInventory(inv);
    		}
    	}
    	else
    	{
    		foreach DefaultInventory(inv)
    			if(PlayerPawn.InvManager.FindInventoryType(inv) == None)
    				PlayerPawn.InvManager.CreateInventory(inv);
    	}
    	PlayerPawn.Controller.ClientSwitchToBestWeapon();
    //	PlayerPawn.AddDefaultInventory();
    }
    Code:
    class mFamilyInfo extends UTFamilyInfo;
    	
    var float	AirControl,
    			GroundSpeed,
    			WaterSpeed,
    			AirSpeed,
    			Acceleration,
    			AccelRate,
    			JumpZ,
    			DodgeSpeed,
    			DodgeSpeedZ;	
    
    var array< class<Inventory> > FamilyInventory;
    
    static function SetPlayerDefaults(Pawn P)
    {
    //	if(SkeletalMesh(P.Mesh) != none)
    //		SkeletalMesh(P.Mesh) = default.CharacterMesh;
    
    	if(UTPawn(P) != none)
    		UTPawn(P).SetCharacterMeshInfo(default.CharacterMesh, default.BaseMICParent, default.BaseMICParent);
    
    	P.AirControl = default.AirControl;
    	P.GroundSpeed = default.GroundSpeed;
    	P.WaterSpeed = default.WaterSpeed;
    	P.AirSpeed = default.AirSpeed;
    	//P.Acceleration = default.Acceleration;
    	P.AccelRate = default.AccelRate;
    	P.JumpZ = default.JumpZ;
    	UTPawn(P).DodgeSpeed = default.DodgeSpeed;
    	UTPawn(P).DodgeSpeedZ = default.DodgeSpeedZ;
    }
    
    defaultproperties
    {
    	GroundSpeed=350.0	//440.0
    	AirSpeed=380.0		//440.0
    	WaterSpeed=220.0
    	DodgeSpeed=450.0		//600.0
    	DodgeSpeedZ=245.0	//295.0
    	AccelRate=1024.0
    	JumpZ=322.0
    }

  9. #19
    anomaly_a
    Guest
    And so using this method you could have says 10 different characters with different speeds, health, mana etc, just by checking maybe what character it is and then setting the stats for that character?

  10. #20
    anomaly_a
    Guest
    So if I understand this correctly, this would allow you to set the properties of the any give pawn to the values provided in the FamilyInfo. But unlike my method, it would not change the properties of the pawn for all instances of that pawn in the game?

    Are you sure my method wont work? If each person selects at a menu which character they want, and it spawned each of the corresponding pawns into the game and for each of them they possessed their pawn, you think it would be the case that the last pawn spawned would be the one that every player was playing?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •