View Single Post
Old 06-07-2003, 09:10 AM   #7
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 41
Posts: 5,459
One of the problems I am having with the script is that it requires you to
a) be the DM
b) carry a torch
or c) deal it it's entire HP's worth of fire and acid damage
in order to kill it. a) is a good thing. b) is fine (I like it when you can use a torch for multiple purposes). c) is rather ridiculous. I'll tell you why.

In order to kill a standard troll using a torch, you need to deal it 27 points of any kind of damage. Then you light the torch. Done.
In order to kill the troll with a sword that does an additional D6 points of fire damage you need to deal it 28 points of fire damage (acid works too). The amount of regular damage you deal does not matter here, even though it did matter with the torch. To deal it 28 points of fire damage at 1D6 per attack, you'll need to hit it 8 times, on average. Once the troll is down, you cannot harm it. Which means that even with 5 apr you'll be spending a round or six just to kill that one troll. A 1 fire damage weapon takes even longer.
These are highly prized, very powerful magical weapons, and yet they take four times longer than using a burning rag? Not very realistic, and rather annoying. It'd be better if you only needed fire damage to harm it once it reached a near death stage, rather than having to deal the troll's entire hitpoints' worth.


Even so, it is a cool script. Unfortunately, it shot my character all the way from level 10 to level 20 in a matter of minutes, with me not killing a single troll.


I've examined the script and ran some tests, and came to the conclusion that the script is perfect as long as you
a) don't deal the troll 28+ points of fire or acid damage right away
or b) use a character with only 1 apr and/or only fight a single troll at a time.

If you break condition a) there's a problem with the XP as described in the script.
Breaking b) will mean you'll gain experience even from not killing the trolls. Below are the parts of the script dealing with removing the XP when the troll is not truely dead. The bold line is where I believe the problem to lie.

Quote:
else if(nUser == 1005) // ATTACKED
{
object oLastAttacker = GetLastAttacker();
int nAttackerXP = GetXP(oLastAttacker);
int nCurrentHPs = GetCurrentHitPoints(OBJECT_SELF);
SetLocalInt(oLastAttacker, "nAttackerXP", nAttackerXP);
}
else if(nUser == 1007) // DEATH
{
object oLastAttacker = GetLastKiller();
int nCurrentAttackerXP = GetXP(oLastAttacker);
int nPrevAttackerXP = GetLocalInt(oLastAttacker, "nAttackerXP");
int nXPValue = nCurrentAttackerXP - nPrevAttackerXP;

effect eRes = EffectResurrection();
{
SetIsDestroyable(FALSE, TRUE, TRUE);
DelayCommand(6.0f, ApplyEffectToObject(DURATION_TYPE_INSTANT, eRes, OBJECT_SELF, 0.0f));
DelayCommand(6.0f, (SetIsDestroyable(TRUE, FALSE, FALSE)));

oAttackingGroupMember = GetFirstFactionMember(oLastAttacker, TRUE);
while (oAttackingGroupMember != OBJECT_INVALID)
{ DelayCommand(6.0f, PrintString("Resurrected"));
DelayCommand(6.0f, SetXP(oAttackingGroupMember, (GetXP(oAttackingGroupMember) - nXPValue)));
DelayCommand(6.0f, SendMessageToPC(oAttackingGroupMember, "The Troll is not dead yet!"));
oAttackingGroupMember = GetNextFactionMember(oLastAttacker, TRUE);
}
}
}
It basically says that whenever a troll is attacked, a player must store his XP in his own local int. When you attack one troll at a time, this works perfectly. You cannot attack or kill a troll that is already down.
What happens when fighting several trolls is that you 'kill' one, and get the experience. 6 seconds later it will be removed again.
Then you fight another troll. Your current XP is stored, and it'll get up 6 seconds later. This XP includes the XP you received for 'killing' the first troll.
Now, when the first troll's 6 seconds have passed, it runs a
Quote:
SetXP(oAttackingGroupMember, (GetXP(oAttackingGroupMember) - nXPValue))
command, but because you attacked and 'killed' another troll in the mean time, you've set a new nPrevAttackerXP, and calculated a new nXPValue. What that comes down to is that most of the time, you'll lose no XP at all.

At 10th level, getting roughly 1400 XP for each hit that deals 1+ damage to a troll will see you advance most rapidly.


Although I have not yet tested it, I assume that storing the last attacker's XP in the troll rather than the character would do the trick. That would mean changing all lines involving the "nAttackerXP" local int. Instead of Get/SetLocalInt(oLastAttacker, "nAttackerXP", ...);, you'd use Get/SetLocalInt(OBJECT_SELF, "nAttackerXP", ...);.

I'll go give it a try soon.
Legolas is offline   Reply With Quote