• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Spell] In my lightning-based spell, source target can't be moved for some reason

Status
Not open for further replies.
Level 7
Joined
Feb 27, 2010
Messages
184
Hello, I'm making a spell for my hero arena (Icecrown Arena, work in progress), where a hero gets bound onto an enemy for a few seconds, keeping him in a 550 distance with the enemy. I've based the spell on a Channel and triggered it and it all seems to work, except for moving the lightning effect. For some reason, the source of the lightning remains on the casting location (even though the target location is getting changed correctly).

This is how the spell looks when Gnoll casts it on Pit Lord and a few seconds pass:
hRNc5bj.png


Note: I'm making the spell MUI -> every variable is marked by the triggering player's number (every player can have max 1 hero, but other players can use the same heroes), so it is a little cluttered, sorry for that. And I'm not using hashtables,which I probably should've but I don't feel like changing it now. The spell is WIP, some stuff will be updated, e.g. the lightning height.

Here is the code:

875rBIC.png


It seems that instead of new ChainUpX1, ChainUpY1 and ChainUpZ1, old values are used throughout the spell. However, X2, Y2 and Z2 work correctly. More interestingly, I tried logging the ChainUpX1 values, it has the correct updated value right before the MoveLightning command, so I suspect the problem is somewhere in it.

Does anyone know what can be done about this? Is the problem on Blizzard side, or am I misunderstanding something? Thanks for any help!
 
Level 19
Joined
Feb 27, 2019
Messages
577
As far as I can see it might be a quirk in the engine.

Since everything else in your trigger works fine as you say the only issue I can imagine, imagining freely here, is that there is some issue with the custom scripts when used in the loop. But as you say the X2 Y2 and Z2 work fine its giving me a huge headache to try to even imagine more. One step would be to rule out that the loop is causing the issue by testing to remove the loop and copy paste the actions. I think some testing is in order to figure out the root of the problem. I have a few other ideas but they would just be speculation.
 
Level 19
Joined
Feb 27, 2019
Messages
577
Try changing set ChainUpCaster = Casting unit -> Triggering unit

It would be easier to read and also a more effective trigger if you use an integer to store some value like Set Int = (Player number(Triggering Player)) then use this integer instead of GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())). The variable has to be set after each wait. You can use Int to reference the ChainUpCaster index aswell as the ChainUpTarget index.

JASS:
set udg_AllPigsArray[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = udg_AOEDamageSource
set udg_AllPigsArray[udg_Int] = udg_AOEDamageSource
Here you can see that using an integer variable instead will remove a lot of function calls.
 
Level 12
Joined
Feb 5, 2018
Messages
521
Move lightning effect broke at some point. I had the same issue once. Solved it by just creating the lighting again from the loc1 to loc2 in a loop.

So instead of moving the lightning just create it again. :)
 
Level 7
Joined
Feb 27, 2010
Messages
184
Yes, I tried destroying the lightning and creating a new one and it works. Thanks!

Try changing set ChainUpCaster = Casting unit -> Triggering unit

It would be easier to read and also a more effective trigger if you use an integer to store some value like Set Int = (Player number(Triggering Player)) then use this integer instead of GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit())). The variable has to be set after each wait. You can use Int to reference the ChainUpCaster index aswell as the ChainUpTarget index.

JASS:
set udg_AllPigsArray[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))] = udg_AOEDamageSource
set udg_AllPigsArray[udg_Int] = udg_AOEDamageSource
Here you can see that using an integer variable instead will remove a lot of function calls.
Good idea, thanks as well :)
 
Status
Not open for further replies.
Top