On Mon, 27 May 1996, Chris Anderson wrote: > Ok, I have a spell that sets up an Affect wooden bit... > > Now I am currently working through two ways of making this work, and > wondering the best possible way.. > > I want to make it KINd of like the freeze command.. where all movemnet is > ceased. > > I tried to make the spell aff_MAXMOVE, and all it seems to do is remove the > original move points, no added points.. I want to be able to keep the person > from moving, because they are petrified... > Then in do_simple_move (I think that's what it's called), near the beginning of the function (doesn't matter where as long t is after the casting of variables) add: if (AFF_FLAGGED(ch, AFF_WOODEN)) { send_to_char("You cannot move...\r\n", ch); return; } > > Now, I also want to keep them from attacking other people as well.. they are > like a tree.. they shouldn't be able to attack.. In perform_violence within the loop, before it calls the 'hit' function do: if (AFF_FLAGGED(ch, AFF_WOODEN)) continue; > The reason for the bit, is so that fire spells will have a greater effect on > the person being woodd, and things like small swords will only do so much.. For fire affecting them more it'll be a slight pain, what you could do is add a "bool wooden = FALSE;" to the top of the damage spell routine, and set it to true in the 'case' statements for spells that do damage via fire (e.g., under 'case SPELL_FIREBALL:'). At the bottom of the routine, after the switch and before it affects the person, do something like: if (wooden && AFF_FLAGGED(victim, AFF_WOODEN)) dam += dice(1, 4); > > (ever try to cut down an oak tree by hacking at it with a dagger? Never work > out too good..) This could be done somewhat like sharpness and Cleric's is (was?) implemented. Just create a table in constants.c like sharp, and instead of 0 or 1, put in a damage modifier. Like, a dagger would modify the damage by -2, so it'd be less effective -- while an axe would add 4 because it'd be more effective. Then in fight.c, under 'damage' do: if (AFF_FLAGGED(vict, AFF_WOODEN)) dam += wooden[wtype]; Hm, I'm not exactly sure about whether <wtype> is the variable passed as the weapon type (TYPE_HIT, etc.), but I can't remember exactly. Also, you'll need to 'extern int wooden[]' at the top of the damage function. > Is there an easier way to do this? How can I call the AFF without placing > checks all over the place.. I am preatty sure that it is a BIG waste of > space constantly checking everything.. > > Any ideas? Sadly, it requires to put in checks, but you can ease the pain by making creative use of tables and booleans where the same affect flag might be checked continously, or for things that treat it specially. I can offer no better solution, but this. A good place to use booleans to represent the affect flag check is where it is checked quite often. With things like AFF_WOODEN, however, no functions would exist that had a main concentration of where it would be checked, save the violent spell function, which is done not by having the boolean set to true or false according to whether the victim is affected by it, but by saying asking whether or not the spell should pay attention to it. Anyway, if I talk any longer I'll probably confuse myself and then everyone else to follow (I've not slept in a long time).
This archive was generated by hypermail 2b30 : 12/18/00 PST