maximegmd / CyberEngineTweaks

Cyberpunk 2077 tweaks, hacks and scripting framework
MIT License
4.5k stars 286 forks source link

Reset attribute points function/script? #265

Closed DanielWidmayer closed 3 years ago

DanielWidmayer commented 3 years ago

Is there a possibility to reset attribute/skill points (not perks) with console commands?

I think this is a huge issue many players face within the game and it would be a nice functionality.

NielsGx commented 3 years ago

Just give you 100k money, then buy the respec consumable available in all medic merchants. Or directly give you the consumable with the console

willuwontu commented 3 years ago

you'd need to get the stat values for each attribute, but something like this could work

-- Reset spent perk points to avoid any issues that may accompany stat changes and having perks higher than should be available.
Game.AddItems("Items.PerkPointsResetter",1)

-- a variable to set the size of a our attribute point pool
local points = 0
-- Get each stat value and increase points by the difference between their value and 3
-- Alternately get the player's level and add 6 to it

-- Set each ability and its related skills back down to 3
-- We want to avoid discrepancies between Attribute level and skill level.
-- If the player doesn't wish to lose skill levels, sucks to be them. They'll have to set them manually later using SetLevel()
Game.SetAtt("Cool",3)
Game.SetLevel("ColdBlood", 3)
Game.SetLevel("Stealth", 3)

Game.SetAtt("Reflexes",3)
Game.SetLevel("Gunslinger", 3)
Game.SetLevel("Kenjutsu", 3)
Game.SetLevel("Assault", 3)

Game.SetAtt("TechnicalAbility",3)
Game.SetLevel("Crafting", 3)
Game.SetLevel("Engineering", 3)

Game.SetAtt("Intelligence",3)
Game.SetLevel("Hacking", 3)
Game.SetLevel("CombatHacking", 3)

Game.SetAtt("Strength",3)
Game.SetLevel("Athletics", 3)
Game.SetLevel("Demolition", 3)
Game.SetLevel("Brawling", 3)

-- Give out the attribute points
Game.GiveDevPoints("Attribute", points)
DanielWidmayer commented 3 years ago

willuwontu wrote: you'd need to get the stat values for each attribute, but something like this could work ...

Very nice approach!

For me Game.AddItems doesn't work and I had to use Game.AddToInventory("Items.PerkPointsResetter", 1)

It would be nice if there was a functionality to automatically get/count the current attribute points and giving that amount with Game.GiveDevPoints to the user automatically. As you stated you would then need to either read each attributes level (Strenght, Cool, Intelligence,...) and sum them up and subtract 15 or read the users level and add 6. Why 6? Because in the beginning on level 1 each attribute has the level 3 and you get 7 attribute points to spend where one of them is included for the level. (total attribute points = 5 * 3 + 6 + level)

DanielWidmayer commented 3 years ago

I am now trying to automatically get the Level to fully automate the script. When using Game.PrintProfs() it prints the Level and further information to console but I need it as a number as return value.

Then I tried to directly get the Level and Profs with print(Game.Level) but that returns: sol.Scripting::InternalIndex::<lambda_1>: 000001D3D97FE928 and I don't really know how to handle that.

Can somebody help me out here or knows another way to retrieve the Level for further use in a script?

Namizo88 commented 3 years ago

So, I did start trying a respec script a couple of days ago (before someone did mention this page to me, so sorry if it feels redundant) Here's the script: Game.AddToInventory("Items.PerkPointsResetter",1) Game.AddExp("Athletics", 500) Game.AddExp("Brawling", 500) Game.AddExp("Demolition", 500) Game.AddExp("Assault", 500) Game.AddExp("Gunslinger", 500) Game.AddExp("Kenjutsu", 500) Game.AddExp("Crafting", 500) Game.AddExp("Engineering", 500) Game.AddExp("Hacking", 500) Game.AddExp("CombatHacking", 500) Game.AddExp("Stealth", 500) Game.AddExp("ColdBlood", 500) Game.SetAtt("Strength", 3) Game.SetAtt("Reflexes", 3) Game.SetAtt("TechnicalAbility", 3) Game.SetAtt("Intelligence", 3) Game.SetAtt("Cool", 3) Game.SetLevel("Athletics", 1) Game.SetLevel("Brawling", 1) Game.SetLevel("Demolition", 1) Game.SetLevel("Assault", 1) Game.SetLevel("Gunslinger", 1) Game.SetLevel("Kenjutsu", 1) Game.SetLevel("Crafting", 1) Game.SetLevel("Engineering", 1) Game.SetLevel("Hacking", 1) Game.SetLevel("CombatHacking", 1) Game.SetLevel("Stealth", 1) Game.SetLevel("ColdBlood", 1) Game.GiveDevPoints("Attribute", 7)

Explanations: 1) I wanted to have a FULL respec, which meant skills at lv 1, also added a tabula rasa to remove the perks 2) I discovered that changing skill levels mid-level 1-2 don't work, as such I added 500 XP (the requirement to lv to lv2 skill) 3) Sadly that adds the perk points bonus of lv 1-2 4) Added the starting 7 attribute points from character creation Things to do: Find a way to remove bonus perk points (maybe a command that subtracts all of them?) Add perk and attribute points directly proportional to levels (1*lv up, levels 2 to lv cap, sorry Idk which lv that is) Maybe add the clear equipment command (so cyberware that requires certain attributes doesn't get fucked up?) Maybe a command that equips the base eye, hands, and cyberdeck (so the game doesn't get fucked up again?)

Soloplayersama commented 3 years ago

you'd need to get the stat values for each attribute, but something like this could work

-- Reset spent perk points to avoid any issues that may accompany stat changes and having perks higher than should be available.
Game.AddItems("Items.PerkPointsResetter",1)

-- a variable to set the size of a our attribute point pool
local points = 0
-- Get each stat value and increase points by the difference between their value and 3
-- Alternately get the player's level and add 6 to it

-- Set each ability and its related skills back down to 3
-- We want to avoid discrepancies between Attribute level and skill level.
-- If the player doesn't wish to lose skill levels, sucks to be them. They'll have to set them manually later using SetLevel()
Game.SetAtt("Cool",3)
Game.SetLevel("ColdBlood", 3)
Game.SetLevel("Stealth", 3)

Game.SetAtt("Reflexes",3)
Game.SetLevel("Gunslinger", 3)
Game.SetLevel("Kenjutsu", 3)
Game.SetLevel("Assault", 3)

Game.SetAtt("TechnicalAbility",3)
Game.SetLevel("Crafting", 3)
Game.SetLevel("Engineering", 3)

Game.SetAtt("Intelligence",3)
Game.SetLevel("Hacking", 3)
Game.SetLevel("CombatHacking", 3)

Game.SetAtt("Strength",3)
Game.SetLevel("Athletics", 3)
Game.SetLevel("Demolition", 3)
Game.SetLevel("Brawling", 3)

-- Give out the attribute points
Game.GiveDevPoints("Attribute", points)

I just wanted to say I used this a reference not to make a script but to fix my character manually, so thanks! <3.