• 🏆 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!

Lightning efffect creation, crashing my WE

Status
Not open for further replies.

Ardenian

A

Ardenian

I would like to save a lightning type ( = string) in my Hashtable, in an arrayed string variable called:
  • Set PS_LightningType[1] = "DRAM"
  • Set PS_LightningType[2] = "SPLK"
Then I save it in the hashtable:

  • Hashtable - Save PS_LightningType[PS_TempInteger2] as 0 of PS_TempInteger in Hash_PowerSystem
Now, in a trigger event, I would like to add actions creating and destroying a lightning effect, and here comes the problem:
  • Set PS_TempUnit = (Target unit of ability being cast)
  • Set PS_TempLocAim = (Position of PS_TempUnit)
  • Set PS_TempLocOrigin = (Position of (Casting unit))
This action disables my trigger, saying 'name attended':
  • Custom script: set udg_PS_TempLightningType = LoadString(udg_Hash_PowerSystem, udg_PS_TempInteger, udg_PS_TempInteger)
How do I load PS_TempInteger correctly ?

PS_TempLightningType is a lightning type variable.

  • Blitz - Create a PS_TempLightningType lightning effect from source PS_TempLocOrigin to target PS_TempLocAim
This crashes my WE:

  • Custom Script: set PS_TempLightning = AddLightningEx(udg_PS_TempLightningType, true, GetLocationX(udg_PS_TempLocOrigin), GetLocationY(udg_PS_TempLocOrigin), GetLocationZ(udg_PS_TempLocOrigin) + 70, GetLocationX(udg_PS_TempLocAim), GetLocationY(udg_PS_TempLocAim), GetLocationZ(udg_PS_TempLocAim) + 70)
  • Set udg_TempLightning = (Last created lightning)
Final action would be:
  • Set PS_IndexLightning[PS_TargetMaxIndex] = TempLightning
For full trigger without these check out the system in the spell section, Power System.

I would be glad if you could help me, please
 
Last edited by a moderator:
Set PS_LightningType[1] = "DRAM"
I assume the variable is of type string?
In GUI you do not need these marks " " for strings. They are there automatically when converted to JASS, so finaly you will have a different string.
Just let it away.

I recommend to use LightningTypes variables in config for user and not string and then save via custom script:

Save example:
  • Init
    • Ereignisse
      • Map initialization
    • Bedingungen
    • Aktionen
      • Hashtabelle - Create a hashtable
      • Set Hash = (Last created hashtable)
      • -------- ---------------- --------
      • Set LightningType = Kettenblitz - Primär
      • Custom script: call SaveStr(udg_Hash, parentKey, childKey, udg_LightningType)

Load example:
  • Aktionen
    • Custom script: set udg_LightningType = LoadStr(udg_Hash, parentKey, childKey)
    • Blitz - Create a LightningType lightning effect from source (Position of (Triggering unit)) to target (Center of (Playable map area))
 

Ardenian

A

Ardenian

Thank you, but I need one with an array, so I can use different lightning for different units.

About child and parent, which was one ? save parent as child or child as parent, in the GUI ?

What about the height trigger I need, the custom script presented here:
http://www.hiveworkshop.com/forums/trigger-gui-editor-tutorials-279/beginners-guide-lightning-effects-220370/

->
  • Custom script: set udg_YOURVARIABLE = AddLightningEx(LIGHTNING TYPE, CHECKVISIBILITY, X1, Y1, Z1, X2, Y2, Z2)
Does this script creates the lightning or only changes its height ?
 
It was only an example. It is no problem to make arrays with it.

In GUI the order is: "Value" "ChildKey" "ParentKey"
Using the native (without the "BJ" in function name), it is vice versa: "ParentKey", "ChildKey", "Value".

Your function only creates a lightning.
You need some kind of MoveLightning function, it is also listed in linked tutorial.
 
Status
Not open for further replies.
Top