Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Init WormStuff

Events


Map initialization

Conditions

Actions


Set tempgroup = (Units of type Crypt Lord)


Unit Group - Pick every unit in tempgroup and do (Actions)



Loop - Actions




-------- You must add the "headunit" on your snake in the first array --------




-------- we are only using one segmentunit array to make it easier. Every player starts their "head" at (playerindex*100)-99 --------




Set WormPart[(((Player number of (Owner of (Picked unit))) x 100) - 99)] = (Picked unit)




-------- no segments in the beginning, thus set it to 0 --------




Set CountSegment[(Player number of (Owner of (Picked unit)))] = 0


-------- Leak cleanage --------


Custom script: call DestroyGroup( udg_tempgroup )
New Segments

Events


Unit - A unit Dies

Conditions


(Unit-type of (Triggering unit)) Equal to Sheep

Actions


-------- Defines the owner of the killing unit's player index --------


Set player_index = (Player number of (Owner of (Killing unit)))


-------- Defines the first index of the players worm --------


Set starting_index = ((player_index x 100) - 99)


-------- Store the last wormsegment's point and create the new segment's spawn point --------


Set temppoint[0] = (Position of WormPart[(starting_index + CountSegment[player_index])])


Set temppoint[1] = (temppoint[0] offset by 128.00 towards (180.00 - (Facing of WormPart[(starting_index + CountSegment[player_index])])) degrees)


-------- Create the new worm segment --------


Unit - Create 1 Carrion Beetle (Level 1) for (Player(player_index)) at temppoint[1] facing (Facing of WormPart[(starting_index + CountSegment[player_index])]) degrees


-------- Order it to follow the previous wormsegment --------


Unit - Order (Last created unit) to Follow WormPart[(starting_index + CountSegment[player_index])]


-------- Increase Segment Index --------


Set CountSegment[player_index] = (CountSegment[player_index] + 1)


-------- Store the last created segment --------


Set WormPart[(starting_index + CountSegment[player_index])] = (Last created unit)


-------- Leak cleanage --------


Custom script: call RemoveLocation( udg_temppoint[0] )


Custom script: call RemoveLocation( udg_temppoint[1] )
