Difference between revisions of "Levelgen example: Funcorners"

From Bitfighter
(new)
 
Line 3: Line 3:
 
Each time you play this level, it will be different!
 
Each time you play this level, it will be different!
  
 +
<h2>Level Code</h2>
 +
Save the following in a file called "funcorners.level" in your levels folder.
 
<source lang="levelcode">
 
<source lang="levelcode">
 
RetrieveGameType 8 12
 
RetrieveGameType 8 12
Line 128: Line 130:
 
</source>
 
</source>
  
 +
<h2>Levelgen Code</h2>
 +
Save the following code in a file called "funcorners.levelgen" in your levels folder.
 
<source lang="lua">
 
<source lang="lua">
 
local CenterSquare = math.random(2)
 
local CenterSquare = math.random(2)

Revision as of 00:04, 29 October 2010

The following is a great level by Zoomber. Save the level in a file called "funcorners.level" in your levels folder, and save the levelgen code below in a file called "funcorners.levelgen" in that same folder.

Each time you play this level, it will be different!

Level Code

Save the following in a file called "funcorners.level" in your levels folder.

Invalid language.

You need to specify a language like this: <source lang="html4strict">...</source>

Supported languages for syntax highlighting:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


RetrieveGameType 8 12
LevelName FUNcorners
LevelDescription corners filled with fun
LevelCredits tip: burst twoards the health
Script funcorners.levelgen
Robot 0 QuickBot 1 .5 1 1
Robot 1 QuickBot 1 .5 1 1
GridSize 255
MinPlayers 0
MaxPlayers 0
Team Blue 0 0 1
Team Red 1 0 0
BarrierMaker 15 -2.1 2  -2 1.9  -1.9 2  -2 2.1  -2.1 2 
BarrierMaker 15 -1.1 2  -1 1.9  -0.9 2  -1 2.1  -1.1 2 
BarrierMaker 15 -1.1 1  -1 0.9  -0.9 1  -1 1.1  -1.1 1 
BarrierMaker 15 -1.1 -1.41561e-07  -1 -0.1  -0.9 -1.41561e-07  -1 0.1  -1.1 -1.41561e-07 
BarrierMaker 1 -0.3 -4  0.3 -4 
BarrierMaker 15 -1.1 -1  -1 -1.1  -0.9 -1  -1 -0.9  -1.1 -1 
BarrierMaker 15 -2.1 -2  -2 -2.1  -1.9 -2  -2 -1.9  -2.1 -2 
BarrierMaker 15 -2.1 1  -2 0.9  -1.9 1  -2 1.1  -2.1 1 
BarrierMaker 10 -2.1 -1.41561e-07  -2 -0.1  -1.9 -1.41561e-07  -2 0.1  -2.1 -1.41561e-07 
BarrierMaker 15 -2.1 -1  -2 -1.1  -1.9 -1  -2 -0.9  -2.1 -1 
BarrierMaker 5 0 -2.1  0 -2.2 
BarrierMaker 5 2.2 0  2.1 0 
BarrierMaker 15 -0.1 1  0 0.9  0.0999998 1  0 1.1  -0.1 1 
BarrierMaker 5 0 2.2  0 2.1 
BarrierMaker 15 -0.1 -1.49012e-07  0 -0.1  0.1 -1.49012e-07  0 0.1  -0.1 -1.49012e-07 
BarrierMaker 15 -0.1 -1  0 -1.1  0.0999998 -1  0 -0.9  -0.1 -1 
BarrierMaker 15 -1.1 -2  -1 -2.1  -0.9 -2  -1 -1.9  -1.1 -2 
BarrierMaker 10 -0.1 2  0 1.9  0.1 2  0 2.1  -0.1 2 
BarrierMaker 15 0.9 0  1 -0.1  1.1 0  1 0.0999999  0.9 0 
BarrierMaker 15 0.9 -1  1 -1.1  1.1 -1  1 -0.9  0.9 -1 
BarrierMaker 15 0.9 -2  1 -2.1  1.1 -2  1 -1.9  0.9 -2 
BarrierMaker 15 0.9 2  1 1.9  1.1 2  1 2.1  0.9 2 
BarrierMaker 10 -0.1 -2  0 -2.1  0.1 -2  0 -1.9  -0.1 -2 
BarrierMaker 15 1.9 -1  2 -1.1  2.1 -1  2 -0.9  1.9 -1 
BarrierMaker 15 1.9 2  2 1.9  2.1 2  2 2.1  1.9 2 
BarrierMaker 15 1.9 1  2 0.9  2.1 1  2 1.1  1.9 1 
BarrierMaker 50 -6 0.4  -6 0.4  -6 1  -8 1  -8 -1  -7.4 -1  -7.4 -2  -7.4 -3  -6.2 -3  -6.2 -2  -6.7 -2  -6.7 -1  -6 -1  -6 -0.3 
BarrierMaker 50 6 -0.4  6 -1  8 -1  8 1  7.4 1  7.4 2  7.4 3  6.2 3  6.2 2  6.7 2  6.7 1  6 1  6 0.3 
BarrierMaker 10 1.9 0  2 -0.1  2.1 0  2 0.0999999  1.9 0 
BarrierMaker 50 -3 0.3  -6 0.3  -6 -0.299999  -3 -0.299999  -3 -2.6  -3.5 -2.6  -3.5 -3.5  -2.6 -3.5  -2.6 -3  2.6 -3  2.6 -3.5  3.5 -3.5  3.5 -2.6  3 -2.6  3 -0.3 
BarrierMaker 50 2.9 -0.3  6 -0.299999  6 0.3  3 0.3  3 2.6  3.5 2.6  3.5 3.5  2.6 3.5  2.6 3  0.6 3  0.6 3.7  -0.6 3.7  -0.6 3  -2.6 3  -2.6 3.5  -3.5 3.5  -3.5 2.6  -3 2.6  -3 0.2 
BarrierMaker 5 -7 -0.2  -6.9 -0.2 
BarrierMaker 5 2.6 -0.1  2.6 0.1 
BarrierMaker 5 -2.6 -0.1  -2.6 0.1 
BarrierMaker 1 -0.1 -2.7  0.1 -2.7 
BarrierMaker 1 -0.1 3.1  0.1 3.1 
BarrierMaker 5 -2.2 0  -2.1 0 
BarrierMaker 5 7 0.1  6.9 0.1 
BarrierMaker 15 0.9 1  1 0.9  1.1 1  1 1.1  0.9 1 
BarrierMaker 15 1.9 -2  2 -2.1  2.1 -2  2 -1.9  1.9 -2 
Spawn 0 7.5 0.3 
Spawn 1 -7.5 -0.3 
Spawn 1 -7.5 -0.2 
LoadoutZone 1 -2.70196 -3.39804  -3.00196 -3.39804  -3.40196 -2.99804  -3.40196 -2.69804 
LoadoutZone 0 3.4 2.7  3.4 3  3 3.4  2.7 3.4 
LoadoutZone 0 3.4 -2.7  3.4 -3  3 -3.4  2.7 -3.4 
TextItem -1 -0.3 0.3  0.3 0.3  39 corners!
LoadoutZone -1 -0.4 3.1  0.4 3.1  0.4 3.5  -0.4 3.5 
ResourceItem 0 0 
AsteroidSpawn -1 0  30
RepairItem -2 -2  20
RepairItem 2 -2  20
RepairItem 2 2  20
ResourceItem 3.3 3.3 
FlagSpawn -1 -2.4 2.4  30
ResourceItem 3.3 -3.3 
TextItem -1 -0.2 -0.2  0.1 -0.2  51 fun
FlagItem -1 -2.4 2.4 
FlagItem -1 2.5 2.5 
RepairItem -2 2  20
FlagSpawn -1 2.5 2.5  30
LoadoutZone 1 -7.20196 0.198039  -6.2 0.2  -6.2 0.8  -7.2 0.8 
AsteroidSpawn 1 0  30
Teleporter -5.6 0  -6.5 0 
Teleporter 5.6 0  6.6 0 
Teleporter -6.6 -2.5  0 -2.5 
Teleporter 6.6 2.5  0 2.5 
FlagSpawn -1 2.5 -2.3  30
ResourceItem -3.3 3.3 
FlagItem -1 2.5 -2.3 
FlagSpawn -1 -2.4 -2.4  30
GoalZone 1 -7.7 0.6  -7.4 0.6  -7.4 0.8  -7.7 0.8 
GoalZone 1 -7.7 0.2  -7.4 0.2  -7.4 0.4  -7.7 0.4 
GoalZone 1 -6.5 -0.8  -6.2 -0.8  -6.2 -0.6  -6.5 -0.6 
GoalZone 1 -6.5 -0.5  -6.2 -0.5  -6.2 -0.3  -6.5 -0.3 
FlagItem -1 -2.4 -2.4 
ForceFieldProjector 1 -6.09804 -0.2  10
ResourceItem -3.30196 -3.29804 
LoadoutZone 0 7.20196 -0.298039  6.2 -0.3  6.2 -0.9  7.2 -0.9 
GoalZone 0 7.7 -0.7  7.4 -0.7  7.4 -0.9  7.7 -0.9 
GoalZone 0 7.7 -0.3  7.4 -0.3  7.4 -0.5  7.7 -0.5 
GoalZone 0 6.5 0.7  6.2 0.7  6.2 0.5  6.5 0.5 
GoalZone 0 6.5 0.4  6.2 0.4  6.2 0.2  6.5 0.2 
ForceFieldProjector 0 6.09804 0.0999999  10
Spawn 1 -7.6 -0.5 
Spawn 1 -7.6 -0.4 
Spawn 0 7.5 0.4 
Spawn 1 -7.6 -0.3 
Spawn 1 -7.6 -0.2 
Spawn 1 -7.5 -0.4 
Spawn 0 7.6 0.5 
Spawn 1 -7.5 -0.5 
Spawn 0 7.6 0.4 
Spawn 0 7.6 0.2 
Spawn 0 7.5 0.5 
Spawn 0 7.6 0.3 
Spawn 0 7.5 0.2 
LoadoutZone 1 -3.4 2.7  -3.4 3  -3 3.4  -2.7 3.4 
TextItem -2 -2.2 -4.3  2.3 -4.3  31 Editor's note: this is the plank pile, when I have an on/off trigger
TextItem -2 -0.8 -4.1  0.8 -4.1  33 for the then statement
BotNavMeshZone -7.30196 -2.90196  -6.29804 -2.90196  -6.29804 -2.09804  -7.30196 -2.09837 
BotNavMeshZone -7.30518 -2.10837  -6.79868 -2.1082  -6.78804 -0.911961  -7.31001 -0.911961 
BotNavMeshZone -7.90518 -0.911961  -6.10125 -0.911961  -6.10125 0.891961  -7.90518 0.881571 
BotNavMeshZone -5.90196 -0.20196  -2.90196 -0.21196  -2.90196 0.2  -5.90196 0.19804 
BotNavMeshZone -2.90675 -2.8892  2.90193 -2.90994  2.90701 2.90346  -2.90026 2.89372 
BotNavMeshZone -0.501851 2.89774  0.511645 2.89944  0.501961 3.60196  -0.501961 3.60196 
BotNavMeshZone 7.29875 2.89196  6.29482 2.89196  6.29482 2.08804  7.29875 2.08837 
BotNavMeshZone 7.29875 2.08837  6.80403 2.0882  6.78482 0.90196  7.3068 0.90196 
BotNavMeshZone 7.90196 0.90196  6.09804 0.90196  6.09804 -0.901961  7.90196 -0.891571 
BotNavMeshZone 5.90428 -0.209381  2.90428 -0.219381  2.90428 0.192579  5.90428 0.190619

Levelgen Code

Save the following code in a file called "funcorners.levelgen" in your levels folder.

local CenterSquare = math.random(2)
if(CenterSquare == 2) then
	levelgen:addLevelLine("BarrierMaker 200 -0.4 0  0.4 0")
else
	levelgen:addLevelLine("RepairItem 0 0  20")
end
 
local loadoutblocker1 = math.random(2)
if(loadoutblocker1 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -2.0708 -2.0708  0")
	levelgen:addLevelLine("BarrierMaker 10 -2.1 -2.1  -2 -2.1 ")
	levelgen:addLevelLine("BarrierMaker 10 -2.1 -2  -2.1 -2.1 ")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local loadoutblocker2 = math.random(2)
if(loadoutblocker2 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 2.06979 -2.0718  0")
	levelgen:addLevelLine("BarrierMaker 10 2 -2.1  2.1 -2.1 ")
	levelgen:addLevelLine("BarrierMaker 10 2.1 -2  2.1 -2.1 ")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local loadoutblocker3 = math.random(2)
if(loadoutblocker3 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -2.0708 2.0708  0")
	levelgen:addLevelLine("BarrierMaker 10 2.1 2.1  2 2.1 ")
	levelgen:addLevelLine("BarrierMaker 10 2.1 2.1  2.1 2 ")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local loadoutblocker4 = math.random(2)
if(loadoutblocker4 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 2.0708 2.0708  0")
	levelgen:addLevelLine("BarrierMaker 10 -2.1 2.1  -2 2.1  ")
	levelgen:addLevelLine("BarrierMaker 10 -2.1 2.1  -2.1 2  ")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d1 = math.random(2)
if(d1 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -0.929203 -1.0708  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d2 = math.random(2)
if(d2 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -1.0708 -1.0708  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.2 -4  0.3 -4  ")
end
 
local d3 = math.random(2)
if(d3 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 2.2 1.50996e-08  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d4 = math.random(2)
if(d4 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -1.0708 -0.929203  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d5 = math.random(2)
if(d5 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -1.0708 0.929203  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d6 = math.random(2)
if(d6 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -0.929203 0.929203  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d7 = math.random(2)
if(d7 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -1.0708 1.0708  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d8 = math.random(2)
if(d8 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 0.929203 1.0708  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d9 = math.random(2)
if(d9 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 0.929203 0.929203  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d10 = math.random(2)
if(d10 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 1.0708 0.929203  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d11 = math.random(2)
if(d11 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 1.0708 1.0708  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d12 = math.random(2)
if(d12 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 0.929203 -0.929203  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d13 = math.random(2)
if(d13 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 0.929203 -1.0708  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d14 = math.random(2)
if(d14 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 8.9407e-08 -2.2  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d15 = math.random(2)
if(d15 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 1.0708 -0.929203  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d16 = math.random(2)
if(d16 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -0.929203 1.0708  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d17 = math.random(2)
if(d17 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -0.929203 -0.929203  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d18 = math.random(2)
if(d18 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -4.37114e-09 -2.2  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d19 = math.random(2)
if(d19 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 2.2 0  0")
	levelgen:addLevelLine("ForceFieldProjector -2 2.2 0  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
 
local d20 = math.random(2)
if(d20 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 0 2.2  0")
	levelgen:addLevelLine("ForceFieldProjector -2 0 2.2  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
 
local d21 = math.random(2)
if(d21 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 1.0708 -1.0708  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
 
local d22 = math.random(2)
if(d22 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -2.2 0  0")
	levelgen:addLevelLine("ForceFieldProjector -2 -2.2 0  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local d23 = math.random(2)
if(d23 == 2) then
	levelgen:addLevelLine("ForceFieldProjector -2 -4.37114e-09 -2.2  0")
else
	levelgen:addLevelLine("BarrierMaker 1 -0.3 -4  0.3 -4  ")
end
 
local port1 = math.random(2)
if(port1 == 2) then
	levelgen:addLevelLine("Teleporter 2 0  -2 -2 ")
else
	levelgen:addLevelLine("Ship 2 0  -2 -2 ")
end
 
local port2 = math.random(2)
if(port2 == 2) then
	levelgen:addLevelLine("Teleporter -2 0  2 2 ")
else
	levelgen:addLevelLine("Ship -2 0  2 2 ")
end
 
local port3 = math.random(2)
if(port3 == 2) then
	levelgen:addLevelLine("Teleporter 0 2  2 -2 ")
else
	levelgen:addLevelLine("ship 0 2  2 -2 ")
end
 
local port4 = math.random(2)
if(port4 == 2) then
	levelgen:addLevelLine("Teleporter 0 -2  -2 2 ")
else
	levelgen:addLevelLine("Shipitem 0 0 -2  -2 2 ")
end
 
local test1 = math.random(2)
if(test1 == 2) then
	levelgen:addLevelLine("TestItem -1 -1 ")
else
	levelgen:addLevelLine("Ship -1 -1 ")
end
 
local test2 = math.random(2)
if(test2 == 2) then
	levelgen:addLevelLine("TestItem -1 1 ")
else
	levelgen:addLevelLine("ship -1 1  ")
end
 
local test3 = math.random(2)
if(test3 == 2) then
	levelgen:addLevelLine("TestItem 1 1 ")
else
	levelgen:addLevelLine("ship 1 1 ")
end
 
local test4 = math.random(2)
if(test4 == 2) then
	levelgen:addLevelLine("TestItem 1 -1 ")
else
	levelgen:addLevelLine("ship 1 -1  ")
end
 
local loadout = math.random(2)
if(loadout == 2) then
	levelgen:addLevelLine("BarrierMaker 50 -0.4 3  0.4 3 ")
else
	levelgen:addLevelLine("ResourceItem -0.4 3  0.4 3 ")
end
 
local turret1 = math.random(2)
if(test1 == 2) then
	levelgen:addLevelLine("Turret 1 -7 -2.90196  10")
	levelgen:addLevelLine("Turret 0 7.6 0.901961  10")
else
	levelgen:addLevelLine("Ship -1 -1 ")
end
 
local turret2 = math.random(2)
if(test3 == 2) then
	levelgen:addLevelLine("Turret 0 7 2.90196  0")				
	levelgen:addLevelLine("Turret 1 -7.6 -0.901961  5")
else
	levelgen:addLevelLine("ship 1 1 ")
end