View Full Version : Pacify / Line of Sight help
NikonRZ
02-03-2013, 09:47 PM
I am having an issue with Pacify, and Theft of Thought working as intended on our server. I assumed it would be a fairly easy fix. I did a little research and came across a changelog that listed these changes as already being addressed. See below.
==02/10/2008
WildcardX: Mesmerize line of spells will now cause aggro when casted on a mesmerize immune mob.
WildcardX: Fixed enchanter spell Theft of Thought. This spell will now work as described.
WildcardX: The pacify/harmony line of spells will no longer require a line of sight check to complete a cast.
Is there a post about these code changes and what needs to be changed for this to be fixed? or do you know if this is handled in spells.cpp? I have only been working on this code for a couple months on and off and would appreciate some direction of any kind. More directly, Pacify should not need line of sight, and theft of thought should be unresistible.
I see this in the code
}
float range = spells[spell_id].range;
// solar: check line of sight to target if it's a detrimental spell and if its DT
if(this->GetClass() != 8) {
if(spell_target && (!IsBeneficialSpell(spell_id) || IsDamageSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].id != 982))
{
NikonRZ
02-04-2013, 11:20 AM
Maybe I'm not asking the right question. What needs to be changed that controls the need for "line of sight" for spells or spell lines?
c0ncrete
02-04-2013, 11:59 AM
as far as i know, there is no explicit toggle for LoS checks in the spell data. instead, the server is hard coded to check for LoS based upon the effects of the spell.
the snippet you posted, for example, checks for a negative return from IsHarmonySpell(), which checks for SE_Harmony or SE_ChangeFrenzyRad in the spell id you send as the parameter. if any of these are found, it's considered a harmony spell and the LoS check is ignored.
bool IsHarmonySpell(uint16 spell_id)
{
// IsEffectInSpell(spell_id, SE_Lull) - Lull is not calculated anywhere atm
return (IsEffectInSpell(spell_id, SE_Harmony) || IsEffectInSpell(spell_id, SE_ChangeFrenzyRad));
}
NikonRZ
02-04-2013, 02:17 PM
Oh, well thank you for the reply. I see what your saying, but my problem is that I want the LoS check to be ignored when casting Harmony line spells (like its supposed to be), however it is not being ignored, instead, you must have line of sight to cast harmony spells. Do you know what I would need to change/edit (in the hardcode) to fix this? Thanks so much.
c0ncrete
02-04-2013, 02:52 PM
... what i am saying is that it's already coded to ignore LoS checks for spells with SE_Harmony or SE_ChangeFrenzyRad.
// check line of sight to target if it's a detrimental spell
if(spell_target && IsDetrimentalSpell(spell_id) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id))
{
mlog(SPELLS__CASTING, "Spell %d: cannot see target %s", spell_target->GetName());
Message_StringID(13,CANT_SEE_TARGET);
return false;
}
i'm not sure where you got the snippet you posted, but the above is from Mob::SpellFinished in spells.cpp
NikonRZ
02-04-2013, 03:18 PM
Thanks again for the reply....
I see the code....., I see where it is already supposed to be ignoring LoS checks for Harmony line spells, but in-game on this server you must have line of sight, and also, in that code it pushes a message "CANT_SEE_TARGET",..for spells that need LoS, which works fine.
In-game: if I try casting a harmony spell without LoS it doesn't even try to cast, shows the timer maybe for 1/10 of a second and won't cast. If you try to cast anything else without LoS it shows message as intended. Here is the code I'm using.
Is there a syntax issue? Do you mind looking over this?
float range = spells[spell_id].range;
// solar: check line of sight to target if it's a detrimental spell and if its DT
if(this->GetClass() != 8) {
if(spell_target && (!IsBeneficialSpell(spell_id) || IsDamageSpell(spell_id)) && !CheckLosFN(spell_target) && !IsHarmonySpell(spell_id) && spells[spell_id].id != 982)
{
if(this->IsClient()) {
range *= 0.35 + 0.40 * (this->GetSkill(spells[spell_id].skill) / this->CastToClient()->MaxSkill(spells[spell_id].skill, WIZARD, this->GetLevel()));
}else{
mlog(SPELLS__CASTING, "Spell %d: cannot see target %s", spell_target->GetName());
Message_StringID(13,CANT_SEE_TARGET);
return false;
}
Could the code in red checking for range be causing the problem?
c0ncrete
02-04-2013, 03:57 PM
you stated you were having a LoS issue, which you apparently aren't. if you were, you'd be getting the message about not being able to see the target instead of it simply not casting.
it will be very difficult, if not impossible, for anyone to troubleshoot issues with your custom code without being able to look at all of it. i suggest adding logging messages so you track down the issue..
NikonRZ
02-04-2013, 04:24 PM
I get what your saying, we might all think differently I guess. I mean how else would I describe a problem with a spell that works other then you can't cast it unless you have LoS to the target. I assume the -LoS to target- code is limited. I also assume you have been through this code millions of times, also this is not custom code, the only thing custom is the range check which I stripped, returned back to original yet still have the issue.
Not sure what logs I should be looking at.
Other than Line of sight all harmony spells work fine, they just currently need line of sight.
I am hoping someone can point me in the right direction.
c0ncrete
02-04-2013, 04:41 PM
am i correct in understanding that you are not getting the message that you can't see your target when you cast harmony, but it just isn't completing the casting of the spell? if that's the case and other spells that require line of sight are providing that message, but harmony is not, then the issue isn't with the line of sight check, it's somewhere else in your code.
what file (and class/function) is what you are posting in? i'm not seeing any source files with that comment from solar, nor am i finding any with the bard check.
as for logging, you'd want to add lines that would write messages to the log file(s) like this one:
mlog(SPELLS__CASTING, "Spell %d: cannot see target %s", spell_target->GetName());
and then you'd have to enable logging for that particular category, as explained here
http://www.eqemulator.net/wiki/wikka.php?wakka=ServerLogSys
that'll help you track down any problems you have when working with the source code not doing what you are expecting.
NikonRZ
02-04-2013, 04:49 PM
Thanks for taking your time to help me. It means alot. I'll do that and report back.
Derision
02-04-2013, 05:22 PM
it will be very difficult, if not impossible, for anyone to troubleshoot issues with your custom code without being able to look at all of it.
It looks like he is using the old VZTZ source:
http://code.google.com/p/vztzfebsource/source/browse/trunk/zone/spells.cpp#1316
Could be changes elsewhere that is stopping it working, e.g. the IsHarmony function in that repo is different than ours: http://code.google.com/p/vztzfebsource/source/browse/trunk/zone/spdat.cpp#202
(checks for SE_Lull rather than SE_ChangeFrenzyRad)
NikonRZ
02-04-2013, 07:28 PM
Yes. Yes, and Yes. Checking that now. Thanks Derision & Concrete, cool of you guys to give me some direction.
NikonRZ
02-05-2013, 04:27 PM
I fixed it. It was a number of things. Too much to list. Thanks so much for the help.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.