This is my first post, so forgive me being a tad longwinded just this once, but I have to get this out of the way:
Nick, you are THE MAN!!
After a year of learning OLC thru various win-blows executables, I tried downloading every flavor of SMAUG source I could find, no, ALL of them. Not one would compile clean out of the box, and I needed that, because I was such a newb. But thanks to your INSANELY detailed idiot-proof instructions, I downloaded Cygwin and SMAUG 1.4aMXP and -poof- except for a simple error you accounted for right there in the faq, I was in business. I am new to UNIX and C, but thru reading documentation, help files and a lot of t & e, I am making minor code changes on my own, successfully. So thanks for getting me off to such a good start! Now on to my question.
I want to make intelligence affect the chance of a spell being cast successfully, beyond the current prarameters. What I have in mind is this: For benign spells, the chance should be affected by x-percent per stat point over or under a zero point, say 16. This would be added (I guess) to the index in const.c? For aggressive spells, a comparison would be made between the caster and victims' INT stats, with the difference being calculated as, say 5 percent per point, more or less - or zero. So if you could offer some details on how to go about this, I can tweak the numbers thru t&e, as I have already figured out how to alter the existing stat indeces and their reference to raise max stats successfully, but this goes into fight.c and magic.c apparently, and there's alot there to confuse a novice like me. Plus, I know, its adding a new parameter to int_app, etc... I'm running on WinXP and haven't encountered any problems I couldn't solve yet. The code is practically unmodded, just a few small tweaks here and there; color stuff, etc... Sorry again to be so wordy and thanks in advance for any help you can give.
I know this is rather simple minded, but you could just add an if check in do_cast to add it like you planned. Its rather difficult to say where exactly to put it. Here's something simple to work off perhaps:
int percent, i;
for ( i = 0; i < ch->mod_int; i++ )
{
percent += 5;
if ( percent > 100 )
percent = 100;
}
if ( number_range(1,100) > percent )
{
send_to_char( "You begin the arcane gestures but mess up!\n\r", ch );
return;
}
Again, thats really simplistic and is perhaps not what your looking for. Was just a thought. :)
Well simplistic is fine with me, in fact, it shouldn't be much more than a couple if statements. What I want to do is this: When casting a non-offensive spell, an intelligence stat of, say, 16 would have no effect on the probability of success. 17 INT would increase the chance by, say, 5 percent, etc...; 15 INT would decrease it by five, etc... For an offensive spell, however, some manner of compare would need to subtract the victims' INT stat from the caster's, with that remainder (...-1, 0, 1, 2...) corresponding to a modifying factor of, say, 5 percent, e.g. I cast <some spell> at a pc/npc who has 17 INT; I have 19 INT, so 19 - 17 = 2 * 5% = a 10 percent increase in probability of success. I don't want to create an alternate outcome, just add a modifier to the existing logic stream that currently dictates success probability. Hope that makes sense :)
I'm not really an expert on how SMAUG spells are coded, but what you want to do sounds simple enough. First you check if the spell is offensive, not sure how, and then compare the intelligence of the caster to the target. What part of this are you having problems with?
Well, I'm not sure where to inject the conditions or exactly how to parse them. I've been toying w/ an executable Win version for a year or more, but I'm only a veteran of a month or so of coding the source. I'm hoping for a template I could use to modify other stats as well. I'm grateful for whatever help I can get :)