- Joined
- Mar 27, 2008
- Messages
- 8,035
Hello there, I've created this thread just to gather all the formulas in warcraft 3 trigger script and let's share our knowledge together with the forumers 
Such as, formula/way/method to do an AOE (circle-effect) trigger, do this:
[AOE EFFECT]
Remember, I don't care about LEAKS as they are too general to talk in this thread, everyone has different usage/name of the variable, therefore, you should not talk about leaks in there (I mean, just to keep it low, no need to be so serious just in this thread)
Because, this thread only focuses on FORMULA/METHOD to pick unit
Share your other formula, I'll add them in the first post so that other people can come in easily and take that trigger for example
Credits goes to the person who create/CnP that trigger, but remember, to credit to the original author
Format: Trigger + Screenshot
[SINGLE-LINE INSTANT SPELL - millzy]
[LOOPING MULTI-SHOT DEGREE - defskull]
[SINGLE-LINE INTERVAL TRIGGER - millzy]
[EFFECTIVE FORMULA FOR BACKSTAB]
*NEED HELP*
[PICKS UP RECTANGLE/SQUARE UNIT IN FRONT OF CASTER]
*NEED HELP*
[CONE-SHAPED FORMULA/BREATH OF FIRE AREA FORMULA]
*NEED HELP*
[BOOMERANG-LIKE TRIGGER]
*NEED HELP*
[UNIQUE CAMERA FORMULA]
[INSTANT COOL SFX CREATION - Mantis_Style]
[/box]
[INSTANT ELLIPSE/CURVE - Rmx (Mantis_Style)]
[CONTROLLABLE CIRCLE EFFECT - chobibo]
To make a triangle, set the value of sides to 3:
TRIANGLE
To make a pentagram, set the value of sides to 5:
PENTAGRAM
To make a star of David, set the value of sides to 6:
STAR OF DAVID
NOTE: Please share your other knowledge about formula/method in warcraft triggering if you know some of them and it is unique to be shared
Also, the part where I wrote the *NOT AVAILABLET YET* sign is actually my problems that I didn't solve it yet or just don't know how to. So, help is needed
=====GUI=====
Such as, formula/way/method to do an AOE (circle-effect) trigger, do this:
[AOE EFFECT]
-
Unit Group - Pick every unit in (Units within 600.00 of (Center of (Playable map area)) matching (((Triggering unit) is A structure) Equal to True)) and do (Actions)
-
Loop - Actions
-
Unit - Kill (Picked unit)
-
-
Remember, I don't care about LEAKS as they are too general to talk in this thread, everyone has different usage/name of the variable, therefore, you should not talk about leaks in there (I mean, just to keep it low, no need to be so serious just in this thread)
Because, this thread only focuses on FORMULA/METHOD to pick unit
Share your other formula, I'll add them in the first post so that other people can come in easily and take that trigger for example
Credits goes to the person who create/CnP that trigger, but remember, to credit to the original author
Format: Trigger + Screenshot
[SINGLE-LINE INSTANT SPELL - millzy]
-
WALL
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
Actions
-
Set point[1] = (Position of (Triggering unit))
-
Set point[2] = (Target point of ability being cast)
-
Set angle = (Angle from point[1] to point[2])
-
For each (Integer A) from 1 to 5, do (Actions)
-
Loop - Actions
-
Set point[3] = (point[1] offset by ((Real((Integer A))) x (800.00 / 5.00)) towards angle degrees)
-
Unit - Create 1 Footman for Player 1 (Red) at point[3] facing angle degrees
-
-
-
-
[LOOPING MULTI-SHOT DEGREE - defskull]
-
Multi Arrow Cast
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Multi Shot
-
-
Actions
-
Set CasterLoc = (Position of (Triggering unit))
-
Set TargetLoc = (Target point of ability being cast)
-
Set InitialLoopDegree = ((Facing of (Triggering unit)) - 54.00)
-
For each (Integer A) from 1 to 5, do (Actions)
-
Loop - Actions
-
Set InitialLoopDegree = (InitialLoopDegree + 18.00)
-
Set ArrowsLoc = (CasterLoc offset by 50.00 towards InitialLoopDegree degrees)
-
Unit - Create 1 Multi Shot Dummy for (Owner of (Triggering unit)) at ArrowsLoc facing (Angle from CasterLoc to ArrowsLoc) degrees
-
Set ArrowMoveLoc = (ArrowsLoc offset by 1000.00 towards (Facing of (Last created unit)) degrees)
-
Unit - Add a 3.00 second Generic expiration timer to (Last created unit)
-
Unit - Order (Last created unit) to Move To ArrowMoveLoc
-
Custom script: call RemoveLocation(udg_ArrowsLoc)
-
Custom script: call RemoveLocation(udg_ArrowMoveLoc)
-
-
-
Custom script: call RemoveLocation(udg_CasterLoc)
-
Custom script: call RemoveLocation(udg_TargetLoc)
-
-
[SINGLE-LINE INTERVAL TRIGGER - millzy]
-
Shadow wave
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Shadow Wave
-
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in SW_group) Equal to 0
-
-
Then - Actions
-
Trigger - Turn on shadow wave Loop <gen>
-
-
Else - Actions
-
-
Set SW_index = (SW_index + 1)
-
Set SW_Hero[SW_index] = (Casting unit)
-
Set SW_Point[1] = (Position of SW_Hero[SW_index])
-
Set SW_Point[2] = (Target point of ability being cast)
-
Set SW_Distance[SW_index] = 0.00
-
Set SW_Reached[SW_index] = 600.00
-
Set SW_Speed[SW_index] = 30.00
-
Set SW_angel[SW_index] = (Angle from SW_Point[1] to SW_Point[2])
-
Custom script: call RemoveLocation(udg_SW_Point[1])
-
Custom script: call RemoveLocation(udg_SW_Point[2])
-
Set SW_caster_p[SW_index] = (Position of SW_Hero[SW_index])
-
Unit - Create 1 dummy shadow for (Owner of (Triggering unit)) at SW_caster_p[SW_index] facing SW_angel[SW_index] degrees
-
Set SW_missle[SW_index] = (Last created unit)
-
Unit Group - Add SW_Hero[SW_index] to SW_group
-
-
-
shadow wave Loop
-
Events
-
Time - Every 0.02 seconds of game time
-
-
Conditions
-
Actions
-
For each (Integer SW_Loop) from 1 to SW_index, do (Actions)
-
Loop - Actions
-
Set SW_Distance[SW_Loop] = (SW_Distance[SW_Loop] + SW_Speed[SW_Loop])
-
Set SW_X[1] = (SW_caster_p[SW_Loop] offset by SW_Distance[SW_Loop] towards SW_angel[SW_Loop] degrees)
-
Unit - Move SW_missle[SW_Loop] instantly to SW_X[1], facing SW_angel[SW_Loop] degrees
-
Set SW_Dam_Group[SW_Loop] = (Units within 175.00 of SW_X[1] matching (((Owner of (Matching unit)) Not equal to (Owner of SW_Hero[SW_Loop])) and ((((Matching unit) is alive) Equal to True) and (((Matching unit) is in SW_buffers[SW_Loop]) Equal to False))))
-
Unit Group - Pick every unit in SW_Dam_Group[SW_Loop] and do (Actions)
-
Loop - Actions
-
Unit - Create 1 dummy for (Owner of SW_Hero[SW_Loop]) at SW_X[1] facing Default building facing degrees
-
Unit - Add shadow wave dummy to (Last created unit)
-
Unit - Set level of shadow wave dummy for (Last created unit) to (Level of Shadow Wave for SW_Hero[SW_Loop])
-
Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
-
Unit - Order (Last created unit) to Human Priest - Inner Fire (Picked unit)
-
Unit Group - Add (Picked unit) to SW_buffers[SW_Loop]
-
-
-
Custom script: call DestroyGroup(udg_SW_Dam_Group[udg_SW_Loop])
-
Custom script: call RemoveLocation(udg_SW_X[1])
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
SW_Distance[SW_Loop] Greater than or equal to SW_Reached[SW_Loop]
-
-
Then - Actions
-
Unit - Kill SW_missle[SW_Loop]
-
Custom script: call RemoveLocation(udg_SW_caster_p[udg_SW_Loop])
-
Unit Group - Pick every unit in SW_buffers[SW_Loop] and do (Actions)
-
Loop - Actions
-
Unit Group - Remove (Picked unit) from SW_buffers[SW_Loop]
-
-
-
Unit Group - Remove SW_Hero[SW_Loop] from SW_group
-
Set SW_Hero[SW_Loop] = No unit
-
Set SW_missle[SW_Loop] = No unit
-
Set SW_Distance[SW_Loop] = 0.00
-
Set SW_angel[SW_Loop] = 0.00
-
Set SW_Speed[SW_Loop] = 0.00
-
Set SW_Reached[SW_Loop] = 0.00
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Number of units in SW_group) Equal to 0
-
-
Then - Actions
-
Set SW_index = 0
-
Trigger - Turn off (This trigger)
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-
[EFFECTIVE FORMULA FOR BACKSTAB]
*NEED HELP*
[PICKS UP RECTANGLE/SQUARE UNIT IN FRONT OF CASTER]
*NEED HELP*
[CONE-SHAPED FORMULA/BREATH OF FIRE AREA FORMULA]
*NEED HELP*
[BOOMERANG-LIKE TRIGGER]
*NEED HELP*
[UNIQUE CAMERA FORMULA]
ap0calypse
CamZ
Events
Player - Player 1 (Red) types a chat message containing -zoom as A substring
Conditions
Actions
-------- Maximum Value (Camera can't zoom out further) --------
Set MaxValue = 3000.00
-------- Minimum Value (Camera can't zoom in further) --------
Set MinValue = 500.00
-------- Do not change below this line --------
For each (Integer A) from 1 to (Length of (Entered chat string)), do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Substring((Entered chat string), (Integer A), (Integer A))) Equal to
Then - Actions
Set Camera_Distance = (Real((Substring((Entered chat string), ((Integer A) + 1), (Length of (Entered chat string))))))
Else - Actions
Camera - Set (Triggering player)'s camera Distance to target to Camera_Distance over 0.20 seconds
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Camera_Distance Greater than or equal to MaxValue
Then - Actions
Camera - Set (Triggering player)'s camera Distance to target to MaxValue over 0.20 seconds
Set Camera_Distance = MaxValue
Game - Display to (All players matching ((Triggering player) Equal to (Matching player))) for 6.00 seconds the text: |c00ff0000Zoomed ou...
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Camera_Distance Less than or equal to MinValue
Then - Actions
Camera - Set (Triggering player)'s camera Distance to target to MinValue over 0.20 seconds
Set Camera_Distance = MinValue
Game - Display to (All players matching ((Triggering player) Equal to (Matching player))) for 6.00 seconds the text: |c00ff0000Zoomed in...
Else - Actions
Adjust Speed
Events
Time - Every 0.10 seconds of game time
Conditions
Actions
Set Group = (Units in (Playable map area))
Unit Group - Pick every unit in Group and do (Actions)
Loop - Actions
Set Loc1 = (Position of (Picked unit))
Set Loc2 = (TempLoc[1] offset by 100.00 towards (Facing of (Picked unit)) degrees)
Custom script: set udg_Real1 = GetLocationZ(udg_Loc1)
Custom script: set udg_Real2 = GetLocationZ(udg_Loc2)
Custom script: call RemoveLocation(udg_Loc1)
Custom script: call RemoveLocation(udg_Loc2)
Unit - Set (Picked unit) movement speed to ((Default movement speed of (Picked unit)) + (Real1 - Real2))
Custom script: call GroupClear(udg_Group)
mckill2009
CAM Lock
Events
Time - Every 0.03 seconds of game time
Conditions
Actions
Camera - Lock camera target for Player 1 (Red) to P01_Hero, offset by (0.00, 0.00) using Default rotation
Fixed Rotation
Events
Time - Every 0.03 seconds of game time
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
Camera - Set Player 1 (Red)'s camera Rotation to CAM_Rotation over 0.03 seconds
Camera - Set Player 1 (Red)'s camera Distance to target to CAM_Zoom over 0.03 seconds
CAM Left Press
Events
Player - Player 1 (Red) Presses the Left Arrow key
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(CAM Right Rotation <gen> is on) Equal to False
Then - Actions
Trigger - Turn on CAM Left Rotation <gen>
Else - Actions
CAM Left Release
Events
Player - Player 1 (Red) Releases the Left Arrow key
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
Trigger - Turn off CAM Left Rotation <gen>
CAM Left Rotation
Events
Time - Every 0.03 seconds of game time
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
Set CAM_Rotation = (CAM_Rotation - 2.00)
CAM Right Press
Events
Player - Player 1 (Red) Presses the Right Arrow key
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(CAM Left Rotation <gen> is on) Equal to False
Then - Actions
Trigger - Turn on CAM Right Rotation <gen>
Else - Actions
CAM Right Release
Events
Player - Player 1 (Red) Releases the Right Arrow key
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
Trigger - Turn off CAM Right Rotation <gen>
CAM Right Rotation
Events
Time - Every 0.03 seconds of game time
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
Set CAM_Rotation = (CAM_Rotation + 2.00)
CAM Up Press
Events
Player - Player 1 (Red) Presses the Up Arrow key
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(CAM Up Zoom In <gen> is on) Equal to False
Then - Actions
Trigger - Turn on CAM Up Zoom Out <gen>
Else - Actions
CAM Up Release
Events
Player - Player 1 (Red) Releases the Up Arrow key
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
Trigger - Turn off CAM Up Zoom Out <gen>
CAM Up Zoom Out
Events
Time - Every 0.03 seconds of game time
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CAM_Zoom Less than or equal to 3000.00
Then - Actions
Set CAM_Zoom = (CAM_Zoom + 10.00)
Else - Actions
CAM Down Press
Events
Player - Player 1 (Red) Presses the Down Arrow key
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(CAM Up Zoom Out <gen> is on) Equal to False
Then - Actions
Trigger - Turn on CAM Up Zoom In <gen>
Else - Actions
CAM Down Release
Events
Player - Player 1 (Red) Releases the Down Arrow key
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
Trigger - Turn off CAM Up Zoom In <gen>
CAM Up Zoom In
Events
Time - Every 0.03 seconds of game time
Conditions
(CAM Lock <gen> is on) Equal to True
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
CAM_Zoom Greater than or equal to 500.00
Then - Actions
Set CAM_Zoom = (CAM_Zoom - 10.00)
Else - Actions
[INSTANT COOL SFX CREATION - Mantis_Style]
-
Circle
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Circle
-
-
Actions
-
Set Number_of_Effects = 10
-
Set Target_Point = (Target point of ability being cast)
-
For each (Integer A) from 1 to Number_of_Effects, do (Actions)
-
Loop - Actions
-
Set New_Point = (Target_Point offset by 350.00 towards ((360.00 / (Real(Number_of_Effects))) x (Real((Integer A)))) degrees)
-
Special Effect - Create a special effect at New_Point using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
-
Special Effect - Destroy (Last created special effect)
-
Custom script: call RemoveLocation(udg_New_Point)
-
-
-
Custom script: call RemoveLocation(udg_Target_Point)
-
-

-
Star
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Star
-
-
Actions
-
Set Target_Point = (Target point of ability being cast)
-
For each (Integer A) from 1 to 5, do (Actions)
-
Loop - Actions
-
For each (Integer B) from 1 to 10, do (Actions)
-
Loop - Actions
-
Set New_Point = (Target_Point offset by (30.00 x (Real((Integer B)))) towards ((360.00 / 5.00) x (Real((Integer A)))) degrees)
-
Special Effect - Create a special effect at New_Point using Abilities\Spells\Human\HolyBolt\HolyBoltSpecialArt.mdl
-
Special Effect - Destroy (Last created special effect)
-
Custom script: call RemoveLocation(udg_New_Point)
-
-
-
-
-
Custom script: call RemoveLocation(udg_Target_Point)
-
-

[INSTANT ELLIPSE/CURVE - Rmx (Mantis_Style)]
-
Spell
-
Events
-
Unit - A unit Starts the effect of an ability
-
-
Conditions
-
(Ability being cast) Equal to Spell
-
-
Actions
-
Set Point[0] = (Position of (Triggering unit))
-
Set Point[1] = (Target point of ability being cast)
-
Set Angle = (Facing of (Triggering unit))
-
Set MaxDistance = (Distance between Point[0] and Point[1])
-
Set Constant = 1.45
-
For each (Integer A) from 1 to 30, do (Actions)
-
Loop - Actions
-
Set Distance = ((MaxDistance / 30.00) x (Real((Integer A))))
-
Set Point[2] = (Point[0] offset by Distance towards Angle degrees)
-
Set Point[3] = (Point[2] offset by (Constant x ((MaxDistance - Distance) x (Distance / MaxDistance))) towards (Angle - 90.00) degrees)
-
Set Point[4] = (Point[2] offset by (Constant x ((MaxDistance - Distance) x (Distance / MaxDistance))) towards (Angle + 90.00) degrees)
-
Special Effect - Create a special effect at Point[3] using Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
-
Special Effect - Destroy (Last created special effect)
-
Special Effect - Create a special effect at Point[4] using Abilities\Weapons\FaerieDragonMissile\FaerieDragonMissile.mdl
-
Special Effect - Destroy (Last created special effect)
-
Custom script: call RemoveLocation(udg_Point[2])
-
Custom script: call RemoveLocation(udg_Point[3])
-
Custom script: call RemoveLocation(udg_Point[4])
-
-
-
Custom script: call RemoveLocation(udg_Point[0])
-
Custom script: call RemoveLocation(udg_Point[1])
-
-

=====JASS=====
[CONTROLLABLE CIRCLE EFFECT - chobibo]
JASS:
//====================================================================================================
//= StarShapeGenerator by chobibo =
//====================================================================================================
library StarShapeGenerator
globals
private constant hashtable HASHTABLE = InitHashtable()
private constant integer HASHKEY_SIDES = StringHash("sides")
private constant integer MINIMUM_SIDES = 5
private constant integer MAXIMUM_SIDES = 8
private constant integer TRIANGLE = 3
endglobals
private function remove takes nothing returns nothing
local integer parentkey=GetHandleId(GetExpiredTimer())
local effect e
local lightning l
local integer i=0
local integer sides=LoadInteger(HASHTABLE,parentkey,HASHKEY_SIDES)
loop
exitwhen (i==sides)
set e=LoadEffectHandle(HASHTABLE,parentkey,i)
set l=LoadLightningHandle(HASHTABLE,parentkey,sides+i)
call DestroyEffect(e)
call DestroyLightning(l)
set i=i+1
endloop
call FlushChildHashtable(HASHTABLE,parentkey)
call DestroyTimer(GetExpiredTimer())
set e=null
set l=null
endfunction
function StarShapeGenerator_create takes string lightningfxname, string pointfxpath, real centerX, real centerY, real facing, real radius, real duration, integer sides returns nothing
local real array x
local real array y
local effect e
local lightning l
local integer i=0
local integer j=0
local real angle=facing*3.14159/180
local timer t=CreateTimer()
local integer parentkey=GetHandleId(t)
if (sides<MINIMUM_SIDES) then
set sides=TRIANGLE
elseif (sides>MAXIMUM_SIDES) then
set sides=MAXIMUM_SIDES
endif
loop
exitwhen (i==sides)
set x[i]=centerX+Cos(angle)*radius
set y[i]=centerY+Sin(angle)*radius
set angle=angle+(2*3.14159/sides)
set e=AddSpecialEffect(pointfxpath,x[i],y[i])
call SaveEffectHandle(HASHTABLE,parentkey,i,e)
set i=i+1
endloop
set i=0
loop
exitwhen (i==sides)
set j=ModuloInteger(i+2,sides)
set l=AddLightning(lightningfxname,true,x[i],y[i],x[j],y[j])
call SaveLightningHandle(HASHTABLE,parentkey,sides+i,l)
set i=i+1
endloop
call SaveInteger(HASHTABLE,parentkey,HASHKEY_SIDES,sides)
call TimerStart(t,duration,false,function remove)
set e=null
set l=null
set t=null
endfunction
endlibrary
//====================================================================================================
To make a triangle, set the value of sides to 3:
TRIANGLE
To make a pentagram, set the value of sides to 5:
PENTAGRAM
To make a star of David, set the value of sides to 6:
STAR OF DAVID
NOTE: Please share your other knowledge about formula/method in warcraft triggering if you know some of them and it is unique to be shared
Also, the part where I wrote the *NOT AVAILABLET YET* sign is actually my problems that I didn't solve it yet or just don't know how to. So, help is needed
Attachments
Last edited: