Attributes & GainSystem Fix

Archive of posts related to former distro versions. Be aware that posts here do not refer to the current distro and may not work.
Locked
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Attributes & GainSystem Fix

Post by *Edwards »

Headache cuz I can't find the answer now after different tests. I can't find why I train a skill to 0.7% and stuck. It doesn't increase at all after 0.7%. I tested with official pol097distro that is published today 2008-03-26. I'm wondering if there is someone else using this version so we could verify if it is me or not. I understand the gain system and thus I added a check to tell me once the skill has increase:

Code: Select all

SkillDbgMsg(mobile, "Passed. Advance "+skill_name+": "+advance);

	var temp := true_skill + advance;
        AP_SetTrueSkill(mobile, skill_name, temp);
	var change := AP_GetTrueSkill(mobile, skill_name);
        SkillDbgMsg(mobile, skill_name+" is now: "+change);
With this code once used I get a message like:

Passed. Advance anatomy: 0.1
Anatomy is now: 0.7
And of course I pass every time and it gives me that message but the skill still and always 0.7% maximum.... Does anyone could give me an answer?
Last edited by *Edwards on Fri Mar 28, 2008 7:32 pm, edited 1 time in total.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

Just like this, Does this happen to everyone or only me?
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

I am not sure where your problem is.
I took the distro combat system and re-wrote it to fit my shard so I can't pinpoint your problem.

The SkillDbgMsg message only reports the advance.

I'd suggest you take a look at the attributes package and especially the CheckSkillAdvance function and the SkillCheck function to see if there is any gain supposed to happen.

There are a few SkillDbgMsg messages in there that would tell you if the cap was reached or it was too hard or too easy or if settings are getting in the way - eg FreeGainUntil
Perhaps take a look at attributes\config\settings.cfg to see if they make sense.

Overall though, I think the attributes system is pretty good, but I haven't used it as it stands.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

It's the same over here but anyway I took a break of it and wanted to know if I were the only one. If I find something wrong I'll notice here. Thanks anyway OldNGrey. Enjoy your stay and remember our beer? ;)
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

Just created a command:

Command .test

Code: Select all

use uo;

include ":attributes:attributes_ex";
include ":skilllocks:common";


Program ChecrSkill(mobile)

        var advance := 0.1;
        var true_skill := AP_GetTrueSkill(mobile, TACTICS);
	var temp := true_skill + advance;
        AP_SetTrueSkill(mobile, TACTICS, temp);
	var change := AP_GetTrueSkill(mobile, TACTICS);
endprogram
I can gain at 0.7 without problems using .test but if I have 0.7 and use .test it doesn't increase at all... It's really strange.

I understand attributes with pol097 but I can't find the answer to this question... Need help :\
User avatar
Austin
Former Developer
Posts: 621
Joined: Wed Jan 25, 2006 2:30 am

Post by Austin »

Probably is related to the core floating point precision problem.

There is a while loop in the skill gain code that has a kludge for that.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

Oh that's right Austin. I remember seeing that too before I put in the rounding up fix.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

Forget it...
Last edited by *Edwards on Mon Apr 07, 2008 4:43 pm, edited 1 time in total.
User avatar
MontuZ
Forum Regular
Posts: 338
Joined: Fri Feb 10, 2006 8:08 am

Post by MontuZ »

Didn't test, but I'm bored, :D
var temp := (stat_value + advance);

if ( temp == AP_GetTrueStat(mobile, stat_name) )
temp *= 10;
temp += 1;
temp := CDbl(temp / 10);
endif
OR..
var temp := (stat_value + advance);

if ( temp == AP_GetTrueStat(mobile, stat_name) )
temp := (CDbl((temp * 10) + 1) / 10);
endif
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

Just sent my precision because the original file don't even fix the main problem. Also if you look closely to the skill function "while loop" it was looking for AP_GetTrueStat instead of GetTrueSkill...
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

Still not working at all using lastest distro and core.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

I don't know if anything has been fixed for it but it is not working.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

Code: Select all

Probably is related to the core floating point precision problem.

There is a while loop in the skill gain code that has a kludge for that.
Austin it's been a long time already and it still doesn't work...

The distro is burned at the stake if people can't increase a skill... Well, I'm not forcing anyone just trying to find a way to fix it.

Does someone else use core097? Do they have problems with the gains? For my part using distro097 and even with the kludge it doesn't work....
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

I got the skill gain to work with the distro functions and found that skill didn't gain past 0.7 either. This was a while ago.

I re-wrote functions to be something like this:

Code: Select all

function AP_SetTrueSkill(mobile, attributeid, points)
	var success := 0;
	if ( points >= 0 )
		success := SetAttributeBaseValue(mobile, attributeid, CInt(CDbl(points) * 10.0 + 0.1));
	else
		success := SetAttributeBaseValue(mobile, attributeid, CInt(CDbl(points) * 10.0 - 0.1));
	endif
	return success;
endfunction
It worked for me but it looks so crude. I sent this fix in to the distro team but I think Austin dropped it in favour of his own kludge.

I took my code to a live shard but then found the skill calculations were taking too long. So I removed all of the floating point calculations and went back to 10 * integer values. I have the feeling that floating point calculations are just inherently slow.
User avatar
*Edwards
Forum Regular
Posts: 303
Joined: Fri Dec 28, 2007 11:19 pm

Post by *Edwards »

I tried the kludge and still doesn't work for me. I shall now test your code, thanks man.
Locked