Trigger Spells

Magazette2

New Member
Reaction score
3
Ive recetnly added 4 trigger spells to my map and it is now lagging alot, could somebody please help me out
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
896
Post the code, please. It's probably full of leaks.
 

Magazette2

New Member
Reaction score
3
Code:
Omnislash
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Omnislash 
    Actions
        Set o = (Triggering unit)
        Set t = (Target unit of ability being cast)
        Set tl = (Position of t)
        If ((Level of Night:Time:Warp  for o) Equal to 1) then do (Set loops_intager = 12) else do (Do nothing)
        If ((Level of Night:Time:Warp  for o) Equal to 2) then do (Set loops_intager = 25) else do (Do nothing)
        Unit - Make o Invulnerable
        Animation - Change o's vertex coloring to (100.00%, 100.00%, 100.00%) with 50.00% transparency
        Selection - Remove o from selection
        Unit - Move o instantly to tl
        Custom script:   call RemoveLocation(udg_tl)
        Animation - Play o's attack animation
        Unit - Cause o to damage t, dealing (Random real number between 240.00 and 520.00) damage of attack type Hero and damage type Normal
        Special Effect - Create a special effect attached to the chest of o using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
        Special Effect - Destroy (Last created special effect)
        For each (Integer A) from 1 to loops_intager, do (Actions)
            Loop - Actions
                Wait 0.30 game-time seconds
                Set o_current_loc = (Position of o)
                Set EG[1] = (Units within 1200.00 of o_current_loc matching ((((Matching unit) is A structure) Not equal to True) and ((((Matching unit) is alive) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of o)) Equal to True) and (((Matching unit) is hidden) N
                Set EG[2] = (Random 1 units from EG[1])
                Custom script:   call RemoveLocation(udg_o_current_loc)
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Number of units in EG[1]) Greater than 0
                    Then - Actions
                        Unit Group - Pick every unit in EG[2] and do (Actions)
                            Loop - Actions
                                Set p = (Picked unit)
                                Set pl = (Position of p)
                                Selection - Remove o from selection
                                Unit - Move o instantly to pl
                                Custom script:   call RemoveLocation(udg_pl)
                                Animation - Play o's attack animation
                                Unit - Cause o to damage p, dealing (Random real number between 500.00 and 800.00) damage of attack type Hero and damage type Normal
                                Special Effect - Create a special effect attached to the chest of o using Abilities\Spells\NightElf\Blink\BlinkCaster.mdl
                                Special Effect - Destroy (Last created special effect)
                        Custom script:   call DestroyGroup(udg_EG[1])
                        Custom script:   call DestroyGroup(udg_EG[2])
                    Else - Actions
                        Custom script:   call DestroyGroup(udg_EG[1])
                        Custom script:   call DestroyGroup(udg_EG[2])
                        Selection - Add o to selection for (Owner of o)
                        Animation - Change o's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
                        Unit - Make o Vulnerable
        Selection - Add o to selection for (Owner of o)
        Animation - Change o's vertex coloring to (100.00%, 100.00%, 100.00%) with 0.00% transparency
        Unit - Make o Vulnerable




Code:
Night Time Metamorphisis level 1
    Events
        Time - Every 0.02 seconds of game time
    Conditions
        ((In-game time of day) Greater than 10.00) and ((In-game time of day) Less than 20.00)
    Actions
        Unit Group - Pick every unit in (Units of type Lunaria) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Lycanthrapy Lunar  for (Picked unit)) Equal to 1
                    Then - Actions
                        Set Hero_level = (Hero level of (Picked unit))
                        Set Hero_EXP = (Hero experience of (Picked unit))
                        Set Unholy_Aura_level = (Level of Unholy Aura for (Picked unit))
                        Set Eclipse_level = (Level of Full Moon  for (Picked unit))
                        Set Feral_spirits_level = (Level of Feral Spirits for (Picked unit))
                        Set Lycanthrapy = (Level of Lycanthrapy Lunar  for (Picked unit))
                        Set Inventory = (Item carried by (Picked unit) in slot 1)
                        Set Inventory = (Item carried by (Picked unit) in slot 2)
                        Unit - Replace (Picked unit) with a Lunaria (Beast) (Level 3) using The new unit's max life and mana
                    Else - Actions



Code:
Night Time Meteamorphisis level 2
level 1 Copy 2
    Events
        Time - Every 0.02 seconds of game time
    Conditions
        ((In-game time of day) Greater than 10.00) and ((In-game time of day) Less than 20.00)
    Actions
        Unit Group - Pick every unit in (Units of type Lunaria) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Lycanthrapy Lunar  for (Picked unit)) Equal to 2
                    Then - Actions
                        Set Hero_level = (Hero level of (Picked unit))
                        Set Hero_EXP = (Hero experience of (Picked unit))
                        Set Unholy_Aura_level = (Level of Unholy Aura for (Picked unit))
                        Set Eclipse_level = (Level of Full Moon  for (Picked unit))
                        Set Feral_spirits_level = (Level of Feral Spirits for (Picked unit))
                        Set Lycanthrapy = (Level of Lycanthrapy Lunar  for (Picked unit))
                        Set Inventory = (Item carried by (Picked unit) in slot 1)
                        Set Inventory = Inventory2
                        Unit - Replace (Picked unit) with a Lunaria (Monstrosity) (Level 3) using The new unit's max life and mana
                    Else - Actions




Code:
Making Night Time Metamorphisis to come back to original form afterwards
level 1 Copy
    Events
        Time - Every 2.00 seconds of game time
    Conditions
        ((In-game time of day) Greater than 0.00) and ((In-game time of day) Less than 10.00)
    Actions
        Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Lycanthrapy-Wolf (Neutral Hostile) for (Picked unit)) Equal to 1
                    Then - Actions
                        Unit - Replace (Picked unit) with a Lunaria using The new unit's max life and mana
                        Hero - Set (Last replaced unit) Hero-level to Hero_level, Hide level-up graphics
                        Hero - Set (Last replaced unit) experience to Hero_EXP, Hide level-up graphics
                        Unit - Set level of Unholy Aura for (Picked unit) to Unholy_Aura_level
                        Unit - Set level of Feral Spirits for (Picked unit) to Feral_spirits_level
                        Unit - Set level of Lycanthrapy Lunar  for (Picked unit) to Lycanthrapy
                        Unit - Set level of Full Moon  for (Picked unit) to Eclipse_level
                        Hero - Give Inventory to (Picked unit)
                        Hero - Give Inventory2 to (Picked unit)
                    Else - Actions




Code:
NightTimeWarp level 1
level 1 Copy 3
    Events
        Time - Every 20.00 seconds of game time
    Conditions
        ((In-game time of day) Greater than 10.00) and ((In-game time of day) Less than 20.00)
    Actions
        Unit Group - Pick every unit in (Units of type Tichondrius) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Night:Time:Warp  for (Picked unit)) Equal to 2
                    Then - Actions
                        Set Vampiric_Level = (Hero level of (Picked unit))
                        Set Vampiric_EXP = (Hero experience of (Picked unit))
                        Set Vampiric_touch_level = (Level of Vampiric Touch  for (Picked unit))
                        Set Vampiric_Aura_level = (Level of Vampiric Aura for (Picked unit))
                        Set Moon_Walk_Level = (Level of Moon Walk for (Picked unit))
                        Set NighTimeWarp = (Level of Night:Time:Warp  for (Picked unit))
                        Set Vampiric_Hp = (Percentage life of (Picked unit))
                        Set Vampiric_Hp = (Percentage mana of (Picked unit))
                    Else - Actions




Code:
NightTimeWarp level 2
level 1 Copy 3 Copy
    Events
        Time - Every 10.00 seconds of game time
    Conditions
        ((In-game time of day) Greater than 10.00) and ((In-game time of day) Less than 20.00)
    Actions
        Unit Group - Pick every unit in (Units of type Tichondrius) and do (Actions)
            Loop - Actions
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Level of Night:Time:Warp  for (Picked unit)) Equal to 1
                    Then - Actions
                        Set Vampiric_Level = (Hero level of (Picked unit))
                        Set Vampiric_EXP = (Hero experience of (Picked unit))
                        Set Vampiric_touch_level = (Level of Vampiric Touch  for (Picked unit))
                        Set Vampiric_Aura_level = (Level of Vampiric Aura for (Picked unit))
                        Set Moon_Walk_Level = (Level of Moon Walk for (Picked unit))
                        Set NighTimeWarp = (Level of Night:Time:Warp  for (Picked unit))
                        Set Vampiric_Hp = (Percentage life of (Picked unit))
                        Set Vampiric_Hp = (Percentage mana of (Picked unit))
                    Else - Actions




Code:
SettingNightTimeWarp
level 1 Copy 3 Copy Copy
    Events
        Unit - A unit Begins casting an ability
    Conditions
        (Ability being cast) Equal to Night:Time:Warp 
    Actions
        Hero - Set (Casting unit) Hero-level to Vampiric_Level, Hide level-up graphics
        Hero - Set (Casting unit) experience to Vampiric_EXP, Hide level-up graphics
        Unit - Set life of (Casting unit) to Vampiric_Hp
        Unit - Set mana of (Casting unit) to Vampiric_Mana
        Unit - Set level of Moon Walk for (Casting unit) to Moon_Walk_Level
        Unit - Set level of Vampiric Aura for (Casting unit) to Vampiric_Aura_level
        Unit - Set level of Vampiric Touch  for (Casting unit) to Vampiric_touch_level
        Unit - Set level of Night:Time:Warp  for (Casting unit) to NighTimeWarp





Code:
Freezing Field Setup
Frozen Field Setup
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Frozen Field (Starfall)
    Actions
        Set CasterPlayer = (Owner of (Triggering unit))
        Set CasterPosition = (Position of (Triggering unit))
        Trigger - Turn on Frozen Field I <gen>
        Wait 0.10 seconds
        Trigger - Turn on Frozen Field II <gen>




Code:
Freezing field blasts far away
Frozen Field I
    Events
        Time - Every 0.20 seconds of game time
    Conditions
    Actions
        Unit - Create 1 Ice Explosion (Caster Unit) for CasterPlayer at (CasterPosition offset by (Random real number between 450.00 and 800.00) towards (Random angle) degrees) facing Default building facing degrees
        Set IceCaster1 = (Last created unit)
        Unit - Order IceCaster1 to Undead Lich - Frost Nova IceCaster1




Code:
Freezing field blasts close
Frozen Field II
    Events
        Time - Every 0.20 seconds of game time
    Conditions
    Actions
        Unit - Create 1 Ice Explosion (Caster Unit) for CasterPlayer at (CasterPosition offset by (Random real number between 100.00 and 450.00) towards (Random angle) degrees) facing Default building facing degrees
        Set IceCaster2 = (Last created unit)
        Unit - Order IceCaster2 to Undead Lich - Frost Nova IceCaster2




Code:
Stop Freezing Field If Channelling stops
    Events
        Unit - A unit Stops casting an ability
    Conditions
        (Ability being cast) Equal to Godly Gold 
    Actions
        Trigger - Turn off Frozen Field I <gen>
        Trigger - Turn off Frozen Field II <gen>
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
896
Next time, please use the [noparse]
Code:
 and
[/noparse] tags with triggers.

A leak is a bit of information that remains in your system's memory, and is not deleted. You will find a lot of information about this if you search for it.
 

esb

Because none of us are as cruel as all of us.
Reaction score
329
The Code Tag coverts This:

Map initialization
Events
Map initialization
Conditions
Actions
Melee Game - Use melee time of day (for all players)
Melee Game - Limit Heroes to 1 per Hero-type (for all players)
Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
Melee Game - Set starting resources (for all players)
Melee Game - Remove creeps and critters from used start locations (for all players)
Melee Game - Create starting units (for all players)
Melee Game - Run melee AI scripts (for computer players)
Melee Game - Enforce victory/defeat conditions (for all players)

To This
Code:
 Map initialization
    Events
        Map initialization
    Conditions
    Actions
        Melee Game - Use melee time of day (for all players)
        Melee Game - Limit Heroes to 1 per Hero-type (for all players)
        Melee Game - Give trained Heroes a Scroll of Town Portal (for all players)
        Melee Game - Set starting resources (for all players)
        Melee Game - Remove creeps and critters from used start locations (for all players)
        Melee Game - Create starting units (for all players)
        Melee Game - Run melee AI scripts (for computer players)
        Melee Game - Enforce victory/defeat conditions (for all players)
Sorry to mods if it's messy >_< but trying to show an example.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
896
> Sorry to mods if it's messy >_< but trying to show an example.

Not a problem. Good example. :D

Just to add, the code tags preserve spaces, meaning you can easily see where things are indented such as loops.
 

Ghan

Administrator - Servers are fun
Staff member
Reaction score
896
> hey ghan thats cool u can edit my posts

Yes, mods have that power.

But, more importantly, have you seen anything here that will help you with your problem? :D
 

Magazette2

New Member
Reaction score
3
thats awesome umm, well on the nighttimewarp i changed where i set the catsing units stuff, i changed it from catsing unit to triggering unit

edit: if u cant see a problem with these ive got abother set of tirgger that arent spells but they are new. Remeber how I had to change it so that after you randomed a hero u couldnt pick it or ranodm it again, well its another 49/50 trigger that i had to make u want me to send them to you?

edit: theyre not big ones each tho on single lines of event, condition and action and theyre all similar just the array and unit changed

edit: ghan do u know what he problem is because im really stuck please
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top