- Joined
- Aug 31, 2018
- Messages
- 167
if dg_index == 0 then
// do something
else if dg_index == 0 then
// do something else
end
Thank you, but oh, i am so doomed, lol. I used ChatGPT to help me do that. I dont have experience with world editor, but from what i see, i may consider and just give the map to someone else ^^your indexing is off, since default value of DG_Index is zero. Yet your loop is iterating from value 1 till DG_Index.
Your deindexing doesn't work because you do not properly deindex instances.
You should also either choose arrays or hashtable and use that for everything in your spell. Mixing it doesn't make much sense.
Read Visualize: Dynamic Indexing to see how to properly index and deindex instances.
You do not clean leaks after yourself. This is especially bad with the "Move unit" action inside that 0.03 loop. Check Things That Leak to see how to fix it.
Same for your hashtable values - you do not clean up after yourself.
Your DG_Index check at the end of the loop trigger doesn't make sense, it basically says:
JASS:if dg_index == 0 then // do something else if dg_index == 0 then // do something else end
Sadly it still doesnt work :/ The guy above gave me useful info to read and understand, but the thing is, i dont want to become a developer, i just need to fix this spell so the map becomes editable, because right now no matter whan change we do on the map, we are left without this important spell and i need to fix it in order to keep map working/clean. So i just need easy solution to make this workHave you tried moving DG_INDEX = DG_INDEX + 1 to the top of the first trigger?
Spell is literally Death Knight (from WoW) death grip (the pull/grab ability) and the map is WoW Arena Allstars itself. Catze (the creator) used same variables/hashtables on that skill and when you open the map, no matter what change u do, the trigger for that spell just breaks. So i am trying to remade it, but i am lacking skills and used ChatGPT to help me. The picture above you see is what he told me to do, but for some reason its not working.Can you provide description of the spell and your Warcraft III patch?
Event: Map Initialization
Action:
Hashtable - Create a hashtable and store it in DeathGripTable
Set DeathGripGroup = (Empty group)
Event: Unit starts the effect of an ability
Condition: Ability being cast = Death Grip
Actions:
Set Caster = Triggering Unit
Set Target = Target unit of ability being cast
Custom script: set bj_wantDestroyGroup = true
Unit Group - Add Target to DeathGripGroup
Hashtable - Save (Caster) as 0 of (Handle of Target) in DeathGripTable
Hashtable - Save 0.00 as 1 of (Handle of Target) in DeathGripTable
Turn on skill Loop
Event: Every 0.03 seconds
Actions:
Unit Group - Pick every unit in DeathGripGroup and do actions:
Set Target = (Picked unit)
Hashtable - Load 0 of (Handle of Target) in DeathGripTable → Caster
Hashtable - Load 1 of (Handle of Target) in DeathGripTable → Timer
If (Target or Caster is dead) then:
Remove Target from DeathGripGroup
Clear hashtable entries
then we skip to next unit
Set Angle = (Angle from Position of Target to Position of Caster)
Set Distance = Distance between them
If (Distance <= 100 or Timer >= 1.50) then:
Remove Target from DeathGripGroup
Clear hashtable entries
Else:
Move Target instantly to (Target position offset by 20 toward Angle) with pathing
Save (Timer + 0.03) as 1 of Handle of Target