Author Topic: Creating items that give +1 Strength, Intelligence, Charisma etc. when equipped.  (Read 489 times)

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2173
    • Dinonykos Dungeon Craft
In DC 0.914, it appeared quite easy to me to create items that could give +x to standard character values. However, I could not find out alone how to do it in DC 2.x - I hoped that I could reproduce it by looking at other items (Girdle of Giant strength), but the editor gives error messages when opening the related SA.

Can somebody help me?

In indirect context: What is the difference between
"GET_CHAR_AC" and "GET_CHAR_ADJAC" (I hoped the latter would be AC with equipment...) and between
"GET_CHAR_PERM_INT" and "GET_CHAR_LIMITED_INT"?
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage.
New: THE AMBASSADOR'S LETTER, my contribution to the 7-day-challenge.
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2131
As you probably expect, CHAR_AC is the innate armor class
of the character without any adjustments. Comments in the
code indicate that this does include adjustments based on
Dexterity and such.

The CHAR_ADJAC includes:
The innate AC  (CHAR_AC)
All spell effects that affect AC (Plus or minus)

There appears to be a function called 'GetEffectiveAC',
the result of which is returned by $GET_CHAR_EFFAC,
which includes:
The innate AC
Effects of readied items.

I don't know how these things are used but it seems strange
that I don't immediately see a function that includes
both types of adjustment.

When computing saving throws against THAC0 we use
'GetEffectiveAC'.

When we display character stats we display
GetAdjAC and GetEffectiveAC.  Likewise when we
display party names.

When we display combat stats we display
GetEffectiveAC.  And we display it in a different
color if it is not the same value as GetEffectiveAC.
Clearly a bug.

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2173
    • Dinonykos Dungeon Craft
What I wanted to do was checking if an item with AC -1 was equiped or not. The character had an CHAR_AC of 9, after equipping the item Armor Class 8 was displayed in colour, so far so good. But my logic block checking if "$GET_CHAR_ADJAC" was 8 did not work. Maybe I should have used "$GET_CHAR_EFFAC" instead, as I conclude from your post above...
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage.
New: THE AMBASSADOR'S LETTER, my contribution to the 7-day-challenge.
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2131
Quote
checking if an item with AC -1 was equiped or not.

Do you really want to know if ANY item with AC -1 is equipped?
Then comparing AC with EFFAC should do the trick unless
your character has two items equipped, for example -3 and +2.

If you want to know if a PARTICULAR item is equipped then this
is a terrible way to do it.

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9540
Dinonykos, check out the items database - gauntlets of Ogre Power and Girdle of ___ Giant Strength. These will have scripts listed in the special abilities database which you can look at.

As Paul said. looking for a particular item with your method is not very effective. You could instead look for the item's name or a special ability, etc.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2131
Quote from: Pqul R. Stevens
this is a terrible way to do it.

Thank you Manikus.  I was afraid Dinonykos
might ask "How?" and I would be left standing
there looking stupid..

Offline Dinonykos

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2173
    • Dinonykos Dungeon Craft
Manikus, if I try to open the abilities of the Girdle of Giant Strength, I get an error message, as written below. But I will check the Gauntlets.

EDIT: No error message concerning the special ability of the gauntlets, but I admit the scripts are quite complex for my humble self. But maybe I can copy the SA and turn it into an intelligence/charme/etc. SA...

Concerning my other question:
In the current case, the character starts without equipment and can equip up to three items which each decrease the AC by one. Thus, my approach would work well in this case. Of course, your points are correct that in other cases it would be not effective.

EDIT: EFFAC works fine, thank you!

Generally, I am aware that we can check if there is an item in the party. But can we check if an item is equipped? Or, alternatively, can we force that a received item is automatically equipped? I think about things like the "venom symbiont" in Spiderman or a cursed item that equips itself if handled falsely.

I should perhaps not ask several questions with one post, but I think these things are directly related.
« Last Edit: June 28, 2016, 06:14:21 AM by Dinonykos »
Find four contributions to the Pre-Generated Character Mini-Module Design Contest on my homepage.
New: THE AMBASSADOR'S LETTER, my contribution to the 7-day-challenge.
DINONYKOS DUNGEON CRAFT DESIGN HOMEPAGE

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9540
I don't know what to say about the Girdle script - I am looking at it in text editor and it looks fine. I'll try it in the editor to see what is going on. However the Gauntlets script is virtually identical, so that will work for our purposes.
Let's take it apart and see what the piece do, shall we?

Code: [Select]
\(BEGIN)
name = item_GauntletsOgrePower
[OnReady] = $VAR tgt; // target
-$VAR str;
-$VAR strMod;
-tgt = $IndexOf($CharacterContext());
-str = $GET_CHAR_LIMITED_STR(tgt);
-strMod = $GET_CHAR_LIMITED_STRMOD(tgt);
-$MODIFY_CHAR_ATTRIBUTE(tgt,"STR",18 -# str, "MINUTES", 999999999, "Ogre Strength","ITEM Ogre Strength");
-$IF (strMod ># 0)
- {
- $MODIFY_CHAR_ATTRIBUTE(tgt,"STRMOD",100 -# strMod, "MINUTES", 999999999, "","ITEM Ogre Strength");
- };
[OnUnReady] = $VAR tgt; // target
-tgt = $IndexOf($CharacterContext());
-$REMOVE_CHAR_MODIFICATION(tgt,"ITEM Ogre Strength");
\(END)

script 1: OnReady
The first three lines are declaring our variables and the next three lines are defining the variables. This is pretty straight-forward.
Let's look at the line:
Code: [Select]
-str = $GET_CHAR_LIMITED_STR(tgt);The function is $GET_CHAR_LIMITED_STR and as you may have guessed, there is one of these for each of the 6 abilities. Why use this one, meaning why use LIMITED (as opposed to PERM)? $GET_CHAR_LIMITED_STR() returns a value in the in 1 to 25 range, which is what AD&D is used to. If the actual STR is over 25, say 50, it will return 25. ($GET_CHar_PERM_STR() will return the actual value, even if outside of the 1 to 25 range).
Line 7;
Code: [Select]
$MODIFY_CHAR_ATTRIBUTE(tgt,"STR",18 -# str, "MINUTES", 999999999, "Ogre Strength","ITEM Ogre Strength"); is where it gets a bit tricky. Instead of having 7 different functions to modify attributes, we have just one that handles all seven (counting StRMOD as a seperate attribute). The first argument of the function is the target and the second is the abbreviation for the attribute to modify (STR, STRMOD, INT, WIS, DEX, CON, CHA). The  third argument is a unit of time and the fourth argument is the number of those units. At this time, MINUTES is the only option and you can see that the number is quite a long period of time. Argument 5 is text that will appear as Spell Effects appear and argument 6 is an arbitrary text that is used to identify this particular modification - so you can have STR modified by a potion and then a spell that will take away the potioin strength, without taking away the gauntlets strength.
All of the info about this function is at: http://www.dianneandpaul.net/UAF/Help/GPDL$MODIFY_CHAR_Attributes.html
Lines 8 through 11 are a test to see if the target has exceptional strength (STRMOD), and if it does it uses the function already used in line 7 to modify this different attribute.

script 2: OnUnReady
Lines 1 and 2 are to declare the variable and define it.
Line 3 is the important line as it contains the function: [code$]REMOVE_CHAR_MODIFICATION()[/code]. Remember the arbitrary text as argument 6 in modification function? We use that as the identifier through this function to remove the modification.

Any questions? Please feel free to ask. I will update the Help with the info for the LIMITED and PERM functions as soon as I can get to it.

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2131
I think he means that when he checks (in the DC editor) the
syntax of the script "item_GirdleGiantStrength/OnReady"
that a compile error is displayed.  I get an error, too.

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9540
I am sure that when I get home and fire up my computer, I'll get the same error. :) I know what the issue will be as well, and I hope that means that I will be able to fix it as well.

Edited to add:

Okay, fixed the Girdle script - it will be updated the next time I put any databases up. If you want to fix it now, line 4 $Myself() should be $CharacterContext() :D
« Last Edit: August 17, 2016, 01:14:58 PM by manikus »