一键导入
wurst-stdlib
WurstScript standard library reference including closures, data structures, vectors, object editing, dummy units, and utility packages
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
WurstScript standard library reference including closures, data structures, vectors, object editing, dummy units, and utility packages
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | wurst-stdlib |
| description | WurstScript standard library reference including closures, data structures, vectors, object editing, dummy units, and utility packages |
The standard library provides essential packages for Warcraft III map development.
Source: https://github.com/wurstscript/WurstStdlib2
import Printing
print("Hello") // Display message to all players
printTimed("Hi", 5.0) // Display for 5 seconds
import ErrorHandling
// Throws error and stops execution
error("Something went wrong")
// Assertions
if condition
error("Condition failed")
Contains paths to built-in WC3 models and icons.
import Assets
let fx = addEffect(Abilities.thunderClapCaster, pos)
Unit testing framework:
import Wurstunit
@Test function testAddition()
1 + 1 .assertEquals(2)
@Test function testUnit()
let u = createUnit(...)
u.assertNotNull()
import ClosureTimers
// Run once after delay
doAfter(5.0) ->
print("5 seconds passed")
// Run periodically
doPeriodically(1.0) cb ->
print("Every second")
if shouldStop
destroy cb
// Run periodically with data
doPeriodicallyCounted(0.5, 10) (cb, count) ->
print("Tick " + count.toString())
// Null timer (next frame)
nullTimer() ->
print("Next frame")
import ClosureForGroups
// Iterate units in range
forUnitsInRange(pos, 500) u ->
u.damage(100)
// Iterate units of player
forUnitsOfPlayer(player) u ->
u.kill()
// Iterate units in rect
forUnitsInRect(rect) u ->
processUnit(u)
// Iterate with filter
forUnitsInRange(pos, 500, Filter(() -> GetFilterUnit().isAlive())) u ->
// only alive units
import ClosureEvents
// Spell cast events
EventListener.onCast(ABILITY_ID) caster ->
let target = EventData.getSpellTargetUnit()
EventListener.onPointCast(ABILITY_ID) (caster, targetPos) ->
flashEffect(FX, targetPos)
EventListener.onTargetCast(ABILITY_ID) (caster, target) ->
caster.damageTarget(target, 100)
// Unit events
EventListener.add(EVENT_PLAYER_UNIT_DEATH) ->
let dying = GetTriggerUnit()
// Player-specific
EventListener.add(player, EVENT_PLAYER_UNIT_ATTACKED) ->
// only for this player
import Execute
// Execute heavy computation in chunks to avoid op limit
execute() ->
for i = 0 to 10000
// heavy work
import LinkedList
let list = new LinkedList<int>()
list.add(1)
list.add(2)
list.add(3)
// Iteration
for elem in list
print(elem.toString())
// Operations
list.size()
list.get(0)
list.remove(2)
list.has(1)
list.clear()
// Functional
list.filter(x -> x > 1)
list.map(x -> x * 2)
list.foldl(0, (acc, x) -> acc + x)
destroy list
import HashMap
let map = new HashMap<unit, int>()
map.put(someUnit, 100)
let value = map.get(someUnit)
map.has(someUnit)
map.remove(someUnit)
// Iteration
for key in map
let val = map.get(key)
destroy map
Combination of HashMap and LinkedList for ordered unique elements:
import HashList
let hashList = new HashList<unit>()
hashList.add(unit1)
hashList.add(unit2)
hashList.has(unit1) // O(1) lookup
hashList.remove(unit1)
import BitSet
var bits = bitset(0)
bits = bits.add(3) // set bit 3
bits = bits.add(5) // set bit 5
bits.contains(3) // true
bits = bits.remove(3) // unset bit 3
import Vectors
// 2D vectors
let v2 = vec2(100, 200)
v2.x
v2.y
v2.length()
v2.norm() // normalized
v2.rotate(angle(45))
// 3D vectors
let v3 = vec3(100, 200, 50)
v3.toVec2() // drop z
v3.withZ(100) // change z
// Operations
v2 + v2
v2 - v2
v2 * 2.0 // scale
v2.dot(other)
v2.angleTo(other)
v2.distanceTo(other)
// Conversions
v2.toVec3()
v2.withZ(height)
import Angle
let a = angle(90) // degrees
let a2 = (PI/2).asAngleRadians() // radians
a.degrees()
a.radians()
a.sin()
a.cos()
a.toVec(length) // direction vector
// Operations
a + a2
a - a2
a.normalize() // 0-360 range
import Quaternion
let q = quat(axis, angle)
let rotated = q.rotate(vec3)
import DummyRecycler
// Get a recycled dummy
let dummy = DummyRecycler.get(pos, angle)
// Return when done
DummyRecycler.recycle(dummy)
import DummyCaster
// Cast ability instantly
new DummyCaster()
..owner(player)
..origin(casterPos)
..castTarget(ABILITY_ID, 1, target)
// Cast at point
new DummyCaster()
..owner(player)
..origin(casterPos)
..castPoint(ABILITY_ID, 1, targetPos)
// Immediate (no projectile)
new DummyCaster()
..owner(player)
..origin(casterPos)
..castImmediate(ABILITY_ID, 1)
Create WC3 objects in code at compile time:
import UnitObjEditing
@compiletime function createUnit()
new UnitDefinition('u001', 'hfoo')
..setName("Custom Footman")
..setHitPointsMaximumBase(500)
..setAttack1DamageBase(15)
..setMoveSpeed(300)
import AbilityObjEditing
@compiletime function createAbility()
new AbilityDefinitionFireBolt('A001')
..setName("Super Bolt")
..setDamage(1, 150)
..setCooldown(1, 8)
..setManaCost(1, 75)
..setCastRange(1, 600)
import ItemObjEditing
@compiletime function createItem()
new ItemDefinition('I001', 'rst1')
..setName("Magic Sword")
..setAbilities("A001")
..setGoldCost(500)
import BuffObjEditing
@compiletime function createBuff()
new BuffDefinition('B001', 'Bslo')
..setName("Slowed")
..setTooltipNormal(1, "Slowed")
..setIcon(Icons.bTNSlow)
import UpgradeObjEditing
@compiletime function createUpgrade()
new UpgradeDefinition('R001')
..setName(1, "Better Weapons")
..addEffectAttackDamageBonus(0, 10)
..setGoldCostBase(100)
import DialogBox
let dialog = new DialogBox("Choose wisely")
dialog.addButton("Option A") ->
print("Chose A")
dialog.addButton("Option B") ->
print("Chose B")
dialog.display(player, true)
import Simulate3dSound
// Play sound with 3D positioning
let sound = new Sound(...)
sound.playOnPoint(pos.withTerrainZ())
import Colors
let c = color(255, 0, 0) // RGB
let c2 = colorA(255, 0, 0, 128) // RGBA
player.getColor().toColor()
"|cffff0000Red Text|r"
import StringUtils
"hello".charAt(0)
"hello".substring(1, 3)
"hello".contains("ell")
" hello ".trim()
123.toString()
"123".toInt()
destroy on classes when doneGetting started with WurstScript for Warcraft 3 map development including project structure, first map, and basic spell creation
WurstScript community resources including example maps, libraries, frameworks, and project showcases for Warcraft 3 modding
WurstScript language reference covering syntax, types, classes, modules, generics, lambdas, and all language features for Warcraft 3 modding
WurstScript installation, project setup, build configuration, dependency management, and VSCode extension usage for Warcraft 3 modding
WurstScript tutorials covering spell creation, legacy map migration, save/load systems, hot code reload, and advanced techniques