XXXRL series seems to have interesting LUA concepts and have a lot to teach and inspire
Code: Select all
-- SANDBOX HELLS ARENA ----------------------------------------------------------
Levels("CUSTOM",{
name = "Hell's Arena",
Create = function ()
Level.fill(CELL_PRWALL)
Level.tile(".",CELL_FLOOR)
Level.tile("X",CELL_RWALL)
Level.tile("#",CELL_RWALL)
Level.tile(",",CELL_BLOOD)
Level.tile(">",CELL_STAIRS)
Level.put(2,2,{
"#######################.............................########################",
"###########.....................................................############",
"#####..................................................................#####",
"##........................................................................##",
"#..........................................................................#",
"............................................................................",
"..................................,,,,,,....................................",
"..,,,.............................,,,,,,,...................................",
"..,>,............................,,,,,,,,,..................................",
"..,,,............................,,,,,,,,...................................",
"..................................,,,,,,....................................",
"............................................................................",
"............................................................................",
"#..........................................................................#",
"##........................................................................##",
"#####..................................................................#####",
"###########.....................................................############",
"#######################.............................########################",
})
Level.scatterPut(5,3,68,15,{
",..,.,",
",XXXX.",
".XXXX,",
".XXXX.",
",..,.,",
},CELL_FLOOR,9+random(8))
Level.scatter(2,2,77,19,CELL_FLOOR,CELL_BLOOD,100)
Level.player(38,10)
end,
OnEnter = function ()
Player.setWeapon( ITEM_SHOTGUN )
Player.addItem( ITEM_SHELL )
Player.addItem( ITEM_SHELL )
Player.addItem( ITEM_SHELL )
Player.addItem( ITEM_SHELL )
Level.result(1)
msg("A devilish voice announces:")
msg("\"Welcome to Hell's Arena, mortal!\"")
msg("\"You are either very foolish, or very brave. Either way I like it!\"")
msg("\"And so do the crowds!\"")
msg("Suddenly you hear screams everywhere! \"Blood! Blood! BLOOD!\"")
msg("The voice booms again, \"Kill all enemies and I shall reward thee!\"")
Level.summon(NPC_DEMON,3)
Level.summon(NPC_LOSTSOUL,2)
Level.summon(NPC_CACODEMON,1)
end,
OnKill = function ()
local temp = random(3)
if temp == 0 then msg("The crowds go wild! \"BLOOD! BLOOD!\"")
elseif temp == 1 then msg("The crowds cheer! \"Blood! Blood!\"")
else msg("The crowds cheer! \"Kill! Kill!\"") end
end,
OnKillAll = function ()
if Level.result() == 1 then
msg("The voice booms, \"Not bad mortal! For a weakling that you ")
msg("are, you show some determination.\"");
msg("You hear screams everywhere! \"More Blood! More BLOOD!\"")
msg("The voice continues, \"I can now let you go free, or")
msg("you may try to complete the challenge!\"");
local choice = msgconfirm("\"Do you want to continue the fight?\"")
if choice then
msg("The voice booms, \"I like it! Let the show go on!\"")
msg("You hear screams everywhere! \"More Blood! More BLOOD!\"")
Level.drop(ITEM_CHAINGUN)
Level.summon(NPC_DEMON,3)
Level.summon(NPC_CACODEMON,2)
Level.result(2);
else
msg("The voice booms, \"Coward!\" ")
msg("You hear screams everywhere! \"Coward! Coward! COWARD!\"")
end
return
end
if Level.result() == 2 then
msg("The voice booms, \"Impressive mortal! Your determination")
msg("to survive makes me excited!\"")
msg("You hear screams everywhere! \"More Blood! More BLOOD!\"")
msg("\"I can let you go now, and give you a small reward, or")
msg("you can choose to fight the final challenge!\"")
local choice = msgconfirm("\"Do you want to continue the fight?\"")
if choice then
msg("The voice booms, \"Excellent! May the fight begin!!!\"")
msg("You hear screams everywhere! \"Kill, Kill, KILL!\"")
Level.drop(ITEM_SHELL,4)
Level.drop(ITEM_AMMO,4)
Level.summon(NPC_CACODEMON,3)
Level.result(3);
else
msg("The voice booms, \"Too bad, you won't make it far then...!\" ")
msg("You hear screams everywhere! \"Boooo...\"")
Level.drop(ITEM_SHELL,3)
Level.drop(ITEM_LMED)
Level.drop(ITEM_SMED)
end
return
end
if Level.result() == 3 then
msg("The voice booms, \"Congratulations mortal! A pity you came to")
msg("destroy us, for you would make a formidable hell warrior!\"")
msg("\"I grant you the title of Hell's Arena Champion!\"")
msg("\"And a promise is a promise... search the arena again...\"")
Level.drop(ITEM_SCGLOBE)
Level.drop(ITEM_BARMOR)
Level.drop(ITEM_LMED)
Level.result(4)
end
end,
OnExit = function ()
msg("The voice laughs, \"Flee mortal, flee! There's no hiding in hell!\"")
end,
})