• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] A beam spell I was working on

Status
Not open for further replies.
It fatal's.. it appears at 2 casts or higher, can anyone explain why to me if they can spot the issue?

[trigger=]
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Beam
Actions
Set Kbeamindex = (Kbeamindex + 1)
Set KbeamCaster[Kbeamindex] = (Triggering unit)
Set Kbeampoint = (Position of KbeamCaster[Kbeamindex])
Set Kbeamu[Kbeamindex] = (Last created unit)
Set Kbeamtarget[Kbeamindex] = (Target point of ability being cast)
Lightning - Create a Healing Wave - Secondary lightning effect from source Kbeampoint to target (Kbeampoint offset by (50.00, 50.00))
Set Kbeambeam[Kbeamindex] = (Last created lightning effect)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Kbeamindex Equal to 1
Then - Actions
Trigger - Turn on Untitled Trigger 002 <gen>
Else - Actions
Custom script: call RemoveLocation(udg_Kbeampoint)

[/trigger]



[trigger=]
Events
Time - Every 0.04 seconds of game time
ConditionsActions
For each (Integer Kbeamloop) from 1 to Kbeamindex, do (Actions)
Loop - Actions
Set Kbeamoffset[Kbeamloop] = (Kbeamoffset[Kbeamloop] + 30.00)
Set Kbeampoint = (Position of KbeamCaster[Kbeamindex])
Set Kbeampoint2 = (Kbeampoint offset by Kbeamoffset[Kbeamloop] towards (Angle from Kbeampoint to Kbeamtarget[Kbeamloop]) degrees)
Lightning - Move Kbeambeam[Kbeamloop] to source Kbeampoint and target Kbeampoint2
Special Effect - Create a special effect at Kbeampoint2 using Abilities\Spells\Human\FlakCannons\FlakTarget.mdl
Special Effect - Destroy (Last created special effect)
Unit Group - Pick every unit in (Units within 90.00 of Kbeampoint2 matching ((((Matching unit) belongs to an enemy of (Owner of KbeamCaster[Kbeamloop])) Equal to True) and ((((Matching unit) is dead) Not equal to True) and (((Matching unit) is hidden) Not equal to True)))) and do (Actions)
Loop - Actions
Unit - Cause KbeamCaster[Kbeamloop] to damage (Picked unit), dealing 30.00 damage of attack type Spells and damage type Magic
Special Effect - Create a special effect attached to the chest of (Picked unit) using Objects\Spawnmodels\Human\HumanBlood\HumanBloodFootman.mdl
Special Effect - Destroy (Last created special effect)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Or - Any (Conditions) are true
Conditions
(KbeamCaster[Kbeamloop] is dead) Equal to True
(Distance between Kbeampoint2 and Kbeamtarget[Kbeamloop]) Less than or equal to 40.00
(Distance between Kbeampoint and Kbeamtarget[Kbeamloop]) Less than or equal to 40.00
Then - Actions
Set KbeamCaster[Kbeamloop] = KbeamCaster[Kbeamindex]
Set KbeamCaster[Kbeamindex] = No unit
Set Kbeamu[Kbeamloop] = Kbeamu[Kbeamindex]
Set Kbeamu[Kbeamindex] = No unit
Set Kbeamoffset[Kbeamloop] = Kbeamoffset[Kbeamindex]
Set Kbeamoffset[Kbeamindex] = 0.00
Set Kbeambeam[Kbeamloop] = Kbeambeam[Kbeamindex]
Lightning - Destroy Kbeambeam[Kbeamindex]
Set Kbeamtarget[Kbeamloop] = Kbeamtarget[Kbeamindex]
Custom script: call RemoveLocation(udg_Kbeamtarget[udg_Kbeamindex])
Set Kbeamindex = (Kbeamindex - 1)
Set Kbeamloop = (Kbeamloop - 1)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Kbeamindex Equal to 0
Then - Actions
Trigger - Turn off (This trigger)
Else - Actions
Else - Actions
Custom script: call RemoveLocation(udg_Kbeampoint)
Custom script: call RemoveLocation(udg_Kbeampoint2)

[/trigger]


Edit: I found out why it fatals, it seems to be because the lightning action however another bug hidden somewhere in my code is the reason for it.... The bug makes a index ignore itself or something and then when the lightning follows it fatals somehow. Like when one instance stops the other instance follows it exactly.

Edit2: Is it because of the point array?

Edit3: Read Post #3 ( The lightning fatal issue )
 
Last edited:
Level 25
Joined
May 11, 2007
Messages
4,650
Doesn't this leak?
"Unit Group - Pick every unit in (Units within 90.00 of Kbeampoint2 matching ((((Matching unit) belongs to an enemy of (Owner of KbeamCaster[Kbeamloop])) Equal to True) and ((((Matching unit) is dead) Not equal to True) and (((Matching unit) is hidden) Not equal to True)))) and do (Actions)"

You should set it to a tempgroup first that you then destroy.
 
I already know this though thank you... It isn't really a concern right now LordDz, the issue at hand is the lightning fatal as well somehow the indexing messes up.

EDIT: Does anyone know the line for nulling lightning? It's the reason for the fatal. #10 on http://www.hiveworkshop.com/forums/world-editor-help-zone-98/list-warcraft-iii-crashes-194706/

Still the indexing is messing up even so.

EDIT2: I fixed the indexing mess, it appears point array variables don't work with indexing. However the lightning still causes a fatal.... Kind of need help on that. =(
 
Last edited:
You are removing the wrong locations that is why.
Change this.
  • Set Kbeamtarget[Kbeamloop] = Kbeamtarget[Kbeamindex]
  • Custom script: call RemoveLocation(udg_Kbeamtarget[udg_Kbeamindex])
To this.
  • Custom script: call RemoveLocation(udg_Kbeamtarget[udg_Kbeamloop])
  • Set Kbeamtarget[Kbeamloop] = Kbeamtarget[Kbeamindex]
Also just because you can't get something to work correctly does not mean that everyone else is wrong.
 
Status
Not open for further replies.
Top