• 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.

Problem with custom script fail

Status
Not open for further replies.
Level 3
Joined
Jan 31, 2023
Messages
12
There is a problem and I cannot find it (Because I'm a beginner).
Everytime I try to test it skips to main menu and cannot open map.

1676596245226.png


What I'm trying to do is everytime a unit attacks create a illusion of attacking unit by creating a dummy and using Item illusion ability on attacking unit.
Please help me how to solve it how I can make it work?
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,883
It honestly looks fine to me... Are you sure it's the Custom Script causing the issue?

Also, you can optimize the trigger a bit and fix a memory leak like so:
  • Events
    • Game - DamageModifierEvent becomes Equal to 1.00
  • Conditions
    • (Level of Unreal Imagine for DamageEventSource) Greater than or equal to 1
    • (Random number between 1 and 100) Less than or equal to 30
  • Actions
    • Set Dummy_Point = (Position of DamageEventSource)
    • Unit - Create 1 DUMMY for (Owner of DamageEventSource) at Dummy_Point facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_Dummy_Point)
    • Set Dummy_Unit = (Last created unit)
    • Unit - Add DarkAngel_Illusion to Dummy_Unit
    • Unit - Add a 0.20 second Generic expiration timer to Dummy_Unit
    • Custom script: call IssueTargetOrderById(udg_Dummy_Unit, 852274, udg_DamageEventSource)
Random_Number doesn't need to be a Real.
IllusionCaster is unnecessary since we already have DamageEventSource.
DummyDA is Set but not used as many times as it could be, which is inefficient.
The If Then Else is unnecessary.

Also, make sure your Dummy unit is setup properly. Base it on the Locust unit then change the following:
Movement Type = None
Speed Base = 0
Attacks Enabled = None
Shadow = None
Model = None

In the future you should post your trigger like this instead of taking a picture:
 
Last edited:
Level 29
Joined
Sep 26, 2009
Messages
2,598
casting the Wand of Illusion ability will create a new illusion - which means it fires events like 'Unit Entered region', etc.
So maybe the reason why the game crashes is because some other trigger detects the illusion being created and does something wrong (which causes the crash).
You may want to try disable a few such triggers and check if the issue persists.
 
Level 3
Joined
Jan 31, 2023
Messages
12
It honestly looks fine to me... Are you sure it's the Custom Script causing the issue?

Also, you can optimize the trigger a bit and fix a memory leak like so:
  • Events
    • Game - DamageModifierEvent becomes Equal to 1.00
  • Conditions
    • (Level of Unreal Imagine for DamageEventSource) Greater than or equal to 1
    • (Random number between 1 and 100) Less than or equal to 30
  • Actions
    • Set Dummy_Point = (Position of DamageEventSource)
    • Unit - Create 1 DUMMY for (Owner of DamageEventSource) at DummyPoint facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_Dummy_Point)
    • Set Dummy_Unit = (Last created unit)
    • Unit - Add DarkAngel_Illusion to Dummy_Unit
    • Unit - Add a 0.20 second Generic expiration timer to Dummy_Unit
    • Custom script: call IssueTargetOrderById(udg_Dummy_Unit, 852274, udg_DamageEventSource)
Random_Number doesn't need to be a Real.
IllusionCaster is unnecessary since we already have DamageEventSource.
DummyDA is Set but not being referenced a couple of times which is inefficient.
The If Then Else isn't necessary.

Also, make sure your Dummy unit is setup properly. Base it on the Locust unit then change the following:
Movement Type = None
Speed Base = 0
Attacks Enabled = None
Shadow = None
Model = None

In the future you should post your trigger like this instead of taking a picture:
Thank you uncle it solved the problem and I understand where i do mistake. Thank you very much again.
I'll past my trigger next time as you said.
 
Status
Not open for further replies.
Top