Jump to content

Item abilities dependent on character stats


NiGHTMARE

Recommended Posts

I'd like to modify the gauntlets of Ogre Power, girdles of Giant Strength and Cromy Feyr so that instead of providing a set STR bonus, they provide a cumulative bonus to THAC0 and damage which depends on the character's strength. For example, the gauntlets of ogre power bonuses would be:

 

CHA Strength     THAC0 bonus     Damage bonus
1                +8                   +10
2                +6                   +8
3                +6                   +7
4-5              +5                   +7
...
18/51-75         +1                   +3
18/76-90         +1                   +2
18/91-99         +1                   +1
18/00+           +0                   +0

 

I'm sure this could be achieved via lengthy global scripts, but is there a way of achieving it without? I remember years ago there was a tutorial at TeamBG entitled "levelling up items without scripting", and perhaps similar principles could be used. Unfortunately, I can't find said tutorial anywhere.

Link to comment

The reasonably efficient script I've come up with

 

IF
 Global("HasOgrePower","LOCALS",0)
OR(18)
 HasItemEquipped("brac06",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06a",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06b",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06c",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06d",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06e",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06f",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06g",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06h",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06i",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06j",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06k",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06l",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06m",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06n",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06o",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06p",LastSummonerOf(Myself))
 HasItemEquipped("nmobr06q",LastSummonerOf(Myself))  
THEN
 RESPONSE #100
   GetItem("brac06",LastSummonerOf(Myself))
   GetItem("nmobr06a",LastSummonerOf(Myself))
   GetItem("nmobr06b",LastSummonerOf(Myself))
   GetItem("nmobr06c",LastSummonerOf(Myself))
   GetItem("nmobr06d",LastSummonerOf(Myself))
   GetItem("nmobr06e",LastSummonerOf(Myself))
   GetItem("nmobr06f",LastSummonerOf(Myself))
   GetItem("nmobr06g",LastSummonerOf(Myself))
   GetItem("nmobr06h",LastSummonerOf(Myself))
   GetItem("nmobr06i",LastSummonerOf(Myself))
   GetItem("nmobr06j",LastSummonerOf(Myself))
   GetItem("nmobr06k",LastSummonerOf(Myself))
   GetItem("nmobr06l",LastSummonerOf(Myself))
   GetItem("nmobr06m",LastSummonerOf(Myself))
   GetItem("nmobr06n",LastSummonerOf(Myself))
   GetItem("nmobr06o",LastSummonerOf(Myself))
   GetItem("nmobr06p",LastSummonerOf(Myself))
   GetItem("nmobr06q",LastSummonerOf(Myself))
   SetGlobal("HasOgrePower","LOCALS",1)
END

IF
 Global("HasOgrePower","LOCALS",1)
 Checkstat(LastSummonerOfMyself,1,STR)
THEN
 RESPONSE #100
   CreateItem("nmobr06a",LastSummonerOf(Myself),0,0,0)
   Equip("nmobr06a",LastSummonerOf(Myself))
   SetGlobal("HasOgrePower","LOCALS",0)
   DestroySelf()
END

IF
 Global("HasOgrePower","LOCALS",1)
 Checkstat(LastSummonerOfMyself,2,STR)
THEN
 RESPONSE #100
   CreateItem("nmobr06b",LastSummonerOf(Myself),0,0,0)
   Equip("nmobr06b",LastSummonerOf(Myself))
   SetGlobal("HasOgrePower","LOCALS",0)
   DestroySelf()
END

IF
 Global("HasOgrePower","LOCALS",1)
 Checkstat(LastSummonerOfMyself,3,STR)
THEN
 RESPONSE #100
   CreateItem("nmobr06c",LastSummonerOf(Myself),0,0,0)
   Equip("nmobr06c",LastSummonerOf(Myself))
   SetGlobal("HasOgrePower","LOCALS",0)
   DestroySelf()
END

IF
 Global("HasOgrePower","LOCALS",1)
OR(2)
 Checkstat(LastSummonerOfMyself,4,STR)
 Checkstat(LastSummonerOfMyself,5,STR)
THEN
 RESPONSE #100
   CreateItem("nmobr06a",LastSummonerOf(Myself),0,0,0)
   Equip("nmobr06d",LastSummonerOf(Myself))
   SetGlobal("HasOgrePower","LOCALS",0)
   DestroySelf()
END

etc

 

Of course the bracers won't automatically change if the character's strength increases by other means (e.g. a spell or some other item). However, this is actually desired behaviour, since the items aren't supposed to be cumulative with other unnatural strength bonuses.

Link to comment

What about moving the item, changing your STR score, etc..?

Seems a bit inefficient to me this way :p

 

What I'd do is having the bracers create a creature every second or so, and the creature will apply the needed effects via a spell. (or, to avoid creating multiple creatures, have baldur.bcs run the necessary script).

Hopefully the user won't try and cheese by moving the item around the gang every second :p

Link to comment

Moving the items around shouldn't be problem since I've used HasItemEquipped - it'll run as soon as a character equips the item. Having the effects contained in the item also means they can't be applied to multiple characters at once.

 

As I've written in the edited post, the item is actually supposed to ignore altered strength scores anyway - if I could, I'd make it ignore other sources of change when equipping it too :p.

 

EDIT: oh, and don't forget that WeiDU can create multiple versions of an item automatically.

Link to comment

I just realized that with a little more scripting, I should be able implement the pnp gauntlets of Ogre Power / girdle of Giant Strength / War Hammer rule. That is, the gauntlets and girdles' powers stack if the wearer is using a war hammer. Bioware had a very crude go at it with Crom Feyr, but if this works I can do away with the forging, have it affect all the other hammers, and have it work with more than just a single type of girdle. The player will still need to find the Crom Feyr scroll, as a Hammer of Thunder Bolts will only work at full potential if its wielder knows its true name.

 

EDIT: Eh, I don't know what I was thinking - other sources of strength alteration should of course be taken into account. If it's already less than 18/00 and changes to something still less than 18/00, their THAC0 and damage bonuses are supposed to remain unchanged; if it changes to 18/00 or more, the girdle should stop providing a bonus at all. Looks like I will need to keep summoning the invisible .cre after all - thanks for the tip :p.

Link to comment
Dude, you totally want IAP-SFX.

How about compacting the mod in a single executable (which is possible, if we were to create all files as inlined or define them via patching, and then 'compiling' the tp2 into an executable), and then distributing the mod as the source of a program in Brainfuck which would spit out the final executable file?

Link to comment

The script seems to be pretty much complete now. Since it's so long, here's a summary of what each block does:

 

1) If HasOgrePower = 0 and player has gauntlets of Ogre Power, then take them and set HasOgrePower -> 1

2) If HasHillGiantStrength = 0 and player has girdle of Hill Giant Strength, then take it and set HasHillGiantStrength -> 1

3) If HasStoneGiantStrength = 0 and player has girdle of Stone Giant Strength, then take it and set HasStoneGiantStrength -> 1

4) If HasFrostGiantStrength = 0 and player has girdle of Frost Giant Strength, then take it and set HasFrostGiantStrength -> 1

5) If HasFireGiantStrength = 0 and player has girdle of Fire Giant Strength, then take it and set HasFireGiantStrength -> 1

6) If player has a war hammer, then set HasWarHammer -> 1

7) If HasOgrePower = 1 and all of the HasXGiantStrengths = 0, then set HasOgrePower ->2

8) If HasOgrePower = 1, HasWarHammer = 0, and any of the HasXGiantStrength = 1, then create + equip no bonus version of gantlets of Ogre Power, and set HasOgrePower -> 0

9) If HasOgrePower = 1, HasWarHammer = 1, and any of the HasXGiantStrength = 1, then set HasOgrePower -> 2 and HasWarHammer -> 0

10) (Several blocks) If HasOgrePower = 2, then create + equip the appropriate version of gauntlets of Ogre Power (based on player's strength), and set HasOgrePower ->3

11) (Several blocks) If HasHillGiantStrength = 1, then create + equip the appropriate version of girdle of Hill Giant Strength (based on player's strength), and set HasHillGiantStrength-> 2

12) (Several blocks) If HasStoneGiantStrength = 1, then create + equip the appropriate version of girdle of Stone Giant Strength (based on player's strength), and set HasStoneGiantStrength-> 2

13) (Several blocks) If HasFrostGiantStrength = 1, then create + equip the appropriate version of girdle of Frost Giant Strength (based on player's strength), and set HasFrostGiantStrength-> 2

14) (Several blocks) If HasFireGiantStrength = 1, then create + equip the appropriate version of girdle of Fire Giant Strength (based on player's strength), and set HasFireGiantStrength-> 2

15) If HasOgrePower = 3, and all of the HasXGiantStrengths = 0, then set HasOgrePower -> 0 and destroy self

16) If any of the HasXGiantStrengths = 2, then set them + HasOgrePower -> 0, and destroy self

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...