Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
daedalus:nuetzliches [2016/02/06 13:54] milgo |
daedalus:nuetzliches [2016/12/31 10:11] milky-way Titel hinzugefügt |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
- | === Taschendiebstahl-Dialoge für alle === | + | ====== Nützliches ====== |
+ | |||
+ | ===== Taschendiebstahl-Dialoge für alle ===== | ||
<code C> | <code C> | ||
Zeile 127: | Zeile 129: | ||
</code> | </code> | ||
- | === Mehr Gilden einfügen === | + | ===== Mehr Gilden einfügen ===== |
Constans.d-Auszug | Constans.d-Auszug | ||
Zeile 206: | Zeile 208: | ||
const int GIL_SEPERATOR_HUM = 16 ; | const int GIL_SEPERATOR_HUM = 16 ; | ||
+ | </code> | ||
Dann... Text.d Auszug | Dann... Text.d Auszug | ||
+ | |||
+ | <code C> | ||
// **************************************************************************************** | // **************************************************************************************** | ||
// Gildennamen | // Gildennamen | ||
Zeile 272: | Zeile 277: | ||
- | == Zufallsfunktion mit passenderer statistischer Verteilung == | + | ===== Zufallsfunktion mit passenderer statistischer Verteilung ===== |
<code C> | <code C> | ||
Zeile 324: | Zeile 329: | ||
</code> | </code> | ||
- | == [für Fortgeschritene] Zufällige Attribute für Npcs == | + | ===== Automatische Übertragung von Gegenständen von Opfer nach Hero ===== |
- | + | ||
- | <code C> | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | // | + | |
- | // B_SetAttributesRandom | + | |
- | // - - - - - - - - - - - - - - - - - - - - - - - - | + | |
- | // | + | |
- | // Setzt die Attribute mit Hilfe eines Zufalls. | + | |
- | // Nötig ist dafür die Stärkeklasse des Npc für Nah, Fern & Magie Kampf. | + | |
- | // | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | + | ||
- | /* | + | |
- | Zur Erinnerung - Auszug AI_Constants.d: | + | |
- | + | ||
- | Stärkeklassen für die Zufalls-Attribute | + | |
- | - - - - - - - - - - - - - - - - - - - | + | |
- | + | ||
- | const int COWARD = 0; //Lars, NK & FK der Magier | + | |
- | const int NORMAL = 1; //leichte Axt & Schwertkämpfer, Arbeiter und leichte NK Späher | + | |
- | const int STRONG = 2; //schwere Axt & Schwertkämpfer, Schwere Späher | + | |
- | const int RAISED = 3; //Wächter, Krieger, FK der Späher, Magier | + | |
- | const int MASTER = 4; //alle Anführer. | + | |
- | + | ||
- | */ | + | |
- | + | ||
- | func void B_SetAttributesRandom (var int nahKampf, var int fernKampf, var int magieKampf) | + | |
- | { | + | |
- | // - - - - - Resett for Random - - - - - - | + | |
- | Hlp_Rand_Resett(); | + | |
- | + | ||
- | var int rnd; | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | // Allgemeine Attribute | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | + | ||
- | if nahKampf == MASTER | + | |
- | || fernKampf == MASTER | + | |
- | || magieKampf == MASTER | + | |
- | { | + | |
- | self.fight_tactic = FAI_HUMAN_MASTER; | + | |
- | + | ||
- | // 40 - 60 | + | |
- | rnd = Hlp_Rand(20); | + | |
- | self.level = 40 + rnd; //nicht 0 wegen XP (10 * Level) | + | |
- | } | + | |
- | else if nahKampf == RAISED | + | |
- | || fernKampf == RAISED | + | |
- | || magieKampf == RAISED | + | |
- | { | + | |
- | self.fight_tactic = FAI_HUMAN_MASTER; | + | |
- | + | ||
- | // 30 - 50 | + | |
- | rnd = Hlp_Rand(20); | + | |
- | self.level = 30 + rnd; //nicht 0 wegen XP (10 * Level) | + | |
- | } | + | |
- | else if nahKampf == STRONG | + | |
- | || fernKampf == STRONG | + | |
- | || magieKampf == STRONG | + | |
- | { | + | |
- | self.fight_tactic = FAI_HUMAN_COWARD; | + | |
- | + | ||
- | // 20 - 40 | + | |
- | rnd = Hlp_Rand(20); | + | |
- | self.level = 20 + rnd; //nicht 0 wegen XP (10 * Level) | + | |
- | } | + | |
- | else if nahKampf == NORMAL | + | |
- | || fernKampf == NORMAL | + | |
- | || magieKampf == NORMAL | + | |
- | { | + | |
- | self.fight_tactic = FAI_HUMAN_NORMAL; | + | |
- | // 10 - 30 | + | |
- | rnd = Hlp_Rand(20); | + | |
- | self.level = 10 + rnd; //nicht 0 wegen XP (10 * Level) | + | |
- | } | + | |
- | else //Alles COWARD | + | |
- | { | + | |
- | self.fight_tactic = FAI_HUMAN_COWARD; | + | |
- | // 1 - 10 | + | |
- | rnd = Hlp_Rand(9); | + | |
- | self.level = 1 + rnd; //nicht 0 wegen XP (10 * Level) | + | |
- | + | ||
- | }; | + | |
- | + | ||
- | //- - - - - - Nach Level - - - - - - - - - | + | |
- | self.attribute[ATR_HITPOINTS_MAX] = (self.level + 1) * 10; | + | |
- | self.attribute[ATR_HITPOINTS] = self.attribute[ATR_HITPOINTS_MAX]; | + | |
- | + | ||
- | // - - - - - - XP für NSCs - - - - - - | + | |
- | self.exp = (500*[[self.level+1):2)*(self.level+1]]; | + | |
- | self.exp_next = (500*[[self.level+2):2)*(self.level+2]]; | + | |
- | + | ||
- | + | ||
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | // Nahkampf Attribute | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | + | ||
- | if nahKampf == NORMAL | + | |
- | { | + | |
- | // 10 - 60 | + | |
- | rnd = Hlp_Rand(50); | + | |
- | self.attribute[ATR_STRENGTH] = 10 + rnd; | + | |
- | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | + | |
- | + | ||
- | // 10 - 29 --> NICHTMAL 30 | + | |
- | rnd = Hlp_Rand(19); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_1H, 10 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_2H, 10 + rnd); | + | |
- | } | + | |
- | else if nahKampf == STRONG | + | |
- | { | + | |
- | // 50 - 130 | + | |
- | rnd = Hlp_Rand(80); | + | |
- | self.attribute[ATR_STRENGTH] = 50 + rnd; | + | |
- | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | + | |
- | + | ||
- | // mind. 30 - max 59 | + | |
- | rnd = Hlp_Rand(29); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_1H, 30 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_2H, 30 + rnd); | + | |
- | } | + | |
- | else if nahKampf == RAISED | + | |
- | { | + | |
- | // 120 - 180 | + | |
- | rnd = Hlp_Rand(60); | + | |
- | self.attribute[ATR_STRENGTH] = 120 + rnd; | + | |
- | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | + | |
- | + | ||
- | // 60 - 80 | + | |
- | rnd = Hlp_Rand(20); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_1H, 60 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_2H, 60 + rnd); | + | |
- | } | + | |
- | else if nahKampf == MASTER | + | |
- | { | + | |
- | // 160 - 200 | + | |
- | rnd = Hlp_Rand(40); | + | |
- | self.attribute[ATR_STRENGTH] = 160 + rnd; | + | |
- | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | + | |
- | + | ||
- | // 80 - 100 | + | |
- | rnd = Hlp_Rand(20); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_1H, 80 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_2H, 80 + rnd); | + | |
- | } | + | |
- | else | + | |
- | { | + | |
- | // max 10 | + | |
- | rnd = Hlp_Rand(9); | + | |
- | self.attribute[ATR_STRENGTH] = 1 + rnd; | + | |
- | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_1H, 1 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_2H, 1 + rnd); | + | |
- | }; | + | |
- | + | ||
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | // Fernkampf-Attribute | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | if fernKampf == NORMAL | + | |
- | { | + | |
- | // 10 - 60 | + | |
- | rnd = Hlp_Rand(50); | + | |
- | self.attribute[ATR_DEXTERITY] = 10 + rnd; | + | |
- | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | + | |
- | + | ||
- | // 10 - 29 --> NICHTMAL 30 | + | |
- | rnd = Hlp_Rand(19); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_BOW, 10 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 10 + rnd); | + | |
- | } | + | |
- | else if fernKampf == STRONG | + | |
- | { | + | |
- | // 50 - 130 | + | |
- | rnd = Hlp_Rand(80); | + | |
- | self.attribute[ATR_DEXTERITY] = 50 + rnd; | + | |
- | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | + | |
- | + | ||
- | // mind. 30 - max 59 | + | |
- | rnd = Hlp_Rand(29); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_BOW, 30 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 30 + rnd); | + | |
- | } | + | |
- | else if fernKampf == RAISED | + | |
- | { | + | |
- | // 120 - 180 | + | |
- | rnd = Hlp_Rand(60); | + | |
- | self.attribute[ATR_DEXTERITY] = 120 + rnd; | + | |
- | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | + | |
- | + | ||
- | // 60 - 80 | + | |
- | rnd = Hlp_Rand(20); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_BOW, 60 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 60 + rnd); | + | |
- | } | + | |
- | else if fernKampf == MASTER | + | |
- | { | + | |
- | // 160 - 200 | + | |
- | rnd = Hlp_Rand(40); | + | |
- | self.attribute[ATR_DEXTERITY] = 160 + rnd; | + | |
- | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | + | |
- | + | ||
- | // 80 - 100 | + | |
- | rnd = Hlp_Rand(20); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_BOW, 80 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 80 + rnd); | + | |
- | } | + | |
- | else | + | |
- | { | + | |
- | // max 10 | + | |
- | rnd = Hlp_Rand(9); | + | |
- | self.attribute[ATR_DEXTERITY] = 1 + rnd; | + | |
- | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_BOW, 1 + rnd); | + | |
- | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 1 + rnd); | + | |
- | }; | + | |
- | + | ||
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | // Magie-Attribute | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | // Vorsicht: Dieser Abschnitt setzt voraus, dass die AI an unterschiedliche Magiebenutzung angepasst ist. (zu betrachten: B_SelectSpell.d) | + | |
- | + | ||
- | // Gilt für Manchmal-Magier, zb Wächter | + | |
- | if magieKampf == NORMAL | + | |
- | { | + | |
- | self.aivar[AIV_MagicUser] = MAGIC_SOMETIMES; | + | |
- | + | ||
- | // 50 - 100 | + | |
- | rnd = Hlp_Rand(50); | + | |
- | self.attribute[ATR_MANA_MAX] = 50 + rnd; | + | |
- | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | + | |
- | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | + | |
- | + | ||
- | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 2); | + | |
- | } | + | |
- | // Gilt nur für Magier: | + | |
- | else if magieKampf == STRONG | + | |
- | { | + | |
- | self.aivar[AIV_MagicUser] = MAGIC_ALWAYS; | + | |
- | + | ||
- | // 90 - 180 | + | |
- | rnd = Hlp_Rand(90); | + | |
- | self.attribute[ATR_MANA_MAX] = 90 + rnd; | + | |
- | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | + | |
- | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | + | |
- | + | ||
- | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 3); | + | |
- | } | + | |
- | else if magieKampf == RAISED | + | |
- | { | + | |
- | self.aivar[AIV_MagicUser] = MAGIC_ALWAYS; | + | |
- | + | ||
- | // 170 - 260 | + | |
- | rnd = Hlp_Rand(90); | + | |
- | self.attribute[ATR_MANA_MAX] = 170 + rnd; | + | |
- | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | + | |
- | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | + | |
- | + | ||
- | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 4); | + | |
- | } | + | |
- | else if magieKampf == MASTER | + | |
- | { | + | |
- | self.aivar[AIV_MagicUser] = MAGIC_ALWAYS; | + | |
- | + | ||
- | // 250 - 300 | + | |
- | rnd = Hlp_Rand(50); | + | |
- | self.attribute[ATR_MANA_MAX] = 250 + rnd; | + | |
- | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | + | |
- | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | + | |
- | + | ||
- | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 6); | + | |
- | } | + | |
- | else // Alle NICHT-Magier | + | |
- | { | + | |
- | self.aivar[AIV_MagicUser] = MAGIC_NEVER; | + | |
- | + | ||
- | // max 10 | + | |
- | rnd = Hlp_Rand(9); | + | |
- | self.attribute[ATR_MANA_MAX] = 1 + rnd; | + | |
- | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | + | |
- | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | + | |
- | + | ||
- | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 0); | + | |
- | }; | + | |
- | + | ||
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | // Sonstige Talente | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | if fernKampf >= STRONG | + | |
- | { | + | |
- | Npc_SetTalentSkill (self, NPC_TALENT_PICKLOCK, TRUE); | + | |
- | Npc_SetTalentSkill (self, NPC_TALENT_SNEAK, TRUE); | + | |
- | Npc_SetTalentSkill (self, NPC_TALENT_ACROBAT, TRUE); | + | |
- | Npc_SetTalentSkill (self, NPC_TALENT_PICKPOCKET, TRUE); | + | |
- | }; | + | |
- | + | ||
- | if nahKampf >= STRONG | + | |
- | { | + | |
- | Npc_SetTalentSkill (self, NPC_TALENT_SMITH, TRUE); | + | |
- | }; | + | |
- | + | ||
- | if nahKampf >= STRONG || fernKampf >= STRONG | + | |
- | { | + | |
- | Npc_SetTalentSkill (self, NPC_TALENT_TAKEANIMALTROPHY, TRUE); | + | |
- | }; | + | |
- | + | ||
- | if magieKampf >= STRONG | + | |
- | { | + | |
- | Npc_SetTalentSkill (self, NPC_TALENT_RUNES, TRUE); | + | |
- | Npc_SetTalentSkill (self, NPC_TALENT_ALCHEMY, TRUE); | + | |
- | }; | + | |
- | }; | + | |
- | + | ||
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | // | + | |
- | // B_SetAttributForWeapons | + | |
- | // - - - - - - - - - - - - - - - - - - - - - - | + | |
- | // | + | |
- | // Das Zufällige Austeilen von Attributen macht es nötig die Werte im Nachhinein an die Waffen anzupassen. | + | |
- | // Diese Methode schreibt die Werte neu, wenn sie nicht ausreichen die gewollten Waffen zu tragen. | + | |
- | // Dazu wird die Nebenmethode B_SetAttributForWeapon(waffe) benötigt. Die Methode setzt alle 3 Attribute und equipt die Waffe. | + | |
- | // | + | |
- | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | + | |
- | /* Zur Erinnerung die in der Waffe beschriebenen benötigten Attribute: (Classes.d) | + | |
- | + | ||
- | // Benötigte Attribute zum Benutzen des Items | + | |
- | VAR INT cond_atr [3] ; | + | |
- | VAR INT cond_value [3] ; | + | |
- | + | ||
- | (constants.d) | + | |
- | + | ||
- | const int ATR_HITPOINTS = 0; // Lebenspunkte | + | |
- | const int ATR_HITPOINTS_MAX = 1; // Max. Lebenspunkte | + | |
- | const int ATR_MANA = 2; // Mana Mana | + | |
- | const int ATR_MANA_MAX = 3; // Mana Max | + | |
- | + | ||
- | const int ATR_STRENGTH = 4; // Stärke | + | |
- | const int ATR_DEXTERITY = 5; // Geschick | + | |
- | const int ATR_REGENERATEHP = 6; // Regenerierung von HP alle x sekunden | + | |
- | const int ATR_REGENERATEMANA = 7; // Regenerierung von Mana alle x sekunden | + | |
- | + | ||
- | */ | + | |
- | + | ||
- | func void B_SetAttributForWeapon(var int waffenInstanz) | + | |
- | { | + | |
- | //- - - - - Resett for Random - - - - - - | + | |
- | Hlp_Rand_Resett(); | + | |
- | + | ||
- | var int rnd; rnd = Hlp_Rand(10); | + | |
- | + | ||
- | //Notausstieg: | + | |
- | if waffenInstanz == nothing //NO_ARMOR ist Ersatz für nil oder nothing | + | |
- | { | + | |
- | return; | + | |
- | } | + | |
- | else | + | |
- | { | + | |
- | CreateInvItems (self, waffenInstanz, 1); | + | |
- | }; | + | |
- | + | ||
- | if item.cond_atr[0] == ATR_HITPOINTS { if self.attribute[ATR_HITPOINTS] < item.cond_value[0] {self.attribute[ATR_HITPOINTS] = item.cond_value[0] + rnd; }; } | + | |
- | else if item.cond_atr[0] == ATR_HITPOINTS_MAX { if self.attribute[ATR_HITPOINTS_MAX] < item.cond_value[0] {self.attribute[ATR_HITPOINTS_MAX] = item.cond_value[0] + rnd; }; } | + | |
- | else if item.cond_atr[0] == ATR_MANA { if self.attribute[ATR_MANA] < item.cond_value[0] {self.attribute[ATR_MANA] = item.cond_value[0] + rnd; }; } | + | |
- | else if item.cond_atr[0] == ATR_MANA_MAX { if self.attribute[ATR_MANA_MAX] < item.cond_value[0] {self.attribute[ATR_MANA_MAX] = item.cond_value[0] + rnd; }; } | + | |
- | else if item.cond_atr[0] == ATR_STRENGTH { if self.attribute[ATR_STRENGTH] < item.cond_value[0] {self.attribute[ATR_STRENGTH] = item.cond_value[0] + rnd; }; } | + | |
- | else if item.cond_atr[0] == ATR_DEXTERITY { if self.attribute[ATR_DEXTERITY] < item.cond_value[0] {self.attribute[ATR_DEXTERITY] = item.cond_value[0] + rnd; }; } | + | |
- | else if item.cond_atr[0] == ATR_REGENERATEHP { if self.attribute[ATR_REGENERATEHP] < item.cond_value[0] {self.attribute[ATR_REGENERATEHP] = item.cond_value[0] + rnd; }; } | + | |
- | else if item.cond_atr[0] == ATR_REGENERATEMANA { if self.attribute[ATR_REGENERATEMANA] < item.cond_value[0] {self.attribute[ATR_REGENERATEMANA] = item.cond_value[0] + rnd; }; }; | + | |
- | + | ||
- | if item.cond_atr[1] == ATR_HITPOINTS { if self.attribute[ATR_HITPOINTS] < item.cond_value[1] {self.attribute[ATR_HITPOINTS] = item.cond_value[1] + rnd; }; } | + | |
- | else if item.cond_atr[1] == ATR_HITPOINTS_MAX { if self.attribute[ATR_HITPOINTS_MAX] < item.cond_value[1] {self.attribute[ATR_HITPOINTS_MAX] = item.cond_value[1] + rnd; }; } | + | |
- | else if item.cond_atr[1] == ATR_MANA { if self.attribute[ATR_MANA] < item.cond_value[1] {self.attribute[ATR_MANA] = item.cond_value[1] + rnd; }; } | + | |
- | else if item.cond_atr[1] == ATR_MANA_MAX { if self.attribute[ATR_MANA_MAX] < item.cond_value[1] {self.attribute[ATR_MANA_MAX] = item.cond_value[1] + rnd; }; } | + | |
- | else if item.cond_atr[1] == ATR_STRENGTH { if self.attribute[ATR_STRENGTH] < item.cond_value[1] {self.attribute[ATR_STRENGTH] = item.cond_value[1] + rnd; }; } | + | |
- | else if item.cond_atr[1] == ATR_DEXTERITY { if self.attribute[ATR_DEXTERITY] < item.cond_value[1] {self.attribute[ATR_DEXTERITY] = item.cond_value[1] + rnd; }; } | + | |
- | else if item.cond_atr[1] == ATR_REGENERATEHP { if self.attribute[ATR_REGENERATEHP] < item.cond_value[1] {self.attribute[ATR_REGENERATEHP] = item.cond_value[1] + rnd; }; } | + | |
- | else if item.cond_atr[1] == ATR_REGENERATEMANA { if self.attribute[ATR_REGENERATEMANA] < item.cond_value[1] {self.attribute[ATR_REGENERATEMANA] = item.cond_value[1] + rnd; }; }; | + | |
- | + | ||
- | if item.cond_atr[2] == ATR_HITPOINTS { if self.attribute[ATR_HITPOINTS] < item.cond_value[2] {self.attribute[ATR_HITPOINTS] = item.cond_value[2] + rnd; }; } | + | |
- | else if item.cond_atr[2] == ATR_HITPOINTS_MAX { if self.attribute[ATR_HITPOINTS_MAX] < item.cond_value[2] {self.attribute[ATR_HITPOINTS_MAX] = item.cond_value[2] + rnd; }; } | + | |
- | else if item.cond_atr[2] == ATR_MANA { if self.attribute[ATR_MANA] < item.cond_value[2] {self.attribute[ATR_MANA] = item.cond_value[2] + rnd; }; } | + | |
- | else if item.cond_atr[2] == ATR_MANA_MAX { if self.attribute[ATR_MANA_MAX] < item.cond_value[2] {self.attribute[ATR_MANA_MAX] = item.cond_value[2] + rnd; }; } | + | |
- | else if item.cond_atr[2] == ATR_STRENGTH { if self.attribute[ATR_STRENGTH] < item.cond_value[2] {self.attribute[ATR_STRENGTH] = item.cond_value[2] + rnd; }; } | + | |
- | else if item.cond_atr[2] == ATR_DEXTERITY { if self.attribute[ATR_DEXTERITY] < item.cond_value[2] {self.attribute[ATR_DEXTERITY] = item.cond_value[2] + rnd; }; } | + | |
- | else if item.cond_atr[2] == ATR_REGENERATEHP { if self.attribute[ATR_REGENERATEHP] < item.cond_value[2] {self.attribute[ATR_REGENERATEHP] = item.cond_value[2] + rnd; }; } | + | |
- | else if item.cond_atr[2] == ATR_REGENERATEMANA { if self.attribute[ATR_REGENERATEMANA] < item.cond_value[2] {self.attribute[ATR_REGENERATEMANA] = item.cond_value[2] + rnd; }; }; | + | |
- | + | ||
- | EquipItem(self,waffenInstanz); | + | |
- | }; | + | |
- | + | ||
- | func void B_SetAttributForWeapons(var int nahKampfWaffe, var int ferKampfWaffe) | + | |
- | { | + | |
- | if nahKampfWaffe != nothing | + | |
- | { | + | |
- | B_SetAttributForWeapon(nahKampfWaffe); | + | |
- | }; | + | |
- | if ferKampfWaffe != nothing | + | |
- | { | + | |
- | B_SetAttributForWeapon(ferKampfWaffe); | + | |
- | }; | + | |
- | }; | + | |
- | </code> | + | |
- | + | ||
- | == Automatische Übertragung von Gegenständen von Opfer nach Hero == | + | |
Das folgende Script ist zu ersetzten. Dann werden in eurem Mod zukünftig alle Items, außer Rüstungen, vom Opfer-Inventar in das Helden-Inventar transferiet. | Das folgende Script ist zu ersetzten. Dann werden in eurem Mod zukünftig alle Items, außer Rüstungen, vom Opfer-Inventar in das Helden-Inventar transferiet. | ||
Zeile 1118: | Zeile 720: | ||
</code> | </code> | ||
- | == Kill-Counter erstellen == | + | ===== Kill-Counter erstellen ===== |
So, da das auch nicht so einfach ist, gebe ich hier mal ein Beispiel für einen Kill-Counter mit folgender Attributssteigerung. | So, da das auch nicht so einfach ist, gebe ich hier mal ein Beispiel für einen Kill-Counter mit folgender Attributssteigerung. | ||
Zeile 1135: | Zeile 737: | ||
</code> | </code> | ||
- | Wir tragen nach der B_GivePlayerXP noch ''B_Counter();'' ein. Das ruft dann unseren Counter auf, den wir im folgenden erstellen. | + | Wir tragen nach der ''B_GivePlayerXP'' noch ''B_Counter();'' ein. Das ruft dann unseren Counter auf, den wir im folgenden erstellen. |
- | Hierzu erstellen wir eine Datei mit dem Namen "B_Counter.d" im Verzeichnis "[GOTHIC 2]\work\data\Scripts\Content\Story\B_Story". | + | Hierzu erstellen wir eine Datei mit dem Namen ''B_Counter.d'' im Verzeichnis ''[GOTHIC 2]\work\data\Scripts\Content\Story\B_Story''. |
<code C> | <code C> | ||
Zeile 1151: | Zeile 753: | ||
</code> | </code> | ||
- | Diese Funktion zählt jetzt eine Variable +1, da man einen NPC getötet hat. Nun müssen wir die Variable in die Story_Globals.d eintragen. Das kann ganz oben sein, ganz unten oder in der Mitte, ganz egal. Wir erstellen jetzt einfach einen neuen Abschnitt ganz oben in der Story_Globals.d: | + | Diese Funktion zählt jetzt eine Variable +1, da man einen NPC getötet hat. Nun müssen wir die Variable in die ''Story_Globals.d'' eintragen. Das kann ganz oben sein, ganz unten oder in der Mitte, ganz egal. Wir erstellen jetzt einfach einen neuen Abschnitt ganz oben in der ''Story_Globals.d'': |
<code C> | <code C> | ||
Zeile 1163: | Zeile 765: | ||
Danach folgt wieder der normale Rest der Datei. | Danach folgt wieder der normale Rest der Datei. | ||
- | Nun müssen wir im Weiteren noch die B_Counter.d in der Gothic.src eintragen, die wir mit dem normalen Text-Editor öffnen können, so wie die Skripte (Verzeichnis der Gothic.src: "[GOTHIC 2]\_work\data\Scripts\Content"): | + | Nun müssen wir im Weiteren noch die ''B_Counter.d'' in der ''Gothic.src'' eintragen, die wir mit dem normalen Text-Editor öffnen können, so wie die Skripte (Verzeichnis der ''Gothic.src'': ''[GOTHIC 2]\_work\data\Scripts\Content\Gothic.src''): |
- | <code C> | + | <code> |
STORY\Log_Entries\Log_Constants_*.d | STORY\Log_Entries\Log_Constants_*.d | ||
STORY\XP_Constants.d | STORY\XP_Constants.d | ||
Zeile 1175: | Zeile 777: | ||
</code> | </code> | ||
- | Das ist jetzt nur der wichtigste Ausschnitt aus der Gothic.src. Die B_Counter darf NICHT über der Story_Globals .d stehen, da dann die Variable in der B_Counter nicht erkannt wird. | + | Das ist jetzt nur der wichtigste Ausschnitt aus der ''Gothic.src''. Die ''B_Counter'' darf NICHT über der Story_Globals .d stehen, da dann die Variable in der B_Counter nicht erkannt wird. |
Zeile 1204: | Zeile 806: | ||
Das war's, nun noch Skripte parsen und fertig ist euer Kill-Counter mit Learning by Doing-System. | Das war's, nun noch Skripte parsen und fertig ist euer Kill-Counter mit Learning by Doing-System. | ||
+ | |||
+ | ===== [für Fortgeschritene] Zufällige Attribute für Npcs ===== | ||
+ | |||
+ | <code C> | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | // | ||
+ | // B_SetAttributesRandom | ||
+ | // - - - - - - - - - - - - - - - - - - - - - - - - | ||
+ | // | ||
+ | // Setzt die Attribute mit Hilfe eines Zufalls. | ||
+ | // Nötig ist dafür die Stärkeklasse des Npc für Nah, Fern & Magie Kampf. | ||
+ | // | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | |||
+ | /* | ||
+ | Zur Erinnerung - Auszug AI_Constants.d: | ||
+ | |||
+ | Stärkeklassen für die Zufalls-Attribute | ||
+ | - - - - - - - - - - - - - - - - - - - | ||
+ | |||
+ | const int COWARD = 0; //Lars, NK & FK der Magier | ||
+ | const int NORMAL = 1; //leichte Axt & Schwertkämpfer, Arbeiter und leichte NK Späher | ||
+ | const int STRONG = 2; //schwere Axt & Schwertkämpfer, Schwere Späher | ||
+ | const int RAISED = 3; //Wächter, Krieger, FK der Späher, Magier | ||
+ | const int MASTER = 4; //alle Anführer. | ||
+ | |||
+ | */ | ||
+ | |||
+ | func void B_SetAttributesRandom (var int nahKampf, var int fernKampf, var int magieKampf) | ||
+ | { | ||
+ | // - - - - - Resett for Random - - - - - - | ||
+ | Hlp_Rand_Resett(); | ||
+ | |||
+ | var int rnd; | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | // Allgemeine Attribute | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | |||
+ | if nahKampf == MASTER | ||
+ | || fernKampf == MASTER | ||
+ | || magieKampf == MASTER | ||
+ | { | ||
+ | self.fight_tactic = FAI_HUMAN_MASTER; | ||
+ | |||
+ | // 40 - 60 | ||
+ | rnd = Hlp_Rand(20); | ||
+ | self.level = 40 + rnd; //nicht 0 wegen XP (10 * Level) | ||
+ | } | ||
+ | else if nahKampf == RAISED | ||
+ | || fernKampf == RAISED | ||
+ | || magieKampf == RAISED | ||
+ | { | ||
+ | self.fight_tactic = FAI_HUMAN_MASTER; | ||
+ | |||
+ | // 30 - 50 | ||
+ | rnd = Hlp_Rand(20); | ||
+ | self.level = 30 + rnd; //nicht 0 wegen XP (10 * Level) | ||
+ | } | ||
+ | else if nahKampf == STRONG | ||
+ | || fernKampf == STRONG | ||
+ | || magieKampf == STRONG | ||
+ | { | ||
+ | self.fight_tactic = FAI_HUMAN_COWARD; | ||
+ | |||
+ | // 20 - 40 | ||
+ | rnd = Hlp_Rand(20); | ||
+ | self.level = 20 + rnd; //nicht 0 wegen XP (10 * Level) | ||
+ | } | ||
+ | else if nahKampf == NORMAL | ||
+ | || fernKampf == NORMAL | ||
+ | || magieKampf == NORMAL | ||
+ | { | ||
+ | self.fight_tactic = FAI_HUMAN_NORMAL; | ||
+ | // 10 - 30 | ||
+ | rnd = Hlp_Rand(20); | ||
+ | self.level = 10 + rnd; //nicht 0 wegen XP (10 * Level) | ||
+ | } | ||
+ | else //Alles COWARD | ||
+ | { | ||
+ | self.fight_tactic = FAI_HUMAN_COWARD; | ||
+ | // 1 - 10 | ||
+ | rnd = Hlp_Rand(9); | ||
+ | self.level = 1 + rnd; //nicht 0 wegen XP (10 * Level) | ||
+ | |||
+ | }; | ||
+ | |||
+ | //- - - - - - Nach Level - - - - - - - - - | ||
+ | self.attribute[ATR_HITPOINTS_MAX] = (self.level + 1) * 10; | ||
+ | self.attribute[ATR_HITPOINTS] = self.attribute[ATR_HITPOINTS_MAX]; | ||
+ | |||
+ | // - - - - - - XP für NSCs - - - - - - | ||
+ | self.exp = (500*[[self.level+1):2)*(self.level+1]]; | ||
+ | self.exp_next = (500*[[self.level+2):2)*(self.level+2]]; | ||
+ | |||
+ | |||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | // Nahkampf Attribute | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | |||
+ | if nahKampf == NORMAL | ||
+ | { | ||
+ | // 10 - 60 | ||
+ | rnd = Hlp_Rand(50); | ||
+ | self.attribute[ATR_STRENGTH] = 10 + rnd; | ||
+ | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | ||
+ | |||
+ | // 10 - 29 --> NICHTMAL 30 | ||
+ | rnd = Hlp_Rand(19); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_1H, 10 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_2H, 10 + rnd); | ||
+ | } | ||
+ | else if nahKampf == STRONG | ||
+ | { | ||
+ | // 50 - 130 | ||
+ | rnd = Hlp_Rand(80); | ||
+ | self.attribute[ATR_STRENGTH] = 50 + rnd; | ||
+ | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | ||
+ | |||
+ | // mind. 30 - max 59 | ||
+ | rnd = Hlp_Rand(29); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_1H, 30 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_2H, 30 + rnd); | ||
+ | } | ||
+ | else if nahKampf == RAISED | ||
+ | { | ||
+ | // 120 - 180 | ||
+ | rnd = Hlp_Rand(60); | ||
+ | self.attribute[ATR_STRENGTH] = 120 + rnd; | ||
+ | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | ||
+ | |||
+ | // 60 - 80 | ||
+ | rnd = Hlp_Rand(20); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_1H, 60 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_2H, 60 + rnd); | ||
+ | } | ||
+ | else if nahKampf == MASTER | ||
+ | { | ||
+ | // 160 - 200 | ||
+ | rnd = Hlp_Rand(40); | ||
+ | self.attribute[ATR_STRENGTH] = 160 + rnd; | ||
+ | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | ||
+ | |||
+ | // 80 - 100 | ||
+ | rnd = Hlp_Rand(20); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_1H, 80 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_2H, 80 + rnd); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | // max 10 | ||
+ | rnd = Hlp_Rand(9); | ||
+ | self.attribute[ATR_STRENGTH] = 1 + rnd; | ||
+ | self.aivar[REAL_STRENGTH] = self.attribute[ATR_STRENGTH]; | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_1H, 1 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_2H, 1 + rnd); | ||
+ | }; | ||
+ | |||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | // Fernkampf-Attribute | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | if fernKampf == NORMAL | ||
+ | { | ||
+ | // 10 - 60 | ||
+ | rnd = Hlp_Rand(50); | ||
+ | self.attribute[ATR_DEXTERITY] = 10 + rnd; | ||
+ | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | ||
+ | |||
+ | // 10 - 29 --> NICHTMAL 30 | ||
+ | rnd = Hlp_Rand(19); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_BOW, 10 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 10 + rnd); | ||
+ | } | ||
+ | else if fernKampf == STRONG | ||
+ | { | ||
+ | // 50 - 130 | ||
+ | rnd = Hlp_Rand(80); | ||
+ | self.attribute[ATR_DEXTERITY] = 50 + rnd; | ||
+ | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | ||
+ | |||
+ | // mind. 30 - max 59 | ||
+ | rnd = Hlp_Rand(29); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_BOW, 30 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 30 + rnd); | ||
+ | } | ||
+ | else if fernKampf == RAISED | ||
+ | { | ||
+ | // 120 - 180 | ||
+ | rnd = Hlp_Rand(60); | ||
+ | self.attribute[ATR_DEXTERITY] = 120 + rnd; | ||
+ | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | ||
+ | |||
+ | // 60 - 80 | ||
+ | rnd = Hlp_Rand(20); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_BOW, 60 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 60 + rnd); | ||
+ | } | ||
+ | else if fernKampf == MASTER | ||
+ | { | ||
+ | // 160 - 200 | ||
+ | rnd = Hlp_Rand(40); | ||
+ | self.attribute[ATR_DEXTERITY] = 160 + rnd; | ||
+ | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | ||
+ | |||
+ | // 80 - 100 | ||
+ | rnd = Hlp_Rand(20); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_BOW, 80 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 80 + rnd); | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | // max 10 | ||
+ | rnd = Hlp_Rand(9); | ||
+ | self.attribute[ATR_DEXTERITY] = 1 + rnd; | ||
+ | self.aivar[REAL_DEXTERITY] = self.attribute[ATR_DEXTERITY]; | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_BOW, 1 + rnd); | ||
+ | B_RaiseFightTalent (self, NPC_TALENT_CROSSBOW, 1 + rnd); | ||
+ | }; | ||
+ | |||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | // Magie-Attribute | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | // Vorsicht: Dieser Abschnitt setzt voraus, dass die AI an unterschiedliche Magiebenutzung angepasst ist. (zu betrachten: B_SelectSpell.d) | ||
+ | |||
+ | // Gilt für Manchmal-Magier, zb Wächter | ||
+ | if magieKampf == NORMAL | ||
+ | { | ||
+ | self.aivar[AIV_MagicUser] = MAGIC_SOMETIMES; | ||
+ | |||
+ | // 50 - 100 | ||
+ | rnd = Hlp_Rand(50); | ||
+ | self.attribute[ATR_MANA_MAX] = 50 + rnd; | ||
+ | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | ||
+ | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | ||
+ | |||
+ | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 2); | ||
+ | } | ||
+ | // Gilt nur für Magier: | ||
+ | else if magieKampf == STRONG | ||
+ | { | ||
+ | self.aivar[AIV_MagicUser] = MAGIC_ALWAYS; | ||
+ | |||
+ | // 90 - 180 | ||
+ | rnd = Hlp_Rand(90); | ||
+ | self.attribute[ATR_MANA_MAX] = 90 + rnd; | ||
+ | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | ||
+ | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | ||
+ | |||
+ | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 3); | ||
+ | } | ||
+ | else if magieKampf == RAISED | ||
+ | { | ||
+ | self.aivar[AIV_MagicUser] = MAGIC_ALWAYS; | ||
+ | |||
+ | // 170 - 260 | ||
+ | rnd = Hlp_Rand(90); | ||
+ | self.attribute[ATR_MANA_MAX] = 170 + rnd; | ||
+ | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | ||
+ | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | ||
+ | |||
+ | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 4); | ||
+ | } | ||
+ | else if magieKampf == MASTER | ||
+ | { | ||
+ | self.aivar[AIV_MagicUser] = MAGIC_ALWAYS; | ||
+ | |||
+ | // 250 - 300 | ||
+ | rnd = Hlp_Rand(50); | ||
+ | self.attribute[ATR_MANA_MAX] = 250 + rnd; | ||
+ | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | ||
+ | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | ||
+ | |||
+ | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 6); | ||
+ | } | ||
+ | else // Alle NICHT-Magier | ||
+ | { | ||
+ | self.aivar[AIV_MagicUser] = MAGIC_NEVER; | ||
+ | |||
+ | // max 10 | ||
+ | rnd = Hlp_Rand(9); | ||
+ | self.attribute[ATR_MANA_MAX] = 1 + rnd; | ||
+ | self.aivar[REAL_MANA_MAX] = self.attribute[ATR_MANA_MAX]; | ||
+ | self.attribute[ATR_MANA] = self.attribute[ATR_MANA_MAX]; | ||
+ | |||
+ | Npc_SetTalentSkill (self, NPC_TALENT_MAGE, 0); | ||
+ | }; | ||
+ | |||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | // Sonstige Talente | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | if fernKampf >= STRONG | ||
+ | { | ||
+ | Npc_SetTalentSkill (self, NPC_TALENT_PICKLOCK, TRUE); | ||
+ | Npc_SetTalentSkill (self, NPC_TALENT_SNEAK, TRUE); | ||
+ | Npc_SetTalentSkill (self, NPC_TALENT_ACROBAT, TRUE); | ||
+ | Npc_SetTalentSkill (self, NPC_TALENT_PICKPOCKET, TRUE); | ||
+ | }; | ||
+ | |||
+ | if nahKampf >= STRONG | ||
+ | { | ||
+ | Npc_SetTalentSkill (self, NPC_TALENT_SMITH, TRUE); | ||
+ | }; | ||
+ | |||
+ | if nahKampf >= STRONG || fernKampf >= STRONG | ||
+ | { | ||
+ | Npc_SetTalentSkill (self, NPC_TALENT_TAKEANIMALTROPHY, TRUE); | ||
+ | }; | ||
+ | |||
+ | if magieKampf >= STRONG | ||
+ | { | ||
+ | Npc_SetTalentSkill (self, NPC_TALENT_RUNES, TRUE); | ||
+ | Npc_SetTalentSkill (self, NPC_TALENT_ALCHEMY, TRUE); | ||
+ | }; | ||
+ | }; | ||
+ | |||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | // | ||
+ | // B_SetAttributForWeapons | ||
+ | // - - - - - - - - - - - - - - - - - - - - - - | ||
+ | // | ||
+ | // Das Zufällige Austeilen von Attributen macht es nötig die Werte im Nachhinein an die Waffen anzupassen. | ||
+ | // Diese Methode schreibt die Werte neu, wenn sie nicht ausreichen die gewollten Waffen zu tragen. | ||
+ | // Dazu wird die Nebenmethode B_SetAttributForWeapon(waffe) benötigt. Die Methode setzt alle 3 Attribute und equipt die Waffe. | ||
+ | // | ||
+ | /////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
+ | /* Zur Erinnerung die in der Waffe beschriebenen benötigten Attribute: (Classes.d) | ||
+ | |||
+ | // Benötigte Attribute zum Benutzen des Items | ||
+ | VAR INT cond_atr [3] ; | ||
+ | VAR INT cond_value [3] ; | ||
+ | |||
+ | (constants.d) | ||
+ | |||
+ | const int ATR_HITPOINTS = 0; // Lebenspunkte | ||
+ | const int ATR_HITPOINTS_MAX = 1; // Max. Lebenspunkte | ||
+ | const int ATR_MANA = 2; // Mana Mana | ||
+ | const int ATR_MANA_MAX = 3; // Mana Max | ||
+ | |||
+ | const int ATR_STRENGTH = 4; // Stärke | ||
+ | const int ATR_DEXTERITY = 5; // Geschick | ||
+ | const int ATR_REGENERATEHP = 6; // Regenerierung von HP alle x sekunden | ||
+ | const int ATR_REGENERATEMANA = 7; // Regenerierung von Mana alle x sekunden | ||
+ | |||
+ | */ | ||
+ | |||
+ | func void B_SetAttributForWeapon(var int waffenInstanz) | ||
+ | { | ||
+ | //- - - - - Resett for Random - - - - - - | ||
+ | Hlp_Rand_Resett(); | ||
+ | |||
+ | var int rnd; rnd = Hlp_Rand(10); | ||
+ | |||
+ | //Notausstieg: | ||
+ | if waffenInstanz == nothing //NO_ARMOR ist Ersatz für nil oder nothing | ||
+ | { | ||
+ | return; | ||
+ | } | ||
+ | else | ||
+ | { | ||
+ | CreateInvItems (self, waffenInstanz, 1); | ||
+ | }; | ||
+ | |||
+ | if item.cond_atr[0] == ATR_HITPOINTS { if self.attribute[ATR_HITPOINTS] < item.cond_value[0] {self.attribute[ATR_HITPOINTS] = item.cond_value[0] + rnd; }; } | ||
+ | else if item.cond_atr[0] == ATR_HITPOINTS_MAX { if self.attribute[ATR_HITPOINTS_MAX] < item.cond_value[0] {self.attribute[ATR_HITPOINTS_MAX] = item.cond_value[0] + rnd; }; } | ||
+ | else if item.cond_atr[0] == ATR_MANA { if self.attribute[ATR_MANA] < item.cond_value[0] {self.attribute[ATR_MANA] = item.cond_value[0] + rnd; }; } | ||
+ | else if item.cond_atr[0] == ATR_MANA_MAX { if self.attribute[ATR_MANA_MAX] < item.cond_value[0] {self.attribute[ATR_MANA_MAX] = item.cond_value[0] + rnd; }; } | ||
+ | else if item.cond_atr[0] == ATR_STRENGTH { if self.attribute[ATR_STRENGTH] < item.cond_value[0] {self.attribute[ATR_STRENGTH] = item.cond_value[0] + rnd; }; } | ||
+ | else if item.cond_atr[0] == ATR_DEXTERITY { if self.attribute[ATR_DEXTERITY] < item.cond_value[0] {self.attribute[ATR_DEXTERITY] = item.cond_value[0] + rnd; }; } | ||
+ | else if item.cond_atr[0] == ATR_REGENERATEHP { if self.attribute[ATR_REGENERATEHP] < item.cond_value[0] {self.attribute[ATR_REGENERATEHP] = item.cond_value[0] + rnd; }; } | ||
+ | else if item.cond_atr[0] == ATR_REGENERATEMANA { if self.attribute[ATR_REGENERATEMANA] < item.cond_value[0] {self.attribute[ATR_REGENERATEMANA] = item.cond_value[0] + rnd; }; }; | ||
+ | |||
+ | if item.cond_atr[1] == ATR_HITPOINTS { if self.attribute[ATR_HITPOINTS] < item.cond_value[1] {self.attribute[ATR_HITPOINTS] = item.cond_value[1] + rnd; }; } | ||
+ | else if item.cond_atr[1] == ATR_HITPOINTS_MAX { if self.attribute[ATR_HITPOINTS_MAX] < item.cond_value[1] {self.attribute[ATR_HITPOINTS_MAX] = item.cond_value[1] + rnd; }; } | ||
+ | else if item.cond_atr[1] == ATR_MANA { if self.attribute[ATR_MANA] < item.cond_value[1] {self.attribute[ATR_MANA] = item.cond_value[1] + rnd; }; } | ||
+ | else if item.cond_atr[1] == ATR_MANA_MAX { if self.attribute[ATR_MANA_MAX] < item.cond_value[1] {self.attribute[ATR_MANA_MAX] = item.cond_value[1] + rnd; }; } | ||
+ | else if item.cond_atr[1] == ATR_STRENGTH { if self.attribute[ATR_STRENGTH] < item.cond_value[1] {self.attribute[ATR_STRENGTH] = item.cond_value[1] + rnd; }; } | ||
+ | else if item.cond_atr[1] == ATR_DEXTERITY { if self.attribute[ATR_DEXTERITY] < item.cond_value[1] {self.attribute[ATR_DEXTERITY] = item.cond_value[1] + rnd; }; } | ||
+ | else if item.cond_atr[1] == ATR_REGENERATEHP { if self.attribute[ATR_REGENERATEHP] < item.cond_value[1] {self.attribute[ATR_REGENERATEHP] = item.cond_value[1] + rnd; }; } | ||
+ | else if item.cond_atr[1] == ATR_REGENERATEMANA { if self.attribute[ATR_REGENERATEMANA] < item.cond_value[1] {self.attribute[ATR_REGENERATEMANA] = item.cond_value[1] + rnd; }; }; | ||
+ | |||
+ | if item.cond_atr[2] == ATR_HITPOINTS { if self.attribute[ATR_HITPOINTS] < item.cond_value[2] {self.attribute[ATR_HITPOINTS] = item.cond_value[2] + rnd; }; } | ||
+ | else if item.cond_atr[2] == ATR_HITPOINTS_MAX { if self.attribute[ATR_HITPOINTS_MAX] < item.cond_value[2] {self.attribute[ATR_HITPOINTS_MAX] = item.cond_value[2] + rnd; }; } | ||
+ | else if item.cond_atr[2] == ATR_MANA { if self.attribute[ATR_MANA] < item.cond_value[2] {self.attribute[ATR_MANA] = item.cond_value[2] + rnd; }; } | ||
+ | else if item.cond_atr[2] == ATR_MANA_MAX { if self.attribute[ATR_MANA_MAX] < item.cond_value[2] {self.attribute[ATR_MANA_MAX] = item.cond_value[2] + rnd; }; } | ||
+ | else if item.cond_atr[2] == ATR_STRENGTH { if self.attribute[ATR_STRENGTH] < item.cond_value[2] {self.attribute[ATR_STRENGTH] = item.cond_value[2] + rnd; }; } | ||
+ | else if item.cond_atr[2] == ATR_DEXTERITY { if self.attribute[ATR_DEXTERITY] < item.cond_value[2] {self.attribute[ATR_DEXTERITY] = item.cond_value[2] + rnd; }; } | ||
+ | else if item.cond_atr[2] == ATR_REGENERATEHP { if self.attribute[ATR_REGENERATEHP] < item.cond_value[2] {self.attribute[ATR_REGENERATEHP] = item.cond_value[2] + rnd; }; } | ||
+ | else if item.cond_atr[2] == ATR_REGENERATEMANA { if self.attribute[ATR_REGENERATEMANA] < item.cond_value[2] {self.attribute[ATR_REGENERATEMANA] = item.cond_value[2] + rnd; }; }; | ||
+ | |||
+ | EquipItem(self,waffenInstanz); | ||
+ | }; | ||
+ | |||
+ | func void B_SetAttributForWeapons(var int nahKampfWaffe, var int ferKampfWaffe) | ||
+ | { | ||
+ | if nahKampfWaffe != nothing | ||
+ | { | ||
+ | B_SetAttributForWeapon(nahKampfWaffe); | ||
+ | }; | ||
+ | if ferKampfWaffe != nothing | ||
+ | { | ||
+ | B_SetAttributForWeapon(ferKampfWaffe); | ||
+ | }; | ||
+ | }; | ||
+ | </code> |