![]() |
#1 |
Swordsman
Join Date: Oct 2013
Posts: 299
![]() |
Changing item degradation/destruction odds?
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: 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? Last edited by Infinitum; July 22, 2015 at 17:10. |
![]() |
![]() |
![]() |
#2 |
Scout
Join Date: Dec 2011
Posts: 25
![]() |
C arrays
The declaration of
char ???[80]; is declaring and array of char (characters) so this is just place to put a string in. If you are looking for percentages I would look for either double or int or long declarations. Looking at the fragment of the code supplied I would follow perc declared in the function header. This is likely to be short for percentage! |
![]() |
![]() |
![]() |
#3 |
Swordsman
Join Date: Oct 2013
Posts: 299
![]() |
Thank you! I.. have no idea what that just meant. I think I did manage to solve my issue at hand though:
Code:
/* * Does a given class of objects (usually) hate acid? * Note that acid can either melt or corrode something. */ bool hates_acid(const object_type *o_ptr) { /* Analyze the type */ switch (o_ptr->tval) { /* Useless */ case TV_USELESS: { return (TRUE); } } return (FALSE); } |
![]() |
![]() |
![]() |
#4 | |
Prophet
Join Date: Dec 2009
Posts: 9,022
![]() |
Quote:
I hope, incidentally, that you're planning to make elemental attacks painful in other ways to compensate for the fact that the player need no longer fear damage to their gear or items. ![]() |
|
![]() |
![]() |
![]() |
#5 |
Swordsman
Join Date: Oct 2013
Posts: 299
![]() |
Actually, I'm pondering whether elemental attacks are needed at all -- especially in Sil which omits most of them anyway and where grinding for elemental coverage takes a back seat to raw damage in/output, light level and resistance to status ailments. I'd much rather it continue to explore monsters being dangerous to engage because they alter the normal rules rather than casue a buttload of damage because one lacks a particular flag on the character sheet.
There is of course dragonfire to attend to. But then again I'm personally ok with a variant where one does simply not go up against an adult dragon and live. |
![]() |
![]() |
![]() |
#6 |
Veteran
Join Date: Oct 2011
Location: Toronto, Canada
Posts: 2,400
![]() |
Ancient serpents are pretty awful if you are lacking corresponding resists.
__________________
Glaurung, Father of the Dragons says, 'You cannot avoid the ballyhack.' |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Item destruction | Amnekian | Vanilla | 2 | November 21, 2013 22:19 |
Rod destruction | Merlin | Vanilla | 1 | April 28, 2011 23:11 |
Ironman/destruction/Morgoth | Londorth | Vanilla | 3 | March 24, 2011 12:23 |
*Destruction* | Cave Man | Vanilla | 24 | April 5, 2009 23:58 |
*destruction* ? | warlin | Vanilla | 13 | November 1, 2008 07:07 |