|
-
Apprentice
Making a chargeable spell affect multiple targets (VisualFX)
Hey ,
So, I have made the spell Destroy Undead work in a similar fashion as Large Fireball, so you can charge up spell levels to increase its damage. This works. I also wanted to change the spell to affect multiple enemies, like Large Firestorm, but I can't get this to work.
The problem is that the spell level is lost on enemies that get hit by non KEY_CAST effects (e.g. if I charge up to tier 4, they receive damage as if hit by tier 1). I have been trying to understand the visual FX for large firestorm, but I can't get it to work.
Here is the visual FX that I have for the spell. It works for damaging a single enemy that the KEY_CAST projectile hits, dealing appropriate damage for charged spell level.
Code:
INSTANCE spellFX_DestroyUndead(CFx_Base_Proto)
{
visname_S = "MFX_DestroyUndead_INIT";
emtrjmode_s = "FIXED";
emTrjOriginNode = "ZS_RIGHTHAND";
emtrjtargetnode = "BIP01 FIRE";
emtrjloopmode_s = "NONE";
emtrjeasefunc_s = "LINEAR";
emActionCollStat_S = "COLLIDE CREATE";
emActionCollDyn_S = "COLLIDE CREATEONCE";
emFXCollStat_S = "spellFX_Destroyundead_COLLIDE";
emFXCollDyn_S = "spellFX_Destroyundead_COLLIDE";
emTrjTargetRange = 20;
emTrjTargetElev = 0;
emTrjDynUpdateDelay = 20000;
};
INSTANCE spellFX_DestroyUndead_KEY_INIT (C_ParticleFXEmitKey)
{
visname_S = "MFX_DestroyUndead_INIT";
};
INSTANCE spellFX_DestroyUndead_KEY_INVEST_1 (C_ParticleFXEmitKey)
{
emCreateFXID = "spellFX_DestroyUndead_INVEST_BLAST";
sfxid = "MFX_SHRINK_INVEST";
sfxisambient = 1;
};
INSTANCE spellFX_DestroyUndead_KEY_INVEST_2 (C_ParticleFXEmitKey)
{
emCreateFXID = "spellFX_DestroyUndead_INVEST_BLAST";
sfxid = "MFX_SHRINK_INVEST";
sfxisambient = 1;
};
INSTANCE spellFX_DestroyUndead_KEY_INVEST_3 (C_ParticleFXEmitKey)
{
emCreateFXID = "spellFX_DestroyUndead_INVEST_BLAST";
sfxid = "MFX_SHRINK_INVEST";
sfxisambient = 1;
};
INSTANCE spellFX_DestroyUndead_KEY_INVEST_4 (C_ParticleFXEmitKey)
{
emCreateFXID = "spellFX_DestroyUndead_INVEST_BLAST";
sfxid = "MFX_SHRINK_INVEST";
sfxisambient = 1;
};
INSTANCE spellFX_DestroyUndead_KEY_CAST (C_ParticleFXEmitKey)
{
visname_S = "MFX_DestroyUndead_CAST";
emtrjmode_s = "TARGET";
emtrjeasevel = 800.;
sfxid = "MFX_DestroyUndead_Cast";
sfxisambient = 1;
emCheckCollision = 1;
};
INSTANCE spellFX_DestroyUndead_INVEST_BLAST (CFX_Base_Proto)
{
visname_S = "MFX_DESTROYUNDEAD_COLLIDE"; // placeholder
sfxid = "MFX_DESTROYUNDEAD_COLLIDE"; // placeholder
sfxisambient = 1;
};
INSTANCE spellFX_Destroyundead_COLLIDE (CFx_Base_Proto)
{
emTrjOriginNode = "BIP01";
visname_S = "MFX_DESTROYUNDEAD_COLLIDE";
emtrjmode_s = "FIXED";
emtrjdynupdatedelay = 0.;
lightpresetname = "AURA";
sfxid = "MFX_DESTROYUNDEAD_COLLIDE";
sfxisambient = 1;
};
I am beginning to suspect there is something hardcoded with large firestorm, because I can't find my error. I would assume I am not the first one to try to create a chargeable area of effect spell, so I wonder if anyone knows what I might be missing. What changes should I make to allow the spell hit multiple enemies with correct spell level?
I am also curious if anyone has any documentation for the user string quad wizardry. I can kind of guess how it works and I can work with it, but it's pretty opaque. Why for example large firestorm has it in the main spell fx (spellFX_Pyrokinesis) as well as the area collision fx (spellFX_Pyrokinesis_SPREAD)?
Thanks!
-
Apprentice
No wonder I can't find my error. This issue is present with Large Firestorm as well!
I was naturally assuming that that for the vanilla game spell it would work.
EDIT
I have been exploring this for a while. As far as I can tell, the spell ID is correctly passed to a non-KEY_CAST visual fx, but the spell level and category are not. I am not able to make the KEY_CAST particle fx itself hit multiple targets and I don't really have the know how to hook some effect creation function to patch these values in there somewhere..
I have been trying to figure out a workaround, unsuccessfully so far. One idea I had is that you read something off the caster when the target is damaged, that is stored when the spell is cast, but at the point the spell hits its target whatever you are reading might have been reset due to new casting of some spell (e.g. AIV_SpellLevel)
Geändert von LootaBox (05.01.2020 um 15:07 Uhr)
-
I used a workaround, which is based on some scripts that are scattered in this forum.
With this, you can hook the function, which is called, when some npc is damaged. There, you can check, what is the course of the damage. You could for instance check, if the course is a visual effect and check its name like this:
Code:
if (Hlp_StrCmp(dmgDesc.visualFXStr, "spellFX_Windfist_SENDPERCEPTION")) {
broadcast(victimNpc, broadcastAOEDamageForMySpell);
};
The broadcast function is explained and found here. The broadcasted function is called for every npc in the game. There you could check, if other npcs are near the target and should be damaged through an AOE effect.
Code:
func void broadcastAOEDamageForMySpell(var C_NPC me, var C_NPC caster) {
// caster and target should be valid
if(!Hlp_IsValidNpc(me)) || (!Hlp_IsValidNpc(caster)) {
return;
};
// hero does not get hit by this
if (Npc_GetId(me) == Npc_GetId(hero)) {
return;
};
if (Npc_GetDistToNpc(me, caster) <= 500) // If I am an npc standing next to the original target
&& (!me.aivar[AIV_PARTYMEMBER]) { // The spell is so intelligent to not hurt party members
// do damage and other stuff here
};
};
I didn't check, if this logic works with chargeable spells. The important thing to test is if every charge-level produces a different visualFXStr. If that's the case, you can do damage based on this effect-string. If that is not possible, you could fire an additional (invisible) effect with the same speed with Wld_PlayEffect() inside the spell logic of ChargeFireball and check for that effect-string.
-
Apprentice
Thank you, I think this is a good idea.
I am figuring out an alternative targeting system for some spells (like the one on the blink spell from mud-freak), and this trick might be the key to make spells like firestorm work with that.
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
|
|