PDA

View Full Version : New player controlled character??



Valeranth
11-06-2009, 03:20 PM
Hi,
Im new to this engine and am looking at it to make a rpg. Currently I am trying to figure out how to make a new pawn that can be controlled by the player and who will have stats such as Experience. currently I have created a temp class (NewPlayer) that extends Pawn but dont know how to tell the UDK to use that for the player. And Ideas or links to any tutorials?

lcizzle
11-06-2009, 03:23 PM
You need to change the PlayerControllerClass to point to your NewPlayer class.

Valeranth
11-06-2009, 03:29 PM
Do I need to create a new one and use that in a costume playmode, or just mod the PlayerController.uc in Dev/src/Engine/Classes?

lcizzle
11-06-2009, 03:33 PM
Do not mod playercontroller.uc that is a core engine component.

Follow the UDK tutorials on getting started.
You will need to create a new folder under Development\Src
for your mod or game.

Development\Src\MyMod\Classes

Valeranth
11-06-2009, 03:39 PM
Do not mod playercontroller.uc that is a core engine component.

Follow the UDK tutorials on getting started.
You will need to create a new folder under Development\Src
for your mod or game.

Development\Src\MyMod\Classes

I have already created all that. Currently I have three files in the MyMod/Classes/ folder (SuperFunGame, TestActor, TestPlayer). I am not sure what you mean by modify the PlayerController however. Would I do that in SuperFunGame (makes a new game style that extends UTDeathMatch) or where? Sorry if I am missing something or proving myself stupid.

SublimeO12
11-06-2009, 03:52 PM
not stupid, I'm having some trouble getting over a similar barrier. from what I understand, you'd create the file that extends PlayerController and put it in the MyMod/Classes directory. After that, I'm not sure - how does one get the game to point at those modded files instead of the original script files? I'm guessing it has to do with modifying one of the .ini files? I think it would be incredibly helpful if someone could detail how to go from creating the modded files, into getting them into the game, say, via running one of the test-levels "DM-Deck" for example, inside the editor.

lcizzle
11-06-2009, 04:05 PM
UTGame\Configs\DefaultGame.ini

[Engine.GameInfo]
DefaultGame=UTGame.UTDeathmatch
DefaultServerGame=UTGame.UTDeathmatch
PlayerControllerClassName=UTGame.UTPlayerControlle r
GameDifficulty=+1.0
MaxPlayers=32


You can set the player controller class using the above.

If you are extending UTDeathmatch (Which extends UTGame which Extends GameInfo)
you can see GameInfo has var class<PlayerController> PlayerControllerClass;
So make a DefaultProperties in your MyMod.uc and change it to point to your player class controller.



DefaultProperties
{
PlayerControllerClass=class'UTGame.UTPlayerControl ler' // Change this
}

G0rdon
11-06-2009, 04:06 PM
you could try to make a new gamemode like this:

http://pastebin.com/d14607d6e

its deathmatch using another pawn and player controller

Valeranth
11-06-2009, 04:29 PM
Thanks guys. Those ideas worked.
I am getting really odd behavior but I guess that is because the scripts are very basic right now. Also not sure how to get the PlayerController to point to my new player class (I guess ill have to dive into the script source) but thanks a lot!

lcizzle
11-06-2009, 04:36 PM
Look at Development\Src\Engine\GameInfo.uc and Development\Src\Engine\UTGame.uc
The DefaultProperties section at the bottom of UTGame.uc contains pretty much everything you are trying to change.

DefaultPawnClass=class'UTPawn'

Add that to your DefaultProperties section of MyMod.uc and change it to point to your player class.

Valeranth
11-06-2009, 04:50 PM
Look at Development\Src\Engine\GameInfo.uc and Development\Src\Engine\UTGame.uc
The DefaultProperties section at the bottom of UTGame.uc contains pretty much everything you are trying to change.

DefaultPawnClass=class'UTPawn'

Add that to your DefaultProperties section of MyMod.uc and change it to point to your player class.

the only issue with setting the defaultPawnClass is that the NPC are also part of the class. This is something I dont want. Or will this be fixed by modifying the map (havn't messed around with that much)

DragonSpawn
11-07-2009, 07:07 AM
Since my question is somwhat related to this: I will post it here.
What I would like to know is where the default player character (mesh) is set. Whenever you run the game in the editor you get some default UT character. So where is this set and how would one go about changing this?

Gillies
11-07-2009, 08:32 AM
this is stumping me aswell, in my project as a ut3 mod there was a defaultmesh variable in the pawn class, now apparently it isnt in the udk version, and it seems to be ignoreing my familyinfo :S

lodi
11-07-2009, 01:23 PM
I'm still not getting it...

I followed the tutorial (http://udn.epicgames.com/Three/DevelopmentKitProgramming.html) and modified SuperFunGame to add



defaultproperties {
PlayerControllerClass=class'MyMod.spPlayerControll er';
}


and I created spPlayerController.uc



class spPlayerController extends UTPlayerController;

function AcknowledgePossession(Pawn P) {
`log("entered AcknowledgePosession");
Super.AcknowledgePossession(P);
}

event Possess(Pawn inPawn, bool bVehicleTransition) {
`log("entered Possess");
Super.Possess(inPawn, bVehicleTransition);
}

function PawnDied(Pawn inPawn) {
`log("entered PawnDied");
Super.PawnDied(inPawn);
}

defaultproperties
{
bBehindView=True
}


and I modified UTGame.ini just in case:



[Engine.GameInfo]
DefaultGame=MyMod.SuperFunGame
DefaultServerGame=MyMod.SuperFunGame
bAdminCanPause=false
MaxPlayers=32
GameDifficulty=1.000000
bChangeLevels=True
MaxSpectators=2
MaxIdleTime=0.000000
MaxTimeMargin=0.000000
TimeMarginSlack=1.350000
MinTimeMargin=-1.000000
TotalNetBandwidth=32000
MaxDynamicBandwidth=7000
MinDynamicBandwidth=4000
PlayerControllerClassName=MyMod.spPlayerController
bKickLiveIdlers=False
ArbitrationHandshakeTimeout=0.000000
GoreLevel=0


and I still can't see any of my changes in my custom player controller. SuperFunGame is otherwise working fine. What am I missing, and how can I debug a situation like this in the future? Thanks.

SublimeO12
11-07-2009, 08:50 PM
that sounds like pretty much exactly what i've done, which worked for me. you sure you're not seeing those log statements? what are you doing to make sure you're running superfungame, are you passing it in as one of the URL type parameters in the target of a shortcut UDK, or some other way? Maybe you're not actually running superfungame.

NightRyder
11-07-2009, 11:48 PM
I'm pretty sure that you cannot add
defaultproperties {
PlayerControllerClass=class'MyMod.spPlayerControll er';
} to the superfungame.uc file. I say this because you can put ANYTHING there, and it doesn't complain. Thus, it doesn't even pay attention to that.

I don't think the variable PlayerControllerClass is in scope at that point.

lodi
11-08-2009, 12:52 AM
SublimeO12: I modified UTGame.ini to set the default game, and when I run it with `udk.exe dm-deck' I do indeed see superfungame logging to the console and playing the 'massacre' message.

NightRyder: Wow, you're right. So where should I be setting it then? Any thoughts why the line in UTGame.ini isn't working?

NightRyder
11-09-2009, 12:51 AM
Actually I was both wrong and right. I found that setting the defaultproperties there DOES work, but only if you don't write it like that.

does NOT work:

defaultproperties {
blah
}

DOES work:

defaultproperties
{
blah
}

UnrealScript is picky? YES

lodi
11-09-2009, 07:01 PM
NightRyder: Wow... incredible. You're right, that did it. Thanks!

meathelix
11-10-2009, 08:06 PM
In this case, do you want to inherit from UTPawn and UTPlayerController, or inherit from what those inherit from [GamePawn and GamePlayerController]? There's probably some useful functionality in the UT versions, but you're also carrying a lot of baggage if you're trying to start something from scratch, right? I'm just starting down this path myself, and it's something that seems noteworthy.