CyberEngineTweaks
CyberEngineTweaks copied to clipboard
Find components by name
Idea: Is there a way to tell in scripting all the components the objects have?
for example, in save editor I can drop the player_female.entity and see all the components, the components can be called with the following script:
player:FindComponentByName(CName.new("TPPRepresentation")) -- Car/Body component
player:FindComponentByName(CName.new("root")) -- Animation Component
-- BUT ALSO (THIS IS FOR FEMALE PLAYER ONLY)
player:FindComponentByName(CName.new("body")) -- Mesh Component
But it would be nice if there is a function to see all the components on a certain class, not only player.
And by the why, root component have all sorts of UKNOWN TYPES
.
Also there is a BUG
in these components related to props.
For example:
local tpp = player:FindComponentByName(CName.new("TPPRepresentation"))
print(tpp.detachedObjectInfo[1].itemTDBID) -- prints "Items.PlayerFppHead" CName
tpp.detachedObjectInfo[1].itemTDBID = TweakDBID.new("Items.PlayerWaTppHead")
print(tpp.detachedObjectInfo[1].itemTDBID) -- Still prints "Items.PlayerFppHead" CName
WORKAROUND FOR NOW:
local tpp = player:FindComponentByName(CName.new("TPPRepresentation"))
local obj = NewObject('gameFppRepDetachedObjectInfo')
obj.slotID = TweakDBID.new("TppHead")
obj.itemTDBID = TweakDBID.new("Items.PlayerWaTppHead")
tpp.detachedObjectInfo = {obj}
print(tpp.detachedObjectInfo[1].itemTDBID) -- now prints "Items.PlayerWaTppHead" CName
I'll split this into two issues if you dont mind cause having enhancement and bug in one is not ideal :P
yes good idea, i hide the comment.