Jump to content

Modding details? Ask away!


Amineri

Recommended Posts

 

Does anyone know how to add new buttons for existing screens? for instance the soldier abilities screen (where you choose promotion abilities) it's pretty much mandatory for my Commander's choice mod (and would help a lot for the other parts of my other mods)

I'd suggest creating a UIScreenListener and manipulating the ScreenStack to get at the screen you want to modify.

local UIScreenStack ScreenStack;
local UIArmory ArmoryScreen;
ScreenStack = `SCREENSTACK;
ArmoryScreen = UIArmory(ScreenStack.GetScreen(class'UIArmory'));

Ahh thanks but do you know how to add a uiButton then? UI code is chinese to me, talk Unit and Abilities code to me any day but UI? no i just dont understand it, if anyone want to be a co-developer on my Second Wave Reborn mod i am more than willing to cooperate especially on UI and reading complex ini files

Edited by Guest
Link to comment
Share on other sites

  • Replies 399
  • Created
  • Last Reply

Top Posters In This Topic

Edit 16.02:

 

So i've just found out that the code actually works, but instead of:

UnitState.ModifyCurrentStat

there has to be:

UnitState.SetBaseMaxStat

So know I have a question, what are the current stats and what is the difference between them and base stats. My confusion comes from the functions found in XComGameState_Unit.uc:

native function ModifyCurrentStat(ECharStatType Stat, float Delta);
native function SetCurrentStat( ECharStatType Stat, float NewValue );

Any help appreciated,

Thanks

 

 

 

Original Post:

 

Hello, help needed!

 

I've tried to modify unit stats during a tactical combat by listening to an event of finished movement but even though I got no errors and the code seems to run (checked with `logs) - there is no change in stats.

 

 

 

class UIScreenListener_RQ extends UIScreenListener config(RQ_GameplayChanges);

var config float AIM_SHOT_IMPROVEMENT;

function OnInit(UIScreen Screen)
{
	local Object ThisObject;

	ThisObject = self;

	`XEVENTMGR.RegisterForEvent(ThisObject, 'UnitMoveFinished', UnitFinishedMove, ELD_OnStateSubmitted);
}

function EventListenerReturn UnitFinishedMove(Object EventData, Object EventSource, XComGameState GameState, Name EventID)
{
	local XComGameState NewGameState;
	local XComGameState_Unit MovedUnit, UpdatedUnit;
	local ETeam MoverTeam;

	MovedUnit = XComGameState_Unit( EventData );

	MoverTeam = MovedUnit.GetTeam();
	if( MovedUnit.IsMindControlled() )
	{
		MoverTeam = MovedUnit.GetPreviousTeam();
	}
	//Escape if moved unit was invalid
	if( (MovedUnit == none) || MovedUnit.GetMyTemplate().bIsCosmetic || (XGUnit(MovedUnit.GetVisualizer()).m_eTeam == eTeam_Neutral) )
	{
		return ELR_NoInterrupt;
	}
	
	//TODO: No alien stat change for now
	switch (MoverTeam)
	{
		case eTeam_XCom:
			`log("Found moved unit to be an XCOM soldier!");
			`log("Unit ID:" @ MovedUnit.ObjectID);
			break;
		case eTeam_Alien:
			return ELR_NoInterrupt;
			break;
		case eTeam_Neutral:
			return ELR_NoInterrupt;
			break;
		default:
			return ELR_NoInterrupt;
			break;
	}

	NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Aim Stat Up");
	
	UpdatedUnit = XComGameState_Unit(NewGameState.CreateStateObject(class'XComGameState_Unit', MovedUnit.ObjectID));
	UpdatedUnit.ModifyCurrentStat(eStat_Offense, 120.0f);
	
	NewGameState.AddStateObject(UpdatedUnit);
	
	`TACTICALRULES.SubmitGameState(NewGameState);

	return ELR_NoInterrupt;
}

 

 

 

This compiles absolutely fine. If I add logs to tell me the unit current stats and stats after my code - they are the same.

Also - I'm editing Aim skill to easiliy test by trying to shoot alien as it's immediate feedback so it's not just that my logs don't show correct stuff.

I've also tried some other versions like:

 

 

 

	ChangeContainer = class'XComGameStateContext_ChangeContainer'.static.CreateEmptyChangeContainer("Descriptive String");
	NewGameState = `XCOMHISTORY.CreateNewGameState(true, ChangeContainer);

	MovedUnit = XComGameState_Unit(NewGameState.CreateStateObject(class'XComGameState_Unit', MovedUnit.ObjectID));
	MovedUnit.ModifyCurrentStat(eStat_Offense, 120.0f);
	 
	NewGameState.AddStateObject(MovedUnit);

	`TACTICALRULES.SubmitGameState(NewGameState);

 

 

 

or like Teleportation function in XComCheatManager.uc:

 

 

 

	History = `XCOMHISTORY;

	StatUpContext = XComGameStateContext_TacticalGameRule(class'XComGameStateContext_TacticalGameRule'.static.CreateXComGameStateContext());
	StatUpContext.GameRuleType = eGameRule_ReplaySync;
	NewGameState = History.CreateNewGameState(true, StatUpContext);

	MovedUnit = XComGameState_Unit(NewGameState.CreateStateObject(class'XComGameState_Unit', MovedUnit.ObjectID));
	MovedUnit.ModifyCurrentStat(eStat_Offense, 120.0f);
	 
	NewGameState.AddStateObject(MovedUnit);
	`TACTICALRULES.SubmitGameState(NewGameState);

 

 

 

Of course doesn't make any difference. I'm beginning to think that I can't edit stats while in an EventListenerReturn or can I?

This is my first trying UnrealScript and I'm kinda struggling... :ermm:

 

Any help appreciated,

Thanks

Edited by RivvqPL
Link to comment
Share on other sites

QUIck & dirty simple question, please...

 

I've built a formal qUIck_UILIbrary.UPK with sample testing files to try replacing default Class & Rank Icons with custom stuff of my own.

I came across this tricky UC script section in UIUtilities_Image.uc ....

 

 

========================

simulated static function string GetRankIcon(int iRank, name ClassName)
{
local string strImageName;

if (ClassName == 'PsiOperative')
{
switch (iRank)
{
case 0: strImageName = "rank_rookie"; break;
case 1: strImageName = "psirank_initiate"; break;
case 2: strImageName = "psirank_acolyte"; break;
case 3: strImageName = "psirank_adept"; break;
case 4: strImageName = "psirank_disciple"; break;
case 5: strImageName = "psirank_mystic"; break;
case 6: strImageName = "psirank_warlock"; break;
case 7: strImageName = "psirank_magus"; break;
case 8: strImageName = "rank_fieldmarshall"; break;
}
}
else
{
switch (iRank)
{
case 0: strImageName = "rank_rookie"; break;
case 1: strImageName = "rank_squaddie"; break;
case 2: strImageName = "rank_lieutenant"; break;
case 3: strImageName = "rank_sergeant"; break;
case 4: strImageName = "rank_captain"; break;
case 5: strImageName = "rank_major"; break;
case 6: strImageName = "rank_colonel"; break;
case 7: strImageName = "rank_commander"; break;
case 8: strImageName = "rank_fieldmarshall"; break;
}
}
return "img:///UILibrary_Common." $ strImageName;
}

=======================

 

Will i need to alter the above string with my qUIck_UILIbrary.HUDElements string in order to validate ANY generic valid access (by various HUD functions everywhere) to these new images as my files kept the same naming convention?? "HUDElements" being the designated folder underneath it when i packaged these images into the UPK.

 

And if so, would a copy/paste of just that small code area to a new UC file be enough (later transferable in the Src\quuUIiick\Classes folder)... instead of using the entire default file??

 

PS; That weird folder name with triple (( uuU & Iii )) is a result of my frustration with bad builds that wouldn't pick-up dashes (--) in VB formatting, btw. :wink:

Edited by Zyxpsilon
Link to comment
Share on other sites

For GREANADE ONLY slots for GRENADIERS ONLY ... I want my Rangers or Snipers have both for example Poison + Incendary Ammo ( Or they can have flashbang + Acid grenades )

I wasnt talking about number of uses for grenades =\

Edited by Belfegor
Link to comment
Share on other sites

I have been trying to get some patters for armor and weapons in but every time I launch the debugger the names of the patterns show up but as soon as I try to mouse over it I get an error.

 

Couldn't load Body part Content : EcoArt.MidModCircles ! The entry for this archetype needs to be fixed in Default Content .ini

 

This is a sample line from the config file that I added XComContent,ini Config file to

I

[XComGame.X2BodyPartTemplateManager]

+BodyPartTemplateConfig=(PartType="Patterns", TemplateName="MidModCircles", ArchetypeName="EcosArtPack.MidModCircles", bCanUseOnCivilian=false, bVeteran=true) +BodyPartTemplateConfig=(PartType="Patterns", TemplateName="MidModCirclesA", ArchetypeName="EcosArtPack.MidModCirclesA", bCanUseOnCivilian=false, bVeteran=true)

 

This is the Localization file that I added XComGame.int Text file to

[MidModCircles X2BodyPartTemplate]
DisplayName="MidModCircles"
[MidModCirclesA X2BodyPartTemplate]
DisplayName="MidModCirclesA"

 

And I added the .jpg file to the contents file

 

 

I open the editor and search packages for patterns and select one of the Archetype files from the X2_UnitPatterns and Create a Copy and rename it EcosArtPack for the package name and MidModCircles for the new name. Then I Proceed to Copy and past a second copy inside my package and give that a new name of MidModCirclesA leaving the package name untoched since its already named correctly. I then Import .png files that i made in photoshot with 2-channel compression and charater selected for the LODGroup and copy full name of those .png files to clipboard.and paste that to the the one I copied.

 

I save the upk under Doc\ModBuddy\XCom\MidModCircles\MidModCircles\Content

 

I build solution its says it loads everything with no errors. I launch the Debugger and go to customize screen and the name of tha pattern is there but when I click on it that when I gat the error message.

 

I have never done any sort of game mods btw so if might be something super easy that im just not getting and have set up the correct paths of the mod buddy to save to in the options menu.

 

Is it possible that my images are to complex somehow.

Edited by ecoclone
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...