|
Re: Скриптинг в Готике
Здравствуйте, уважаемые коллеги-скриптеры. У меня возник один вопрос. Вот есть функция-обработчик восприятия повреждения для людей - B_AssessDamage. Теперь посмотрите: ГГ бежит, видит бандита, тот с матами нападает на ГГ, начинается битва. ГГ ударил бандита и независимо от того, парирован удар вызывается функция B_AssessDamage, где бандит будет жертвой (self) а ГГ агрессором (other). Теперь роли сменились: бандит наносит удар ГГ. В этом случае жертва ГГ (self), а агрессор бандит (other). Я прав, ничего не упустил?
Проблема моя заключается в том, что когда ГГ выступает в роли агрессора все идет по задуманному мной сценарию, а вот когда в роли агрессора выступает бандит, моя функция не работает.
Вот функция:
var c_item weap; var c_item armor; var int hasweapon; var int hasfar; var int hasarmor;
func void B_ItemDurability(var C_Npc slf, var C_Npc oth) { hasweapon = false; hasfar = false; hasarmor = false; if (Npc_IsInFightMode(oth, FMODE_MELEE)) { weap = Npc_GetReadiedWeapon(oth); hasweapon = true; } else if (Npc_IsInFightMode(oth, FMODE_FAR)) { hasfar = true; }; if (Npc_HasEquippedArmor(slf) == True) { armor = Npc_GetEquippedArmor(slf); hasarmor = true; }; if ((hasweapon == true) && (hasarmor == true)) { if (weap.material == MAT_WOOD) && (armor.material == MAT_LEATHER) { if (weap.hp_max != IMMUNE) { weap.hp -= hlp_random(3); }; armor.hp -= hlp_random(4); } else if (weap.material == MAT_METAL) && (armor.material == MAT_LEATHER) { if (weap.hp_max != IMMUNE) { weap.hp -= hlp_random(2); }; armor.hp -= hlp_random(6); } else if (weap.material == MAT_WOOD) && (armor.material == MAT_METAL) { if (weap.hp_max != IMMUNE) { weap.hp -= hlp_random(5); }; armor.hp -= hlp_random(3); } else if (weap.material == MAT_METAL) && (armor.material == MAT_METAL) { if (weap.damagetype == DAM_BLUNT) { if (weap.hp_max != IMMUNE) { weap.hp -= hlp_random(3); }; armor.hp -= hlp_random(3); } else { if (weap.hp_max != IMMUNE) { weap.hp -= hlp_random(4); }; armor.hp -= hlp_random(5); }; } else { weap.hp -= hlp_random(2); armor.hp -= hlp_random(2); }; } else if ((hasweapon == true) && (hasarmor == false)) { if (weap.hp_max != IMMUNE) { if (slf.guild == GIL_ORC) { weap.hp -= hlp_random(5); } else if (slf.guild == GIL_MINECRAWLER) { weap.hp -= hlp_random(7); } else if ((slf.guild == GIL_STONEGOLEM) || (slf.guild == GIL_FIREGOLEM) || (slf.guild == GIL_ICEGOLEM)) { if (weap.damagetype != DAM_BLUNT) { weap.hp -= hlp_random(16); } else { weap.hp -= hlp_random(4); }; } else { weap.hp -= hlp_random(3); }; }; } else if ((hasfar == true) && (hasarmor == true)) { armor.hp -= hlp_random(3); }; if ((hasweapon = true) && (weap.hp <= 0) && (weap.hp_max != IMMUNE)) { AI_UnequipWeapons(oth); NPC_RemoveInvItem(oth, weap); print("Мое оружие разбилось!!!"); } else if ((hasweapon = true) && (weap.hp > 0) && (weap.hp_max != IMMUNE)) { weap.DamageTotal = (weap.hp * weap.DamageTotal) / weap.hp_max; weap.Value = (weap.hp * weap.Value) / weap.hp_max; if (((weap.hp * 100) / weap.hp_max) >= 90) { weap.text[0] = ConcatStrings("Оружие в отличном состоянии!", B_BuildItemsString(weap.hp, weap.hp_max)); } else if (((weap.hp * 100) / weap.hp_max) >= 70) { weap.text[0] = ConcatStrings("Оружие в хорошем состоянии!", B_BuildItemsString(weap.hp, weap.hp_max)); } else if (((weap.hp * 100) / weap.hp_max) >= 40) { weap.text[0] = ConcatStrings("Оружие в плохом состоянии!", B_BuildItemsString(weap.hp, weap.hp_max)); } else if (((weap.hp * 100) / weap.hp_max) >= 20) { weap.text[0] = ConcatStrings("Оружие в ужасном состоянии!", B_BuildItemsString(weap.hp, weap.hp_max)); } else if (((weap.hp * 100) / weap.hp_max) >= 1) { weap.text[0] = ConcatStrings("Этим оружием не стоит сражаться!", B_BuildItemsString(weap.hp, weap.hp_max)); }; }; if ((hasarmor = true) && (armor.hp <= 0)) { AI_UnequipArmor(slf); NPC_RemoveInvItem(slf, armor); print("Враг разбил мой доспех!!!"); } else if ((hasarmor = true) && (armor.hp > 0)) { armor.protection[PROT_EDGE] = (armor.hp * armor.protection[PROT_EDGE]) / armor.hp_max; armor.protection[PROT_BLUNT] = (armor.hp * armor.protection[PROT_BLUNT]) / armor.hp_max; armor.protection[PROT_POINT] = (armor.hp * armor.protection[PROT_POINT]) / armor.hp_max; armor.protection[PROT_FIRE] = (armor.hp * armor.protection[PROT_FIRE]) / armor.hp_max; armor.protection[PROT_MAGIC] = (armor.hp * armor.protection[PROT_MAGIC]) / armor.hp_max; armor.Value = (armor.hp * armor.Value) / armor.hp_max; if (((armor.hp * 100) / armor.hp_max) >= 90) { armor.text[0] = ConcatStrings("Доспех в отличном состоянии!", B_BuildItemsString(armor.hp, armor.hp_max)); } else if (((armor.hp * 100) / armor.hp_max) >= 70) { armor.text[0] = ConcatStrings("Доспех в хорошем состоянии!", B_BuildItemsString(armor.hp, armor.hp_max)); } else if (((armor.hp * 100) / armor.hp_max) >= 40) { armor.text[0] = ConcatStrings("Доспех в плохом состоянии!", B_BuildItemsString(armor.hp, armor.hp_max)); } else if (((armor.hp * 100) / armor.hp_max) >= 20) { armor.text[0] = ConcatStrings("Доспех в ужасном состоянии!", B_BuildItemsString(armor.hp, armor.hp_max)); } else if (((armor.hp * 100) / armor.hp_max) >= 1) { armor.text[0] = ConcatStrings("В этом доспехе не стоит сражаться!", B_BuildItemsString(armor.hp, armor.hp_max)); }; }; }; //Copyright Finsternis.
Может я неправильно сформулировал вопрос, но не примите мой пост за флудЪ. Я не знаю в чем ошибка, но когда по ГГ бьют, у его доспехов не отнимается ничего.
Заранее спасибо за ответЪ.
Добавление от 11/19/05, в 23:37:21 Ой, забыл. Вот еще одна функция:
func string B_BuildItemsString (var int BIShp, var int BIShp_max) { var string concatText; concatText = ConcatStrings (" Прочность: ", IntToString (BIShp)); concatText = ConcatStrings (concatText, " из "); concatText = ConcatStrings (concatText, IntToString (BIShp_max)); return concatText; };
|