Trigger for adopting new personality trait

Starrynite120

Prince
Joined
Jul 15, 2015
Messages
472
Does anyone know if there is a trigger for when you adopt a new personality trait? I know there isn't a trigger for adopting a playerperk, but I thought there's a possibility it could be different for personality traits.
 
Events.PersonalityTraitAdded.Add();
Events.PersonalityTraitRemoved.Add();
Events.PersonalityTraitLeveledUp.Add();

As found in TraitsOverview.lua.

Those are however Events, not GameEvents, and meant to handle UI-Elements - they can sometimes act funny, so you'll need to look for yourself whether you can use them for whatever you want to do.

PersonalitySystem.lua has a function for Events.PersonalityTraitRemoved.Add() which shows that it "transports" varables for the PlayerType and the TraitType, that's probably true for the other Events as well, but you'd need to check that yourself:

Code:
function OnPersonalityTraitRemoved(playerType : number, traitType : number)
	local playerTraits : table = g_PlayerTraitScripts[playerType];
	if(playerTraits ~= nil) then
		for index : number, traitEntry : table in ipairs(playerTraits) do
			if(traitEntry.id == traitType) then
				table.remove(playerTraits, index);
				break;
			end
		end
	else
		print("ERROR: PersonalityTraitRemoved called on player without trait scripts!");
		AssertDueToAbove();
	end
end
Events.PersonalityTraitRemoved.Add(OnPersonalityTraitRemoved);
 
Wow, I'm kinda surprised someone actually knew this. I'm impressed. I'll have to check it out, thanks :)
 
I didn't know it, I opened Notepad++, dragged the Lua- and UI-Folders into it and searched for some words until I found these. (;
 
Top Bottom