Jeszcze raz:
1. Funkcja trucizny.
func void Regeneracja()
{
//Regeneracja
if (hero.attribute[ATR_HITPOINTS] > 0)
{
if (level_regeneracji == 1)
{
hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] + 1;
};
if (level_regeneracji == 2)
{
hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] + 2;
hero.attribute[ATR_MANA] = hero.attribute[ATR_MANA] + 1;
};
if (level_regeneracji == 3)
{
hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] + 3;
hero.attribute[ATR_MANA] = hero.attribute[ATR_MANA] + 2;
hero.exp = hero.exp + 1;
};
if (hero.attribute[ATR_HITPOINTS]>hero.attribute[ATR_HITPOINTS_max])
{
hero.attribute[ATR_HITPOINTS]=hero.attribute[ATR_HITPOINTS_max];
};
if (hero.attribute[ATR_MANA]>hero.attribute[ATR_MANA_max])
{
hero.attribute[ATR_MANA]=hero.attribute[ATR_MANA_max];
};
};
//Trucizna
if (WillZatruty > 0)
{
if (WillZatruty == 1)
{
hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] - 1;
};
if (WillZatruty == 2)
{
hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] - 2;
};
if (WillZatruty == 3)
{
hero.attribute[ATR_HITPOINTS] = hero.attribute[ATR_HITPOINTS] - 3;
};
};
};
2. Odtrutka.
// ***** ***** ***** ***** ***** ***** ***** ***** ***** *****
INSTANCE ItNa_Odtrutka(C_Item)
{
name = NAME_Trank;
mainflag = ITEM_KAT_POTIONS;
flags = ITEM_MULTI;
value = 50;
visual = "ItPo_Perm_STR.3ds";
material = MAT_GLAS;
on_state[0] = UseOdtrutka;
scemeName = "POTIONFAST";
wear = WEAR_EFFECT;
effect = "SPELLFX_ITEMGLIMMER";
description = "Odtrutka";
TEXT[1] = "Zwalcza każdą truciznę.";
TEXT[5] = NAME_Value;
COUNT[5] = 50;
};
FUNC VOID UseOdtrutka()
{
WillZatruty = FALSE;
};
3. BeliarWeapon
func void TruciznaFunction ()
{
WillZatruty = 1;
PrintScreen ("zatruty", -1,-1, "font_old_20_white.tga",3);
};
func void B_BeliarsWeaponSpecialDamage (var C_NPC oth, var C_NPC slf) //other ist angreifer, slf ist victim
{
if (Hlp_GetInstanceID(oth) == Hlp_GetInstanceID(hero))
{
var int DamageRandy;
DamageRandy = Hlp_Random (100);
if (C_ScHasReadiedBeliarsWeapon())
&& (DamageRandy <= BeliarDamageChance)
{
if (slf.aivar[AIV_MM_REAL_ID] == ID_DRAGON_UNDEAD) //beim untoten Drachen nimmt der SC Schaden
{
Wld_PlayEffect("spellFX_BELIARSRAGE", oth, oth, 0, 0, 0, FALSE );
B_MagicHurtNpc (slf, oth, 100);
}
else if (slf.flags != NPC_FLAG_IMMORTAL)
{
Wld_PlayEffect("spellFX_BELIARSRAGE", slf, slf, 0, 0, 0, FALSE );
B_MagicHurtNpc (oth, slf, 100);
};
//Ambient Pfx
Wld_PlayEffect("spellFX_BELIARSRAGE_COLLIDE", hero, hero, 0, 0, 0, FALSE );
};
if (C_ScHasReadiedBeliarsWeapon())
&& (DamageRandy <= 50) // Effekt
{
//Ambient Pfx
Wld_PlayEffect("spellFX_BELIARSRAGE_COLLIDE", hero, hero, 0, 0, 0, FALSE );
};
};
//Strzaly
if (Npc_HasReadiedRangedWeapon(hero))
&& (Hlp_GetInstanceID (oth) == Hlp_GetInstanceID (hero))
{
var C_ITEM Weapon;
Weapon = Npc_GetReadiedWeapon (oth);
if (SpecialArrow == 1)
{
Wld_PlayEffect ("spellFX_RingRitual1", slf, slf, 0, 0, 0, FALSE);
B_MagicHurtNpc (oth, slf, 95);
};
if (SpecialArrow == 2)
{
B_MagicHurtNpc (oth, slf, 45);
};
if (SpecialArrow == 3)
{
Wld_PlayEffect ("spellFX_IceCube", slf, slf, 0, 0, 0, FALSE);
Wld_PlayEffect ("spellFX_IceCube_COLLIDE", slf, slf, 0, 0, 0, FALSE);
Wld_PlayEffect ("spellFX_Icespell_COLLIDEDYNFX", slf, slf, 0, 0, 0, FALSE);
AI_StartState (slf, ZS_MagicFreeze, 0, "");
B_MagicHurtNpc (oth, slf, 65); //115 Schaden reicht genau für einen Lurker.
};
};
//Zatruwanie
if (Hlp_GetInstanceID(slf) == Hlp_GetInstanceID(hero))
{
TruciznaFunction();
};
};
To wszystkie skrypty odpowiadające za truciznę.
Funkcja się wywołała, jeśli pojawia się napis 'zatruty'. I teraz tak: cokolwiek mnie zrani (slf to ofiara - czyli jeśli ofiarą jest hero), to wywołuje się funkcja TruciznaFunction. I to działa. Cokolwiek mnie zrani, to hero odejmuje co chwilę jeden punkt HP i jest napis. Piję odtrutkę. Funkcja ustawia się na FALSE. Nie odejmuje już HP.
Idę dalej... atakują mnie zwierzęta i nic. A powinno znowu wywoływać BeliarDamage, czyli też funkcję TruciznaFunction. Chciałbym wiedzieć dlaczego to mi się nie wywołuje i jak sprawić, żeby wywoływało się ponownie...