• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Merging lightnings upon trying to move them

Status
Not open for further replies.

Ardenian

A

Ardenian

Hello, I would like to add an update for my lightning effects in my Power System.

For some reasons, my approaches to do so heavily bug my system though.
Is it a general Blizzard problem or did I do something wrong ?

This is what I did:


  • Set PS_TempUnitType = (Unit-type of PS_Generator[PS_TempInteger2])
  • Custom script: set udg_PS_TempInteger = udg_PS_TempUnitType
  • -------- ... --------
  • Custom script: set udg_PS_TempLightningType = LoadStr(udg_Hash_PowerSystem, udg_PS_TempInteger, 0)
  • Blitz - Create a PS_TempLightningType lightning effect from source PS_TempLocOrigin to target PS_TempLocAim
  • Set PS_LightningIndex[PS_TargetMaxIndex] = (Last created lightning effect)
  • Custom script: set udg_PS_X = GetLocationX(udg_PS_TempLocOrigin)
  • Custom script: set udg_PS_Y = GetLocationY(udg_PS_TempLocOrigin)
  • Custom script: set udg_PS_Z = GetLocationZ(udg_PS_TempLocOrigin)
  • Custom script: set udg_PS_X_2 = GetLocationX(udg_PS_TempLocAim)
  • Custom script: set udg_PS_Y_2 = GetLocationY(udg_PS_TempLocAim)
  • Custom script: set udg_PS_Z_2 = GetLocationZ(udg_PS_TempLocAim)
  • Custom script: call MoveLightningEx(udg_PS_LightningIndex[udg_PS_TargetMaxIndex], true, udg_PS_X, udg_PS_Y, udg_PS_Z + 70, udg_PS_X_2, udg_PS_Y_2, udg_PS_Z_2 + 70)
The basic creation is fine, but once I try to update it in the loop, as first action, before anything else:


  • For each (Integer PS_TempInteger2) from 1 to PS_SupplierMaxIndex, do (Actions)
    • Loop - Actions
      • For each (Integer PS_TempInteger3) from 1 to PS_TargetMaxIndex, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • 'IF'-Conditions
              • (PS_Suppliedtarget[PS_TempInteger3] is in PS_SupplyGroup[PS_TempInteger2]) Equal True
            • 'THEN'-Actions
              • Set PS_TempLocAim = (Position of PS_Suppliedtarget[PS_TempInteger3])
              • Set PS_TempLocOrigin = (Position of PS_Generator[PS_TempInteger2])
              • Custom script: set udg_PS_X = GetLocationX(udg_PS_TempLocOrigin)
              • Custom script: set udg_PS_Y = GetLocationY(udg_PS_TempLocOrigin)
              • Custom script: set udg_PS_Z = GetLocationZ(udg_PS_TempLocOrigin)
              • Custom script: set udg_PS_X_2 = GetLocationX(udg_PS_TempLocAim)
              • Custom script: set udg_PS_Y_2 = GetLocationY(udg_PS_TempLocAim)
              • Custom script: set udg_PS_Z_2 = GetLocationZ(udg_PS_TempLocAim)
              • Custom script: call MoveLightningEx(udg_PS_LightningIndex[udg_PS_TempInteger3], true, udg_PS_X, udg_PS_Y, udg_PS_Z + 70, udg_PS_X_2, udg_PS_Y_2, udg_PS_Z_2 + 70)
            • 'ELSE'-Aktionen


I did some tests, it is the loop causing the lightning effects to merge.

Basically, once I cast with one generator on a target that already has a generator whit a special effect, the special effect from the first generator merges with the new one in the loop.

What is wrong with it ? I hope the information is sufficient.
 
Last edited by a moderator:
Level 25
Joined
May 11, 2007
Messages
4,651
You're creating each lighting and setting them to
"Set PS_LightningIndex[PS_TargetMaxIndex] = (Last created lightning effect)"
I don't see you increasing PS_TargetMaxIndex or changing it, so all the lightings do share the same index?

Shouldn't it be like
Set PS_LightningIndex[PS_CurrentIndex+=1] = (Last created lightning effect)"
 

Ardenian

A

Ardenian

Yes, that's true, done before the Basic Creation, when indexing the target. Each target shares an array with a lightning, the corresponding one.

I am sorry, I excluded this one in the posted triggers, but it is done in the map and works appropriate, as far as I know.
 
Status
Not open for further replies.
Top