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

Custom Scripts

Status
Not open for further replies.
Level 10
Joined
Nov 3, 2009
Messages
687
Hello,

I'm newbie at triggering, and I don't know 1 thing for now... What kind of CUSTOM SCRIPTS I mean...
  • Custom Script: call RemoveLocation(udg_point)
and something like that where can I find more information about them ? ;) :grin:

Thank you...

~Spoontoobig
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
The action "Custom script" is actually a JASS-line, used in GUI-format.
This line always starts with "call" when removing leaks and is case sensitive.'

When removing leaks, the rough code goes like this:
  • Custom script: call <Variable-specific code>(udg_<variable name>[array])
But I doubt that makes a lot of sense ^^

Variable types + Remove code
Point (location): "RemoveLocation"
Unit Group (group): "DestroyGroup"
Player Group (force): "DestroyForce"​
Those are the only 3 you'll probably need when using Custom scripts for removing leaks.

I'll use a location leak as an example, so it becomes:
Custom script: call RemoveLocation"​
Looking good so far, but we have to tell the code which location we need to remove.

I will add a variable called "loc" (point variable without array).
Variables in GUI are User Defined Globals (shortened as udg), so we need to put "udg_" in front of our variable (not in the variable editor, but in the custom script =.=).
Also, you need to put the variable you want to remove between brackets.

It becomes:
"Custom script: call RemoveLocation(udg_loc)"​
Note: now the variable would've been cleared if we didn't use an array...
(this is the standard form for variables without array).

The array needs to be put between square brackets, let's say we have used loc[1], so it becomes:
"Custom script: call RemoveLocation(udg_loc[1])"​
And we're done!

Final Trigger:
  • Actions
    • Set loc[1] = (Center of (Playable map area))
    • Unit - Create 1 Footman for Player 1 (Red) at loc[1] facing Default building facing degrees
    • Custom script: call RemoveLocation(udg_loc[1])

More information on custom scripts: learn JASS... since a Custom script is a JASS-line, it's sometimes just better to learn JASS xD
 
Status
Not open for further replies.
Top