Friday, May 19, 2006

Skill Checking

Welp, I'm going to start posting my code. What the heck. I'll share it.

Anyway, I'm starting with my skill check system. Basically, I think it's messed up.

I'm running a POL095 server. I do not use the core CheckSkill function, but a syshook_checkskill.src.


use uo;
use os;
use util;

include "include/attributes";
include "include/client";


program SyshookCheckSkill ( )

Syslog ( "Installing skillcheck..." );
return 1;

endprogram

exported function NewCheckSkill ( character, skillid, difficulty, points )

var attribute := GetAttributeIDBySkillID ( skillid );

Print ( "The Attribute is: " + attribute );

var player_Skill := GetAttribute ( character, attribute );
var deniedTest := BaseToRaw ( player_Skill );
var skillCheck;

Print ( "The skill used is: " + player_Skill );
Print ( "Your Raw Skill is: " + deniedTest );

if ( deniedTest == 0 )
SendSysMessage ( character, "You are untrained in this area." );
return 0;
endif

if ( player_Skill < 13 )
skillCheck := 13;
else
skillCheck := player_Skill;
endif


if ( skillCheck <= ( difficulty - 5 ) )
return 0;
elseif ( skillCheck >= ( difficulty + 15 ) )


var charMaxAttribute := ( "max" + attribute );
var maxSkill := GetObjProperty ( character, charMaxAttribute );
var rawMaxSkill := BaseToRaw ( maxSkill );

rawMaxSkill := ( rawMaxSkill + 1 );

var currentRawSkill := BaseToRaw ( player_Skill );
var possibleNewRawSkill := ( currentRawSkill + 1);

if ( rawMaxSkill > possibleNewRawSkill )
AwardRawSkill ( character, attribute, 1 );
StatIncrease ( character, attribute );
endif

return 1;
else

var dieRoll := ( skillCheck + 20 );

dieRoll := RandomInt ( dieRoll );

if ( dieRoll <= skillCheck )

var charMaxAttribute := ( "max" + attribute );
var maxSkill := GetObjProperty ( character, charMaxAttribute );
var rawMaxSkill := BaseToRaw ( maxSkill );

rawMaxSkill := ( rawMaxSkill + 1 );

var currentRawSkill := BaseToRaw ( player_Skill );
var possibleNewRawSkill := ( currentRawSkill + 1);

if ( rawMaxSkill > possibleNewRawSkill )
AwardRawSkill ( character, attribute, 1 );
StatIncrease ( character, attribute );
endif

return 1;
else
return 0;
endif

endif

endfunction

0 Comments:

Post a Comment

<< Home