• Herzlich Willkommen!

    Nach der Schließung von inDiablo.de wurden die Inhalte und eure Accounts in dieses Forum konvertiert. Ihr könnt euch hier mit eurem alten Account weiterhin einloggen, müsst euch dafür allerdings über die "Passwort vergessen" Funktion ein neues Passwort setzen lassen.

    Solltet ihr keinen Zugriff mehr auf die mit eurem Account verknüpfte Emailadresse haben, so könnt ihr euch unter Angabe eures Accountnamens, eurer alten Emailadresse sowie eurer gewünschten neuen Emailadresse an einen Administrator wenden.

BBCode-Parser benötigt

CorniI

Guest
Eine kleine Einführung: Vor ein paar Tagen habe Ich realisiert, das man in den TxT-dateien mehr als nur nummerische Werte (zB 150, 3.4, 1001) verwenden kann, sondern auch Formeln, die bei der Ausführung des Spiels berrechnet werden, möglich sind. So ist viel flexibleres modding möglich, auch ganz ohne Code editing! Beispiele finden sich weiter unten. Diese Entdeckung war eine große Überraschung und ein großer Schock für mich, weil Ich realisierte, was man mit Formeln alles anstellen könnte, zum Beispiel Synergien, abhängig vom cLvl, reduziertes Casting-Delay oder







This discovery was a great shock for me, because I couldn’t even imagine all the possibilities, versatile gameplay changes, when can be implemented due to using such formulae (skill synergy from [acronym="Character Level"]clvl[/acronym], “reduce casting delay” or “increase curse effectiveness” affixes, anyone ;) ) I became very interested in this theme, maybe because professional (programmer) motives. And so I decided to research this aspect of game mechanics and to write a guide on it in order to clear out all the things and to consolidate all the info about formulae syntax in one topic.
This is my first guide at the Phrozen Keep. I’m a bit anxious about it :lol: But I know that our senior colleagues will correct and append this post if necessary. [I've marked my questions with color] Sorry for my poor English in advance. So it begins…

[1.10] Formulae guide

1. What is the benefit of using formulae in txt files?
The main idea of my answer to this question is that using formulae (i.e. through soft coding), one can implement things that for sure seem to require code editing. Some examples of such ideas:

a) various softcoded skill system changes, e.g. Char’s skill system (d2:elements mod), i.e. each skill requires [slvl] skill points to advance to [slvl] level, and the first skill point always costs required character level (e.g. 12 for Zeal or 30 for Frozen Orb), so you need hard investments into the skill to maximize it. I can also mention Will’s ideas (take a look through “One skill point per two levels, per skill...” post in General Mod Making);

b) even more deep skill interdependencies: 1)adding and ability of Skill Masteries to reduce casting delay, increase missile speed, widen aura range, e.t.c. only for particular skills, 2)making your minions using and gaining benefits from your passive abilities and active skills, 3)adding and modifying skill synergies not only for damage but also for versatile (each possible in the game) skill-specific parameters;

c)<Maybe the most unusual idea>: making multiple skill synergies ((C) xeno, 2004) (it’s somehow similar to skill sets with partial and full set bonuses);

et cetera, et cetera... (listing of such ideas is worth hundreds of separate posts in the appropriate forums).

2. What files are used for this and what files allow using formulae?
You’ll need to look through ItemStatCost.txt (ISC), Skills.txt (SK), Missiles.txt (MS) for identifiers (string entries) plus MissCalc.txt (MSC) and SkillCalc.txt (SKC) for using predefined internal functions. I guess almost each file, where immediate numeric values are applicable, allows using formulae. But to know this for sure, I’m now going to test some of them, including the most important: SK and MS.

3. Formulae description.
Now I’ll try to give a recursive definition (sounds scary, yeah?) and detailed description (examples are included, too) of Diablo II-formulae. Such formulae consist of some simple parts. So let’s study them firstly.

Simple formula is:
1) an immediate integer or real value. <NOTE. Real values are rounded: their fractional part is truncated, i.e. “55.3” will be recognized as 55 and ”-55.3” will transform into -55>

2) a reference to a predefined (i.e. hard coded) formula from SKC or MSC (such references can ONLY be used in SK and MS, respectively). [can we define our own formulae in these files?] Detailed description of available formulae is available in Appendix A.

3) a reference to a property of skill, stat or missile. [I bet we can also reference monster props or particular item props, but I haven’t found it out yet] Such reference can be written in one of the three possible ways:

stat(‘<statID>’.<qualifier>),
skill(‘<skillID>’.<qualifier>),
[missile? miss? (both do not work)](‘<missID>’.<qualifier>),


where <statID>, <missID> and <skillID> stand for ISC, MS and SK string entries (they MUST be written in single quotas, e.g. stat(‘level’.accr) or skill(‘Holy Shock’).edmn) and <qualifier> is a reserved word which indicates the particular property of stat, skill or missile, we want to reference. You can see the list and detailed descriptions in the Appendix B.

Complicated formulae (more general case) are formed from simple ones with the usage of arithmetic operators (which include <sign operator>:'-', <addition>:'+', <subtraction>:'-', <multiplication>:'*', <division>:'/' and <power>:'^'. Other c-style operators don’t seem to be working :( ), standard functions (see Appendix C) and, of course, parentheses. Examples:
Skill(‘FireStorm’.clc1)*(Skill(‘FireStorm’.edmn)+ Skill(‘FireStorm’.edmx))/2 stands for average effective damage of firestorm skill (number of snakes * average dmg);
[Default value]/((100+Skill(‘Fire Mastery’)*5)/100)) If placed into “delay” column and appropriate skill row the skill’s casing delay will be reduced by Fire_Mastery_slvl*5 percent;
Stat(‘nextexp’.accr)-Stat(‘experience’.accr) stands for the your experience rest to level-up.

But all formulae syntax wouldn’t be SO flexible, if we can’t use conditional formulae. Let’s proceed by studying them.

4. Conditional formulae. Conditions are special types of formulae, but with one important difference: their values are interpreted in a special way: 0 means “false”, and 1 (and any non-zero value) stands for “true”. Both conditions and formulae can be very complicated and both of them consist of several simple parts. Let us study them firstly. Simple condition is:
1)an immediate numeric value (zero stands for “false”, and any non-zero value stands for “true”);
2)a relation of two expressions, formed using ‘>=’, ‘<=’,’>’,’<’,’==’ (means “equal”) and ‘!=’ (means “not equal”). Again, other c-style operators don’t seem to be working :( ;

Complicated conditions consist of simple ones with the usage of logical conjunctions: OR & AND (‘+’ and ‘*’, respectively. C-style syntax: ‘&&’ and ‘||’ doesn’t work :( ). Simple maths shows us that complicated conditions cover all possible variants of conditions in txt-files. Examples:
(stat(‘level’.accr)>=54)*(stat(‘strength’.accr)>=25)*(stat(‘dexterity’.accr)>=136)) if this condition is true, then the character can equip Phase Blades (he has at least 54 [acronym="Character Level"]clvl[/acronym], 25 str and 136 dex simultaneously);
(skill(‘Cold Mastery’.blvl)!=0)+(skill(‘Fire Mastery’.blvl)!=0)+(skill(‘Lightning Mastery’.blvl)!=0) this condition is true, if at least one of sorceress masteries has at least one skillpoint invested.

Conditional formulae have the following format:
condition?cfla1:cfla2.
Then this formula has a value of cfla1 if the condition has a value of “true” (has non-zero value), else it has a value of cfla2. Keep in mind that both condition and formulae can be conditional formulae, too. Examples:
(stat('item_cannotbefrozen'.accr)!=0)?(dm34+50):dm34 if placed into column “aurastatcalc1”, row “Resist Cold” of SK, aura “Resist Cold” will grant player additional 50% Cold Resist, if he can’t be frozen;
(lvl<3)?3:((lvl<5)?4:((lvl<7)?5:((lvl<9)?6:((lvl<11)?7:((lvl<13)?8:((lvl<15)?9:((lvl<17)?10:((lvl<19)?11:12)))))))) if placed into column “skpoints” and appropriate skill row of SK, this formula will make the skill require 3, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12… skill points to advance to 0..20th skill level (view details in “One skill point per two levels, per skill...” post in GMM);

5. Finita. Hope this was helpful. I would be glad to see your comments and suggestions. Thanks for reading :lol:[/quote]
 
WIRST du da wohl ein Copyright reinhauen?

Und wofür haben wir das Blub? Du musst doch nicht das arme D.O.U.G. - Forum hierfür missbrauchen, um deinen Crap reinzupflanzen! Nie so ne schlechte Geschichte gesehen!

Yawgmoth
 
*up, sonst wird der fred nicht den gästen gezeigt, ich kann mich nicht von überall aus einloggen
 
Zurück
Oben