Last active
August 29, 2015 13:56
-
-
Save Daenks/8907442 to your computer and use it in GitHub Desktop.
Player.kod Error
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
player.kod(7972): error: Identifier group_member in expression has wrong type | |
player.kod(7975): error: Identifier group_member in expression has wrong type | |
player.kod(7982): error: Identifier group_member in expression has wrong type | |
player.kod(7984): error: Identifier group_member in expression has wrong type | |
AdvancementCheck(what=$,killing_blow=TRUE,group_member_kill=FALSE) | |
"A player will need, on average, to kill a number of monsters equal to" | |
"their maxhealth to gain a HP. This number is reduced by the player's" | |
"stamina, all the way down to half for those with high staminas." | |
{ | |
local highmark, rand, dodgeskill, oSkill, monster_level, gain, gainmult, roll, iNumber, oWeapon, lBuilderGroup; | |
gain = 0; | |
roll = FALSE; | |
% Some things just never allow advancement. | |
% Can advance in arena if realdeath is on in an arena. | |
if NOT Send(what,@CanPlayerAdvanceOnMe) | |
OR Send(poOwner,@CheckRoomFlag,#flag=ROOM_SAFE_DEATH) | |
OR (Send(poOwner,@IsArena) AND NOT Send(poOwner,@ArenaRealDeath)) | |
{ | |
return FALSE; | |
} | |
Post(self,@DrawHPChance); | |
if IsClass(what,&User) | |
{ | |
monster_level = Send(what,@GetBaseMaxHealth); | |
} | |
else | |
{ | |
monster_level = Send(what,@GetLevel); | |
} | |
if (Send(self,@CheckPlayerFlag,#flag=PFLAG_DID_DAMAGE) | |
AND poKill_target = what) | |
OR group_member_kill | |
{ | |
if monster_level > piBase_Max_health | |
{ | |
if killing_blow AND Send(self,@CheckPlayerFlag,#flag=PFLAG_TOOK_DAMAGE) | |
{ | |
% Player took damage and landed killing blow | |
gain = 2; | |
roll = TRUE; | |
} | |
else | |
{ | |
% Player either did not take damage, but did killing blow (mage), | |
% or did take damage, did not land killing blow, or | |
% it's a group member kill. | |
gain = 1; | |
% No roll for kills by others. This puts tension on group size. | |
% As group sizes increase, getting kills oneself becomes difficult. | |
% Groups that are too large create their own advancement problems organically. | |
% Also, this keeps advancement based on the player himself. His own kill rate matters the most. | |
if NOT group_member_kill | |
{ | |
roll = TRUE; | |
} | |
% Inform the player that a group kill successfully garnered XP. | |
if group_member_kill | |
AND group_member <> $ | |
AND gain = 1 | |
{ | |
Send(self,@MsgSendUser,#message_rsc=group_experience_rsc,#parm1=Send(group_member,@GetName), | |
#parm2=Send(what,@GetName)); | |
} | |
% Give an informative message about non-group kills that are still shared | |
if NOT killing_blow | |
AND NOT group_member_kill | |
AND group_member <> $ | |
{ | |
Send(self,@MsgSendUser,#message_rsc=group_experience_rsc,#parm1=Send(group_member,@GetName), | |
#parm2=Send(what,@GetName)); | |
} | |
} | |
} | |
else | |
{ | |
% Monster was equal or close to player level. Small bonus, | |
% no roll chance. | |
if (monster_level + 5) > piBase_Max_health | |
AND IsClass(what,&monster) AND killing_blow | |
AND Send(self,@CheckPlayerFlag,#flag=PFLAG_TOOK_DAMAGE) | |
{ | |
gain = 1; | |
} | |
else | |
{ | |
% Monster was too easy for player to kill! | |
if random(1,100) < 30 AND killing_blow | |
{ | |
Send(self,@MsgSendUser,#message_rsc=player_spits); | |
} | |
} | |
} | |
% Give newbies a little bonus. | |
if piBase_Max_health < Send(Send(SYS, @GetSettings), @GetPKillEnableHP) | |
{ | |
gain = gain + 1; | |
} | |
else | |
{ | |
% Give solo pkill-enabled builders a little bonus. | |
% This will roughly equal building with one other player in the room. | |
% Bonus requires that the player is fighting normally (no firewalls / distance killing) | |
lBuilderGroup = Send(Send(self,@GetOwner),@GetBuilderGroup); | |
if lBuilderGroup <> $ | |
AND Length(lBuilderGroup) = 1 | |
AND NOT group_member_kill | |
AND killing_blow | |
AND Send(self,@CheckPlayerFlag,#flag=PFLAG_TOOK_DAMAGE) | |
{ | |
gain = gain + 1; | |
} | |
} | |
% If they're cheesing the situation by fighting wussy monsters in an altered form, | |
% penalize the gain amount. | |
if piMax_health > piBase_Max_health * 2 | |
AND monster_level < piMax_health | |
{ | |
gain = gain / 2; | |
roll = FALSE; | |
} | |
gainmult = bound(Send(Send(SYS, @GetSettings), @GetHPGainMultiplier),1,500); | |
gain = gain * gainmult; | |
If IsClass(Send(self,@GetOwner),&InstanceRoom) | |
{ | |
gain = gain * Send(Send(self,@GetOwner),@GetExperienceMod); | |
} | |
piGain_chance = piGain_chance + gain; | |
if roll | |
{ | |
highmark = Send(self,@GetHighMark); | |
rand = random(1,highmark); | |
iNumber = Send(self,@GetGainChance) + bound((monster_level-piBase_Max_health)/5,0,10); | |
if rand < iNumber | |
AND piBase_Max_health < (101 + Send(self,@GetStamina)) | |
{ | |
Send(self,@GainBaseMaxHealth,#amount = 1); | |
if Send(self,@CheckLog) | |
{ | |
Debug("LOG: ",vrName," gained a health point: ", | |
piMax_health,pibase_max_health); | |
} | |
Send(self,@evaluatepkstatus); | |
Send(self,@MsgSendUser,#message_rsc=player_improve_maxhealth); | |
Send(self,@WaveSendUser, #what=self, #wave_rsc=player_tougher_wav_rsc); | |
Send(self,@MsgSendUser,#message_rsc=player_improve_health_invigorate); | |
piHealth = piMax_Health; | |
Send(self,@DrawHealth); | |
Send(self,@EatSomething,#nutrition=200); | |
piGain_chance = -(piBase_Max_health/2); | |
if piBase_max_health > 30 | |
{ | |
%stam = 50 | |
%pigain = pigain - ((50-50)/2) = pigain - 0 | |
%stam = 25 | |
%pigain = pigain - ((50-25)/2) = pigain - 12.5 | |
% so, after 30 hps, any stamina less thatn 50 penalizes you by about 0.5 piGain points | |
piGain_chance = piGain_chance - ((50-Send(self,@GetStamina))/2); | |
} | |
return TRUE; | |
} | |
} | |
} | |
if Send(self,@CheckPlayerFlag,#flag=PFLAG_DODGED) | |
AND NOT group_member_kill | |
{ | |
oWeapon = Send(self,@LookupPlayerWeapon); | |
if oWeapon <> $ | |
AND (not IsClass(oWeapon,&RangedWeapon)) | |
AND Send(self,@HasSkill,#num=SKID_PARRY) | |
AND Send(self,@GetSkillAbility,#skill_num=SKID_PARRY) < 99 | |
{ | |
oSkill=Send(SYS,@FindSkillByNum,#num=SKID_PARRY); | |
Send(oSkill,@ImproveAbility,#who=self,#target=poKill_Target); | |
} | |
if (Send(self,@LookupPlayerShield) <> $) | |
AND Send(self,@HasSkill,#num=SKID_BLOCK) | |
AND Send(self,@GetSkillAbility,#skill_num=SKID_BLOCK) < 99 | |
{ | |
oSkill=Send(SYS,@FindSkillByNum,#num=SKID_BLOCK); | |
Send(oSkill,@ImproveAbility,#who=self,#target=poKill_Target); | |
} | |
if Send(self,@HasSkill,#num=SKID_DODGE) | |
AND Send(self,@GetSkillAbility,#skill_num=SKID_DODGE) < 99 | |
{ | |
oSkill=Send(SYS,@FindSkillByNum,#num=SKID_DODGE); | |
Send(oSkill,@ImproveAbility,#who=self,#target=poKill_Target); | |
} | |
} | |
return FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment