Hi, I'm in need of some help deciphering C over here. =)
I'm currently trying my hand at modding Sil to fit my preferences since I've burnt out a bit on 1.2.1 yet got the urge to slay some V (and don't want to wait for a potential january release - half's spawn might have well devoured him by now for all I know).
Basically, I want to change some monster flavor around, redefine "Staffs" as "Words" (of command, because Tolkien etc) and remove item degradation and destruction.
The kicker, of course, being that I've never written a line of code since.. RPGmaker 2000? When I was 12?
Now, this isn't much of a problem for the monster stuff since it's all easily available in monster.txt.
Same goes for most of the staff fluff, however it seems like I cannot actually rename "Staff" itself within object or flavor.txt since it references the item code itself. After downloading and extracting the code and looking at the auspicious-sounding "object1.c" file, this is what I've got:
Which I promptly changed into:
In the hope that this will make the game display the item type formerly known as "Staff" as "Word" instead in the game and inventory windows. Am I right in this assumption? If not, any pointers where to look?
As for item destruction and degradation, I went ahead and put the IGNORE_ALL flag on pretty much every item type in object.txt, which should work in a charmingly bruteforce sort of way. Except that this will flood my message prompt whilst playing the game.
SO, I had the brilliant idea of going through the spell code and changing the percentage chance of item destruction affecting equipment/inventory items to 0% for ice, fire and acid respectively, hoping for some sort of IF->randomnumber[1-100]>X THEN->badsshithappens ELSE->peaches on being exposed to elemental attacks.
No such luck however - opened up spells1.c, scrolled past the definition code for what items are eligible to be affected by stuff and am currently looking at:
Which looks like it should contain the value I'm looking to modify, except I'm pretty sure it doesn't? Is it the number in brackets? Google tells me it defines an array, which confuses me to no end since I don't really see the code following it reference it in any way. Can I change this number to 100 and call it a day? Is the percentage chance applied as the code scans through the backpack for eligible items? Help?
BONUS QUESTION: The game already floods "x isn't affected" messages when stuff is hit by fireballs or whatever on the floor, so I'm assuming there isn't any variable to change the odds of stuff on the floor not burning to 0%, is this correct though?
I'm currently trying my hand at modding Sil to fit my preferences since I've burnt out a bit on 1.2.1 yet got the urge to slay some V (and don't want to wait for a potential january release - half's spawn might have well devoured him by now for all I know).
Basically, I want to change some monster flavor around, redefine "Staffs" as "Words" (of command, because Tolkien etc) and remove item degradation and destruction.
The kicker, of course, being that I've never written a line of code since.. RPGmaker 2000? When I was 12?
Now, this isn't much of a problem for the monster stuff since it's all easily available in monster.txt.
Same goes for most of the staff fluff, however it seems like I cannot actually rename "Staff" itself within object or flavor.txt since it references the item code itself. After downloading and extracting the code and looking at the auspicious-sounding "object1.c" file, this is what I've got:
Code:
/* Staffs */ case TV_STAFF: { /* Color the object */ modstr = flavor_text + flavor_info[k_ptr->flavor].text; if (aware) append_name = TRUE; basenm = (flavor ? "& # Staff~" : "& Staff~"); break; }
Code:
/* Staffs */ case TV_STAFF: { /* Color the object */ modstr = flavor_text + flavor_info[k_ptr->flavor].text; if (aware) append_name = TRUE; basenm = (flavor ? "& # Word~" : "& Word~"); break; }
As for item destruction and degradation, I went ahead and put the IGNORE_ALL flag on pretty much every item type in object.txt, which should work in a charmingly bruteforce sort of way. Except that this will flood my message prompt whilst playing the game.
SO, I had the brilliant idea of going through the spell code and changing the percentage chance of item destruction affecting equipment/inventory items to 0% for ice, fire and acid respectively, hoping for some sort of IF->randomnumber[1-100]>X THEN->badsshithappens ELSE->peaches on being exposed to elemental attacks.
No such luck however - opened up spells1.c, scrolled past the definition code for what items are eligible to be affected by stuff and am currently looking at:
Code:
/* * This seems like a pretty standard "typedef" */ typedef int (*inven_func)(const object_type *); /* * Destroys a type of item on a given percent chance * Note that missiles are no longer necessarily all destroyed * * Returns number of items destroyed. */ static int inven_damage(inven_func typ, int perc, int resistance) { int i, j, k, amt; object_type *o_ptr; char o_name[80];
BONUS QUESTION: The game already floods "x isn't affected" messages when stuff is hit by fireballs or whatever on the floor, so I'm assuming there isn't any variable to change the odds of stuff on the floor not burning to 0%, is this correct though?
Comment