Buffing NPC - Casting Several Spells
I have been working on making npc's in the guild lobby that buff players. The problem I have run into is dealing with casting spells with enough duration to be usable.
The following code works, but doesn't work well. The spells duration is only about 3 minutes, due to the way selfcast works (duration involves level, I know). In the case of a new character, I opted for not casting temperance, because that's too powerful, but cast 3 lower level cleric spells instead. symbol of transal, valor and guard. It works, but the durations are only like 3 minutes, because I can only get it to work with selfcast. I have tried using $npc->CastSpell(4053, $userid); with the 3 spells, but only the first one casts. I have looked for some kind of a delay in order to wait for the spell to be cast and recovery time, then cast another, but have not been successful in finding that kind of command. How can I set this up to buff a new low level character, without dieing during the casting, with the duration being say 45 minutes, for 2 or more spells? I've thought about temporarily upping the characters level to 70 so that the duration will increase, then reset the level after the spells are selfcast, that's the only thing I have considered. What other options are there? Thanks, Riklin sub EVENT_SAY { if ($text=~/hail/i) { quest::say("Hello $name. I cast Cleric buffs. Which buff would you like? [HitPoints], [SpellHaste], [Healing] or [Curing]?"); } elsif($text=~/hitpoints/i) { if ($ulevel >= 1 and $ulevel < 35) { quest::selfcast(312); quest::selfcast(485); quest::selfcast(18); } if ($ulevel > 34 and $ulevel < 61) { $npc->CastSpell(4053, $userid); } if ($ulevel > 60) { $npc->CastSpell(9811, $userid); } } } |
Spell Duration has nothing to do with the quest::selfcast as far as I am aware, you could try adjusting the duration of the spell in the spells table? Also, when you post code you may want to put it in code blocks. You know you can also use saylinks so they click a purple 'link' and it says the text before them? Your script is re-written below using them. The , 1 after the "whatever" makes it so that the text within the saylink isn't said out loud. Also, you can use plugin::Whisper, case-sensitive, to whisper the text to the player rather than say it out loud, however, if you want to send a message to a player in a 'whisper' from something other than an NPC you have to use a $client->Message or it will not work, I hope I helped. ~Harbinger Zamthos
Code:
sub EVENT_SAY |
Level DOES affect the duration of spells. IT's a SIMPLE thing to test. take a level 1 GM level character and type #cast 312. This will cast Valor with around a 3 minute duration. Then type the GM command #level 70 and set your test character to level 70. NOW type #cast 312. The spell lasts for a duration of 54 minutes 6 sec.
Level has been a known entity in spell duration for as long as I have played EQ. Selfcast uses your stats when it casts the spell you have requested. Level is a key part of determining how long the spell will last (duration). That simple test proves it... The thing I'm trying to get some answers on is how to increase the duration of a "selfcast" spell. "castspell" works perfectly, but it only works for casting a single spell. It does not work, at least I cannot get it to work, for cases where you want to cast 2 or more spells back to back... Rick |
I have been playing around with this for about 30 minutes now trying to help you out and im on one last hope that I figured it out but its doubtful.
I used: Code:
UPDATE spells_new set buffdurationformula = 11 where buffgroup = 32 If I knew the buffs I wanted to change the formula for I would do it this way; Code:
UPDATE spells_new set buffdurationformula = 11 where id = 9820 and id = etc etc etc *I stand corrected I did get it using that code, however I would do more research on the exact "spell group" before doing it as I did, or perhaps put all the spells you want into a spell group and then you can change them together if you do not like the results. You can effecitvely cast Temerity rk 3 on a lvl 1 using buff bot for a 2 hour duration. |
Changing the formula used for a bunch of spells seems like the backward way to solve this issue.
Use SpellFinished instead of CastSpell. |
What makes this even more frustrating is I've tried having an NPC use the castspell command with group type buffs. The problem is that it seems the NPCS do not have "/tgb ON" set, so they cannot cast their group buffs on groups. They only self buff the NPC.
Right now, I have figured out how to cast buffs that do not last for more than 3-4 minutes. Cast spells on a single target only (not the group or pets or mercs. Cast group spells on the NPC, but not the group itself. It seems like this should not be as hard as I'm making it, but there don't seem to be many options. One thing that DID work is to temporarily set level to say level 70, then selfcast, then set level back to what it was before. That causes the duration to work perfectly. The problem with this is obvious. Sooner or later the level setting code will fail and someone will be left at level 70... |
Jut give everyone items with click effects
|
Clicky effect items? That's a possibility, but I think a common gathering place, such as the guild lobby for buffage, etc. is a good thing for the game overall. I like the illusion of people caring and buffing others to help them in their goals. That to me, is a better thing than the idea of everything being based on money and merchants, even if the buff "merchants" don't charge for their clicky items...
Rick |
I cannot find any reference to "SpellFinished" anywhere. I did try replacing CastSpell with SpellFinished, but it does not do anything. No casting at all.
|
I use selfcast myself and it seems to cast group buffs on the entire group and bots. I do know if you buff the pet with an NPC the owner gets the buffs as well.
My problem with the level increase/decrease is what you already stated with the "oops" factor. If youre using the tutorial maybe just set the zone to suspend buffs. By the time they leave that area they will get higher duration buffs anyway. Also another thing I havent tested is wether or not setting the formula to the "duration" or 11 setting is if it has a focus item check first. |
Selfcast works very well, except for the duration of the spells. You have to be up over say level 40 before spells cast with selfcast have enough duration to be useful. On my server, we're trying to use ingame travel and not use GM commands. This means that at lower levels, selfcast spells won't last long enough to get you to your hunting grounds, let alone a battle or three...
|
Spell duration is based on the player that CAST the spell. (This is pulled from the spell duration formula int he spells_new table)
So if you have an NPC casting the spell ON you... it will last longer if they are a high level NPC. My low level spells are cast by the NPC and last full duration on a level one. I only have that for grouped players currently... but I have Mercs enabled so most players SHOULD be grouped at low level. |
Quote:
You can also look at plugins/group_utility.pl in CastOnGroup for an example. |
$Group->CastGroupSpell Can cast spells on a group, and I never said that duration didn't have to do with level, just that the quest::selfcast had nothing to do with it, and it doesn't, the spell itself is influenced once cast, not by the quest::selfcast itself. You can also do something like the below.
Code:
sub EVENT_SAY |
Quote:
|
All times are GMT -4. The time now is 10:11 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.