Page 184 of 396

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 28, 2017 7:13 pm
by Zo Kath Ra
kelly1111 wrote:Quick Qestion: Has anyone ever converted the scripts for the "bouncing chakram" from grimrock 1, and if so, are they willing to share their code?
Thanks for letting me know that this exists :)
viewtopic.php?f=14&t=4798

Have you asked the creator if he's willing to port it to LoG2?

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 28, 2017 7:21 pm
by Zo Kath Ra
THOM wrote:
kelly1111 wrote:Quick Qestion: Has anyone ever converted the scripts for the "bouncing chakram" from grimrock 1, and if so, are they willing to share their code?
I have never encountered a coverted version. And AFAIK the code of it was never bug free.

But maybe someone did a new version secretly?
What kinds of bugs?
I've tried the latest version, and it seems to work fine.
(please answer in the Bouncing Chakram thread)

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 28, 2017 7:59 pm
by minmay
CrEaToXx wrote:
onRecomputeStats is called every frame, so the champion to whom this applies will have their skill points set to 2 or 3 every frame.
Then why doesn't this happen for stats as well?
It does happen for stats as well.

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 28, 2017 8:35 pm
by CrEaToXx
minmay wrote:
CrEaToXx wrote:
onRecomputeStats is called every frame, so the champion to whom this applies will have their skill points set to 2 or 3 every frame.
Then why doesn't this happen for stats as well?
It does happen for stats as well.
Ok, I got the checker bug fixed. But isn't there a solution for giving skill extra points during character creation? Something like addSkillModifier?

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 28, 2017 9:01 pm
by minmay
I think you fundamentally misunderstand what addStatModifier does.
All stats have both a "base" value and a "current" value. Every time stats are recomputed (which is basically once every frame), the "current" value is reset to the "base" value. Then onRecomputeStats hooks are called and addStatModifier adds to the "current" value, and bonuses from equipment, rage, etc. are also added to the "current" value. The "base" value is unaffected by this.
There's no equivalent system for skill points - skill points are just one number.

If you want to add extra skill points during character creation, it's possible but you'll need to do something very hacky and unpleasant - e.g. keep track of a separate variable that notes whether you've given the skill point(s) or not, and you'll have to remember to take the extra skill points away if the player changes the character's race, and you have to decide what to do if they change race after already spending the skill point, etc...

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 28, 2017 9:13 pm
by CrEaToXx
minmay wrote:I think you fundamentally misunderstand what addStatModifier does.
All stats have both a "base" value and a "current" value. Every time stats are recomputed (which is basically once every frame), the "current" value is reset to the "base" value. Then onRecomputeStats hooks are called and addStatModifier adds to the "current" value, and bonuses from equipment, rage, etc. are also added to the "current" value. The "base" value is unaffected by this.
There's no equivalent system for skill points - skill points are just one number.

If you want to add extra skill points during character creation, it's possible but you'll need to do something very hacky and unpleasant - e.g. keep track of a separate variable that notes whether you've given the skill point(s) or not, and you'll have to remember to take the extra skill points away if the player changes the character's race, and you have to decide what to do if they change race after already spending the skill point, etc...
Is it possible to add a hidden characterclass via race selection during character creation then? This way I could use the CC as hack in order to applie the skill point.

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 28, 2017 9:41 pm
by zimberzimber
May I suggest an alternative?
Instead of adding the skill point on the character creation screen, you could use the description of the race to tell the player they will get an extra skill point when the game begins.
When the game begins, have a loop run through all the heroes, check for their race, and increment it by 1.
Sure, the player won't be able to invest that point directly from the party creation screen, but its a small price to pay.

Re: Ask a simple question, get a simple answer

Posted: Sat Jan 28, 2017 10:19 pm
by AndakRainor
The bonus effect of this method would be that this skill point can be used to start with a rank 2 skill :)

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 29, 2017 12:03 am
by zimberzimber
AndakRainor wrote:The bonus effect of this method would be that this skill point can be used to start with a rank 2 skill :)
True, didn't think of that.
Nothing wrong with that in my opinion.

Re: Ask a simple question, get a simple answer

Posted: Sun Jan 29, 2017 12:21 am
by CrEaToXx
Ok, so I made a script entity placed besides the starting cage and connected it to a wall button for testing purpose, but pressing the button gives me a "invalid script blablabla function" in console when testing in game. Here's the code:

---wrong code removed---

Edit:

Ha, fixed. There was a mistake in syntax. Code needs to look like this, and it does work on level 1 as well...

Code: Select all

function extraSkillPoints()
	for i = 1,4 do
		local cChampion = party.party:getChampion(i)
		hudPrint(tostring(cChampion:getName()))
    	local cRace = cChampion:getRace()
		hudPrint(tostring(cChampion:getRace()))	
		if cRace == "dwarf" then
			cChampion:addSkillPoints(1)			
		end
	end	
end
Now I just need to find a way to initialize the script without the press of a button. Counter? Connect the script to opening the cage gate? Any other suggestions?

Edit 2: A timer did the trick. Here are some screenshots to proof of concept...:)
SpoilerShow
Image
Image
Edit 3: Btw., before I break my head again. During CC, would it be possible to restrict certain races, if another race is already in your party?