- Joined
- Mar 16, 2019
- Messages
- 18
Hello, I'm Naz, I'm new here as you can probably see and I'll try to make this as straight forward as I can for your convenience. I'm making an RPG, my very first map at that, and I have no experience in anything let alone programming, so I've just been copying forum triggers whenever I need something and its been going really well. But now my progress has slowed to a crawl when it came the time to import spells. I imported 10 spells and only 3 of them worked. I fiddled with it a bunch and used a text comparing site for the triggers and went through all the dummies and abilities to be sure that everything was alright and still nothing. I got frustrated and made a new clean and empty map with no other triggers and imported one of the spells that wouldn't work and suddenly it did work.
This leads me to believe that there's some kind of conflict between my spells and my other triggers but I don't know what. I'm assuming that variables may be the culprit here? Either way, I don't know exactly what I'm looking for which is why I'm here.
I'm just gonna post the triggers for the spell I tested in the new map (as that seems like a good start). I'd like to add that this spell also has a JASS version but when I tried it it gave me errors and at this point I was just so much more familiar with GUI to not want to bother with it.
Thanks in advance.
This leads me to believe that there's some kind of conflict between my spells and my other triggers but I don't know what. I'm assuming that variables may be the culprit here? Either way, I don't know exactly what I'm looking for which is why I'm here.
I'm just gonna post the triggers for the spell I tested in the new map (as that seems like a good start). I'd like to add that this spell also has a JASS version but when I tried it it gave me errors and at this point I was just so much more familiar with GUI to not want to bother with it.
-
Init LSL
-
Events
-
Map initialization
-
-
Conditions
-
Actions
-
-------- -------------------------------------------------- --------
-
-------- Create hashtable to store all data --------
-
-------- -------------------------------------------------- --------
-
Hashtable - Create a hashtable
-
Set MH_Hash = (Last created hashtable)
-
-------- -------------------------------------------------- --------
-
-------- Abilities --------
-
-------- -------------------------------------------------- --------
-
-------- Lightning Speed Laceration --------
-
Set MH_Ability[0] = Lightning Speed Laceration - GUI
-
-------- LSL Dummy --------
-
Set MH_Ability[1] = LSL Dummy
-
-------- Disable Attack --------
-
Set MH_Ability[2] = Disable Attack
-
-------- -------------------------------------------------- --------
-
-------- Effects --------
-
-------- -------------------------------------------------- --------
-
-------- The effect to be attached on attacking units --------
-
Set MH_Effect[0] = Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
-
-------- The effect to be attached on target on hit --------
-
Set MH_Effect[1] = Abilities\Weapons\GyroCopter\GyroCopterImpact.mdl
-
-------- -------------------------------------------------- --------
-
-------- The attachment point for the effect on the attacker --------
-
-------- -------------------------------------------------- --------
-
Set MH_Attach_Point = weapon
-
-------- -------------------------------------------------- --------
-
-------- Unit type of the dummy --------
-
-------- -------------------------------------------------- --------
-
Set MH_Dummy_Type = Paladin Dummy
-
-------- -------------------------------------------------- --------
-
-------- How many attack animations are you using --------
-
-------- -------------------------------------------------- --------
-
Set MH_Animation_Indexes[0] = 2
-
-------- -------------------------------------------------- --------
-
-------- The animation indexes of your attack animations --------
-
-------- -------------------------------------------------- --------
-
Set MH_Animation_Indexes[1] = 4
-
Set MH_Animation_Indexes[2] = 5
-
-------- -------------------------------------------------- --------
-
-------- Attack duration --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[0] = 1.50
-
-------- -------------------------------------------------- --------
-
-------- First Dummy Creation Delay --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[1] = 0.21
-
-------- -------------------------------------------------- --------
-
-------- Dummy Creation Interval --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[2] = 0.12
-
-------- -------------------------------------------------- --------
-
-------- Dummy Visibility Time --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[3] = 1.00
-
-------- -------------------------------------------------- --------
-
-------- Base damage --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[4] = 40.00
-
-------- -------------------------------------------------- --------
-
-------- Bonus damage per level --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[5] = 10.00
-
-------- -------------------------------------------------- --------
-
-------- Dummy transparency --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[6] = 50.00
-
-------- -------------------------------------------------- --------
-
-------- Damage delay --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[7] = 0.30
-
-------- -------------------------------------------------- --------
-
-------- Cast delay --------
-
-------- -------------------------------------------------- --------
-
Set MH_Reals[8] = 0.48
-
-------- -------------------------------------------------- --------
-
-------- Does the spell stun --------
-
-------- -------------------------------------------------- --------
-
Set MH_Booleans[0] = True
-
-------- -------------------------------------------------- --------
-
-
-
MH Begin Attack
-
Events
-
Unit - A unit Begins casting an ability
-
-
Conditions
-
(Ability being cast) Equal to MH_Ability[0]
-
-
Actions
-
Set MH_u1 = (Triggering unit)
-
Set MH_u2 = (Target unit of ability being cast)
-
-------- -------------------------------------------------- --------
-
-------- The unit handle for hashtable key --------
-
-------- -------------------------------------------------- --------
-
Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
-
-------- -------------------------------------------------- --------
-
-------- Removes the attack ability from the caster, so he does not attack on his own --------
-
-------- -------------------------------------------------- --------
-
Unit - Add MH_Ability[2] to MH_u1
-
-------- -------------------------------------------------- --------
-
-------- Randomizes an attack animation --------
-
-------- -------------------------------------------------- --------
-
Set MH_i2 = MH_Animation_Indexes[(Random integer number between 1 and MH_Animation_Indexes[0])]
-
-------- -------------------------------------------------- --------
-
Custom script: call SaveInteger( udg_MH_Hash, udg_MH_i1 , StringHash( "index") , udg_MH_i2)
-
Custom script: call SaveInteger( udg_MH_Hash, udg_MH_i1 , StringHash( "level") , GetUnitAbilityLevel( udg_MH_u1 , udg_MH_Ability[0] - 1 ) )
-
Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("x") , GetUnitX(udg_MH_u1) )
-
Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("y") , GetUnitY(udg_MH_u1) )
-
Custom script: call SaveUnitHandle( udg_MH_Hash , udg_MH_i1, StringHash("target") , udg_MH_u2 )
-
-------- -------------------------------------------------- --------
-
-------- Attach a special effect on the unit and save it --------
-
-------- -------------------------------------------------- --------
-
Custom script: call SaveEffectHandle( udg_MH_Hash, udg_MH_i1 , StringHash("effect1") , AddSpecialEffectTarget( udg_MH_Effect[0] , udg_MH_u1 , udg_MH_Attach_Point ) )
-
-------- -------------------------------------------------- --------
-
Unit Group - Add MH_u1 to MH_Caster_Execute
-
Unit Group - Add MH_u1 to MH_Caster_Stop
-
Unit Group - Add MH_u2 to MH_Images
-
-------- -------------------------------------------------- --------
-
Trigger - Turn on MH Clear Images <gen>
-
Trigger - Turn on MH Start Effect <gen>
-
Trigger - Turn on MH Create <gen>
-
-
-
MH Start Effect
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to MH_Ability[0]
-
-
Actions
-
Trigger - Turn on MH Delay Order <gen>
-
-
-
MH Delay Order
-
Events
-
Time - Every 0.00 seconds of game time
-
-
Conditions
-
Actions
-
-------- -------------------------------------------------- --------
-
-------- This trigger is needed because I need that small delay, otherwise the orders --------
-
-------- are issued in wrong order and animations get messed up. --------
-
-------- -------------------------------------------------- --------
-
Unit Group - Pick every unit in MH_Caster_Stop and do (Actions)
-
Loop - Actions
-
Set MH_u1 = (Picked unit)
-
-------- -------------------------------------------------- --------
-
Unit - Order MH_u1 to Hold Position
-
-------- -------------------------------------------------- --------
-
Custom script: call SetUnitAnimationByIndex(udg_MH_u1, LoadInteger( udg_MH_Hash, GetHandleId(udg_MH_u1), StringHash("index")) )
-
-------- -------------------------------------------------- --------
-
Unit Group - Remove MH_u1 from MH_Caster_Stop
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(MH_Caster_Stop is empty) Equal to True
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
Trigger - Turn off MH Start Effect <gen>
-
-
Else - Actions
-
-
-
-
-
-
MH Create
-
Events
-
Time - Every 0.03 seconds of game time
-
-
Conditions
-
Actions
-
Unit Group - Pick every unit in MH_Caster_Execute and do (Actions)
-
Loop - Actions
-
Set MH_u1 = (Picked unit)
-
-------- -------------------------------------------------- --------
-
Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
-
Custom script: set udg_MH_r1 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("time") )
-
Custom script: set udg_MH_u2 = LoadUnitHandle( udg_MH_Hash, udg_MH_i1, StringHash("target"))
-
-------- -------------------------------------------------- --------
-
Custom script: set udg_MH_r2 = GetUnitX(udg_MH_u1)
-
Custom script: set udg_MH_r3 = GetUnitY(udg_MH_u1)
-
-------- -------------------------------------------------- --------
-
Custom script: set udg_MH_r4 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("x") )
-
Custom script: set udg_MH_r5 = LoadReal( udg_MH_Hash , udg_MH_i1 , StringHash("y") )
-
-------- -------------------------------------------------- --------
-
-------- Check that the spell timer isn't over and that the caster and target are still alive --------
-
-------- Also check that the unit hasn't moved, thus is still casting --------
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(MH_u1 is alive) Equal to True
-
(MH_u2 is alive) Equal to True
-
MH_r1 Less than MH_Reals[0]
-
MH_r4 Equal to MH_r2
-
MH_r5 Equal to MH_r3
-
-
Then - Actions
-
-------- -------------------------------------------------- --------
-
-------- The following values are the delays for creating a dummy --------
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
MH_r1 Equal to (MH_Reals[8] - MH_Reals[2])
-
MH_r1 Equal to (MH_Reals[8] + MH_Reals[2])
-
MH_r1 Equal to (MH_Reals[8] - (2.00 x MH_Reals[2]))
-
MH_r1 Equal to (MH_Reals[8] + (2.00 x MH_Reals[2]))
-
-
-
-
Then - Actions
-
-------- -------------------------------------------------- --------
-
-------- Tracks how many dummies there are --------
-
-------- -------------------------------------------------- --------
-
Custom script: set udg_MH_i2 = 1 + LoadInteger( udg_MH_Hash , udg_MH_i1 , StringHash("dummies") )
-
-------- -------------------------------------------------- --------
-
-------- Create a dummy attacker --------
-
-------- -------------------------------------------------- --------
-
Custom script: set udg_MH_u3 = CreateUnit(Player(15) , udg_MH_Dummy_Type, udg_MH_r2 , udg_MH_r3 , GetUnitFacing(udg_MH_u1) )
-
-------- -------------------------------------------------- --------
-
Custom script: call SaveInteger( udg_MH_Hash , udg_MH_i1 , StringHash("dummies") , udg_MH_i2)
-
-------- -------------------------------------------------- --------
-
-------- Link the dummy to caster --------
-
-------- -------------------------------------------------- --------
-
Custom script: call SaveUnitHandle( udg_MH_Hash , udg_MH_i1 , udg_MH_i2 , udg_MH_u3 )
-
-------- -------------------------------------------------- --------
-
-------- Create and attach a special effect on the dummy --------
-
-------- -------------------------------------------------- --------
-
Custom script: set bj_lastCreatedEffect = AddSpecialEffectTarget( udg_MH_Effect[0] , udg_MH_u3 , udg_MH_Attach_Point )
-
Custom script: call SaveEffectHandle( udg_MH_Hash, GetHandleId(udg_MH_u3) , StringHash("effect1") , bj_lastCreatedEffect)
-
-------- -------------------------------------------------- --------
-
-------- Make the dummy partially transparent --------
-
-------- -------------------------------------------------- --------
-
Animation - Change MH_u3's vertex coloring to (100.00%, 100.00%, 100.00%) with MH_Reals[6]% transparency
-
Unit - Change color of MH_u3 to (Color of (Owner of MH_u1))
-
-------- -------------------------------------------------- --------
-
-------- Limit the life time of the dummy --------
-
-------- -------------------------------------------------- --------
-
Unit - Add a MH_Reals[3] second Generic expiration timer to MH_u3
-
-------- -------------------------------------------------- --------
-
-------- Adjust stats of the dummy to affect attack speed --------
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(MH_u1 is A Hero) Equal to True
-
-
Then - Actions
-
Hero - Set MH_u3 Hero-level to (Hero level of MH_u1), Hide level-up graphics
-
-
Else - Actions
-
-
-------- -------------------------------------------------- --------
-
-------- Retrieve the attack anmation for the caster and play it --------
-
-------- -------------------------------------------------- --------
-
Custom script: call SetUnitAnimationByIndex(udg_MH_u3, LoadInteger( udg_MH_Hash, udg_MH_i1, StringHash("index") ) )
-
-
Else - Actions
-
-
-------- -------------------------------------------------- --------
-
-------- Reduce the spell timer --------
-
-------- -------------------------------------------------- --------
-
Custom script: call SaveReal( udg_MH_Hash, udg_MH_i1 , StringHash("time") , udg_MH_r1 + 0.03)
-
-------- -------------------------------------------------- --------
-
-------- Check whether damage should be applied or not --------
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
MH_r1 Equal to (MH_Reals[8] + MH_Reals[7])
-
MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] + MH_Reals[2]))
-
MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] + (2.00 x MH_Reals[2])))
-
MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] - MH_Reals[2]))
-
MH_r1 Equal to (MH_Reals[8] + (MH_Reals[7] - (2.00 x MH_Reals[2])))
-
-
-
-
Then - Actions
-
-------- -------------------------------------------------- --------
-
-------- Apply damage --------
-
-------- -------------------------------------------------- --------
-
Custom script: call UnitDamageTarget( udg_MH_u1 , udg_MH_u2 , ( udg_MH_Reals[4] + ( udg_MH_Reals[5] * LoadInteger( udg_MH_Hash , udg_MH_i1 , StringHash("level") ) ) ) , true , false , ATTACK_TYPE_NORMAL , DAMAGE_TYPE_NORMAL , WEAPON_TYPE_METAL_HEAVY_BASH )
-
-------- -------------------------------------------------- --------
-
-------- Create effect on the target --------
-
-------- -------------------------------------------------- --------
-
Custom script: call DestroyEffect( AddSpecialEffectTarget( udg_MH_Effect[1] , udg_MH_u2 , "chest" ) )
-
-------- -------------------------------------------------- --------
-
-------- If the original caster applies damage, create a dummy and make it cast stunning spell on the target --------
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MH_Booleans[0] Equal to True
-
MH_r1 Equal to (MH_Reals[7] + MH_Reals[8])
-
-
Then - Actions
-
Custom script: set udg_MH_u1 = CreateUnit(Player(15) , udg_MH_Dummy_Type, GetUnitX(udg_MH_u2) , GetUnitY(udg_MH_u2) , GetUnitFacing(udg_MH_u2) )
-
-------- -------------------------------------------------- --------
-
Animation - Change MH_u1's vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
-
-------- -------------------------------------------------- --------
-
Unit - Add MH_Ability[1] to MH_u1
-
Unit - Order MH_u1 to Human Mountain King - Storm Bolt MH_u2
-
Unit - Add a MH_Reals[3] second Generic expiration timer to MH_u1
-
-------- -------------------------------------------------- --------
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
Else - Actions
-
-------- -------------------------------------------------- --------
-
-------- Spell over, destroy the effect on the caster --------
-
-------- -------------------------------------------------- --------
-
Custom script: call DestroyEffect(LoadEffectHandle( udg_MH_Hash, udg_MH_i1,StringHash("effect1") ) )
-
-------- -------------------------------------------------- --------
-
Unit Group - Remove MH_u1 from MH_Caster_Execute
-
-------- -------------------------------------------------- --------
-
Unit - Remove MH_Ability[2] from MH_u1
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
MH_r4 Equal to MH_r2
-
MH_r5 Equal to MH_r3
-
-
Then - Actions
-
Unit - Order MH_u1 to Stop
-
-
Else - Actions
-
-------- -------------------------------------------------- --------
-
-------- Kill dummies --------
-
-------- -------------------------------------------------- --------
-
For each (Integer loopA) from 1 to (Load (Key dummies) of (Key (Picked unit)) from MH_Hash), do (Actions)
-
Loop - Actions
-
Unit - Kill (Load loopA of MH_i1 in MH_Hash)
-
-
-
-
-
-------- -------------------------------------------------- --------
-
Custom script: call FlushChildHashtable( udg_MH_Hash, udg_MH_i1 )
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(MH_Caster_Execute is empty) Equal to True
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
-
-
-
-
-
MH Clear Images
-
Events
-
Unit - A unit Dies
-
-
Conditions
-
(Unit-type of (Triggering unit)) Equal to MH_Dummy_Type
-
-
Actions
-
-------- -------------------------------------------------- --------
-
-------- This trigger handles the dummy units --------
-
-------- -------------------------------------------------- --------
-
Set MH_u1 = (Triggering unit)
-
-------- -------------------------------------------------- --------
-
Custom script: set udg_MH_i1 = GetHandleId(udg_MH_u1)
-
-------- -------------------------------------------------- --------
-
Custom script: call DestroyEffect(LoadEffectHandle( udg_MH_Hash, udg_MH_i1,StringHash("effect1") ) )
-
-------- -------------------------------------------------- --------
-
Custom script: call FlushChildHashtable( udg_MH_Hash, udg_MH_i1 )
-
-------- -------------------------------------------------- --------
-
Unit Group - Remove MH_u1 from MH_Images
-
-------- -------------------------------------------------- --------
-
Unit - Remove MH_u1 from the game
-
-------- -------------------------------------------------- --------
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(MH_Images is empty) Equal to True
-
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
Thanks in advance.