Jump to content
Sign in to follow this  
Depechivo

WorldEditor makes wrong override function for OnPlayerKilled

Recommended Posts

I try create OnPlayerKilled override from GameMode_Editor_Full by pressing "+" in Script section, but World Editor makes: "override void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, Instigator killer)" and in SCR_GameModeEditor we have: "override void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)" that why i have error when compile script (Overloaded function 'OnPlayerKilled', argument 'killer' is not compatible with prototype argument type or spec 'Instigator').

How can i unlock function modify in script editor to add "notnull" in created function or make another actions to resolve this problem?

 

 

Share this post


Link to post
Share on other sites

I tried like this, but it doesnt work too:

class GameMode_Editor_Full1_Class: SCR_GameModeEditor 
{
	// user script
	// code here
	override void OnPlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
	{
		Print("--- OnPlayerKilled ---");
		super.OnPlayerKilled(playerId, playerEntity, killerEntity, killer);
	}

	override void EOnInit(IEntity owner)
	{
		/* code here */
		super.EOnInit(owner);

		SCR_BaseGameMode gameMode = SCR_BaseGameMode.Cast(GetGame().GetGameMode());  
		if (!gameMode)
		return;
		gameMode.GetOnPlayerKilled().Insert(OnPlayerKilled);
	}
}

 

Share this post


Link to post
Share on other sites

Fix this problem with that function:
 

protected override bool HandlePlayerKilled(int playerId, IEntity playerEntity, IEntity killerEntity, notnull Instigator killer)
{
  Print("--- HandlePlayerKilled---");

  return super.HandlePlayerKilled(playerId, playerEntity, killerEntity, killer);
}

P.S.

"OnPlayerKilled" was mod function, but World Editor ignores "notnull" in override functions when u try to create it from "Script+" menu in details tab.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×