mardi 26 août 2014

Pawn and Controller relationship

So, from some tutorials I figured out a way to change the PlayerControllerClass with your mod. I am trying to add an exec function that does something, and the way I think this is how people do it:



function postBeginPlay(){

level.Game.PlayerControllerClass = class'MyMutator.MyController';

}



and then in the MyController you can have some sort of exec function that can be called



class MyController extends PlayerController;



exec function MyFunction()

{

local KFHumanPawn p;

foreach DynamicActors(class 'KFHumanPawn', p){

p.Health = 50;

}

}



So, the way I have it written when MyFunction() is called it sets all players health to 50. Logically, there absolutely has to be a unique instance of PlayerController for each KFHumanPawn since

level.Game.PlayerControllerClass = class'MyMutator.MyController';

I would assume executes client side (so separate thread for each player), it makes perfect sense how each KFHumanPawn gets their own instance. Now, my question is how would I reference between the controller and the pawn that belong to me, and pass instance variables between those? Ultimately at this time I am trying to make it so that MyFunction() only sets MY health to 50.




Aucun commentaire:

Enregistrer un commentaire