Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 02-28-2008, 05:09 AM   #1
Doughnut-4|4-
 
Join Date: May 2007
Posts Rated Helpful 0 Times
Requesting LUA Coder for Arena Map

I got the code I need for my map below, but it's wrong cause it won't work. Can someone clean up my mess? Appreciated, Thanks.

Quote:
-- ff_beta.lua

-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_location");
-----------------------------------------------------------------------------
-- startup
-----------------------------------------------------------------------------
function startup()
SetTeamName(Team.kBlue, "Blue Pirates")
SetTeamName(Team.kRed, "Red Ninjas")
SetTeamName(Team.kYellow, "Yellow Sasquatches")
SetTeamName(Team.kGreen, "Green Zombies")

-- set up team limits
local team = GetTeam( Team.kBlue )
team:SetPlayerLimit( 0 )
team:SetClassLimit( 0 )

team = GetTeam( Team.kRed )
team:SetPlayerLimit( 0 )
team:SetClassLimit( 0 )

team = GetTeam( Team.kYellow )
team:SetPlayerLimit( 0 )
team:SetClassLimit( 0 )

team = GetTeam( Team.kGreen )
team:SetPlayerLimit( 0 )
team:SetClassLimit( 0 )

-----------------------------------------------------------------------------
-- Spawn Supplies
-----------------------------------------------------------------------------

function player_spawn( player_entity )
local player = CastToPlayer( player_entity )

player:AddHealth( 100 )
player:AddArmor( 300 )

player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
--player:AddAmmo( Ammo.kDetpack, 1 )

--player:RemoveAmmo( Ammo.kGren2, 4 )
end

-----------------------------------------------------------------------------
-- Bags
-----------------------------------------------------------------------------

blue_bagcustom = genericbackpack:new({
health = 100,
armor = 300,
grenades = 20,
bullets = 300,
nails = 300,
shells = 300,
rockets = 300,
cells = 200,
detpacks = 1,
gren1 = 4,
gren2 = 4,
respawntime = 3,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
notallowedmsg = "#FF_NOTALLOWEDPACK",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue}
})
red_bagcustom = genericbackpack:new({
health = 100,
armor = 300,
grenades = 20,
bullets = 300,
nails = 300,
shells = 300,
rockets = 300,
cells = 100,
detpacks = 1,
gren1 = 4,
gren2 = 4,
respawntime = 3,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
notallowedmsg = "#FF_NOTALLOWEDPACK",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kRed}
})
-----------------------------------------------------------------------------
-- Locations
-----------------------------------------------------------------------------

location_arena1 = location_info:new({ text = "Arena 1", team = NO_TEAM })
location_arena2 = location_info:new({ text = "Arena 2", team = NO_TEAM })
location_arena3 = location_info:new({ text = "Arena 3", team = NO_TEAM })
location_arena4 = location_info:new({ text = "Arena 4", team = NO_TEAM })
location_arena5 = location_info:new({ text = "Arena 5", team = NO_TEAM })
location_arena6 = location_info:new({ text = "Arena 6", team = NO_TEAM })
location_arena7 = location_info:new({ text = "Arena 7", team = NO_TEAM })
location_arena8 = location_info:new({ text = "Arena 8", team = NO_TEAM })

-----------------------------------------------------------------------------
-- Buttons
-----------------------------------------------------------------------------

bluebutton1 = func_button:new({})
function bluebutton1:ondamage() OutputEvent( "bluebutton1", "Open" ) end
function bluebutton1:onpress() OutputEvent( "bluebutton1", "Open" ) end

bluebutton2 = func_button:new({})
function bluebutton2:ondamage() OutputEvent( "bluebutton2", "Open" ) end
function bluebutton2:onpress() OutputEvent( "bluebutton2", "Open" ) end

bluebutton3 = func_button:new({})
function bluebutton3:ondamage() OutputEvent( "bluebutton3", "Open" ) end
function bluebutton3:onpress() OutputEvent( "bluebutton3", "Open" ) end

bluebutton4 = func_button:new({})
function bluebutton4:ondamage() OutputEvent( "bluebutton4", "Open" ) end
function bluebutton4:onpress() OutputEvent( "bluebutton4", "Open" ) end

bluebutton5 = func_button:new({})
function bluebutton5:ondamage() OutputEvent( "bluebutton5", "Open" ) end
function bluebutton5:onpress() OutputEvent( "bluebutton5", "Open" ) end

bluebutton6 = func_button:new({})
function bluebutton6:ondamage() OutputEvent( "bluebutton6", "Open" ) end
function bluebutton6:onpress() OutputEvent( "bluebutton6", "Open" ) end

bluebutton7 = func_button:new({})
function bluebutton7:ondamage() OutputEvent( "bluebutton7", "Open" ) end
function bluebutton7:onpress() OutputEvent( "bluebutton7", "Open" ) end

bluebutton8 = func_button:new({})
function bluebutton8:ondamage() OutputEvent( "bluebutton8", "Open" ) end
function bluebutton8:onpress() OutputEvent( "bluebutton8", "Open" ) end

redbutton1 = func_button:new({})
function redbutton1:ondamage() OutputEvent( "redbutton1", "Open" ) end
function redbutton1:onpress() OutputEvent( "redbutton1", "Open" ) end

redbutton2 = func_button:new({})
function redbutton2:ondamage() OutputEvent( "redbutton2", "Open" ) end
function redbutton2:onpress() OutputEvent( "redbutton2", "Open" ) end

redbutton3 = func_button:new({})
function redbutton3:ondamage() OutputEvent( "redbutton3", "Open" ) end
function redbutton3:onpress() OutputEvent( "redbutton3", "Open" ) end

redbutton4 = func_button:new({})
function redbutton4:ondamage() OutputEvent( "redbutton4", "Open" ) end
function redbutton4:onpress() OutputEvent( "redbutton4", "Open" ) end

redbutton5 = func_button:new({})
function redbutton5:ondamage() OutputEvent( "redbutton5", "Open" ) end
function redbutton5:onpress() OutputEvent( "redbutton5", "Open" ) end

redbutton6 = func_button:new({})
function redbutton6:ondamage() OutputEvent( "redbutton6", "Open" ) end
function redbutton6:onpress() OutputEvent( "redbutton6", "Open" ) end

redbutton7 = func_button:new({})
function redbutton7:ondamage() OutputEvent( "redbutton7", "Open" ) end
function redbutton7:onpress() OutputEvent( "redbutton7", "Open" ) end

redbutton8 = func_button:new({})
function redbutton8:ondamage() OutputEvent( "redbutton8", "Open" ) end
function redbutton8:onpress() OutputEvent( "redbutton8", "Open" ) end

bluearena0_telebutton1 = func_button:new({})
function bluearena0_telebutton1:ondamage() OutputEvent( "bluearena0_telebutton1", "Open" ) end
function bluearena0_telebutton1:onpress() OutputEvent( "bluearena0_telebutton1", "Open" ) end

bluearena0_telebutton2 = func_button:new({})
function bluearena0_telebutton2:ondamage() OutputEvent( "bluearena0_telebutton2", "Open" ) end
function bluearena0_telebutton2:onpress() OutputEvent( "bluearena0_telebutton2", "Open" ) end

bluearena0_telebutton3 = func_button:new({})
function bluearena0_telebutton3:ondamage() OutputEvent( "bluearena0_telebutton3", "Open" ) end
function bluearena0_telebutton3:onpress() OutputEvent( "bluearena0_telebutton3", "Open" ) end

bluearena0_telebutton4 = func_button:new({})
function bluearena0_telebutton4:ondamage() OutputEvent( "bluearena0_telebutton4", "Open" ) end
function bluearena0_telebutton4:onpress() OutputEvent( "bluearena0_telebutton4", "Open" ) end

bluearena0_telebutton5 = func_button:new({})
function bluearena0_telebutton5:ondamage() OutputEvent( "bluearena0_telebutton5", "Open" ) end
function bluearena0_telebutton5:onpress() OutputEvent( "bluearena0_telebutton5", "Open" ) end

bluearena0_telebutton6 = func_button:new({})
function bluearena0_telebutton6:ondamage() OutputEvent( "bluearena0_telebutton6", "Open" ) end
function bluearena0_telebutton6:onpress() OutputEvent( "bluearena0_telebutton6", "Open" ) end

bluearena0_telebutton7 = func_button:new({})
function bluearena0_telebutton7:ondamage() OutputEvent( "bluearena0_telebutton7", "Open" ) end
function bluearena0_telebutton7:onpress() OutputEvent( "bluearena0_telebutton7", "Open" ) end

bluearena0_telebutton8 = func_button:new({})
function bluearena0_telebutton8:ondamage() OutputEvent( "bluearena0_telebutton8", "Open" ) end
function bluearena0_telebutton8:onpress() OutputEvent( "bluearena0_telebutton8", "Open" ) end


redarena0_telebutton1 = func_button:new({})
function redarena0_telebutton1:ondamage() OutputEvent( "redarena0_telebutton1", "Open" ) end
function redarena0_telebutton1:onpress() OutputEvent( "redarena0_telebutton1", "Open" ) end

redarena0_telebutton2 = func_button:new({})
function redarena0_telebutton2:ondamage() OutputEvent( "redarena0_telebutton2", "Open" ) end
function redarena0_telebutton2:onpress() OutputEvent( "redarena0_telebutton2", "Open" ) end

redarena0_telebutton3 = func_button:new({})
function redarena0_telebutton3:ondamage() OutputEvent( "redarena0_telebutton3", "Open" ) end
function redarena0_telebutton3:onpress() OutputEvent( "redarena0_telebutton3", "Open" ) end

redarena0_telebutton4 = func_button:new({})
function redarena0_telebutton4:ondamage() OutputEvent( "redarena0_telebutton4", "Open" ) end
function redarena0_telebutton4:onpress() OutputEvent( "redarena0_telebutton4", "Open" ) end

redarena0_telebutton5 = func_button:new({})
function redarena0_telebutton5:ondamage() OutputEvent( "redarena0_telebutton5", "Open" ) end
function redarena0_telebutton5:onpress() OutputEvent( "redarena0_telebutton5", "Open" ) end

redarena0_telebutton6 = func_button:new({})
function redarena0_telebutton6:ondamage() OutputEvent( "redarena0_telebutton6", "Open" ) end
function redarena0_telebutton6:onpress() OutputEvent( "redarena0_telebutton6", "Open" ) end

redarena0_telebutton7 = func_button:new({})
function redarena0_telebutton7:ondamage() OutputEvent( "redarena0_telebutton7", "Open" ) end
function redarena0_telebutton7:onpress() OutputEvent( "redarena0_telebutton7", "Open" ) end

redarena0_telebutton8 = func_button:new({})
function redarena0_telebutton8:ondamage() OutputEvent( "redarena0_telebutton8", "Open" ) end
function redarena0_telebutton8:onpress() OutputEvent( "redarena0_telebutton8", "Open" ) end

-----------------------------------------------------------------------------
-- Spawns
-----------------------------------------------------------------------------

red_o_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and ((player:GetClass() == Player.kCivilian) or (player:GetClass() == Player.kCivilian) or (player:GetClass() == Player.kCivilian))) end
red_d_only = function(self,player) return ((player:GetTeamId() == Team.kRed) and (((player:GetClass() == Player.kCivilian) == false) and ((player:GetClass() == Player.kCivilian) == false) and ((player:GetClass() == Player.kCivilian) == false))) end

red_ospawn = { validspawn = red_o_only }
red_dspawn = { validspawn = red_d_only }

blue_o_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and ((player:GetClass() == Player.kCivilian) or (player:GetClass() == Player.kCivilian) or (player:GetClass() == Player.kCivilian))) end
blue_d_only = function(self,player) return ((player:GetTeamId() == Team.kBlue) and (((player:GetClass() == Player.kCivilian) == false) and ((player:GetClass() == Player.kCivilian) == false) and ((player:GetClass() == Player.kCivilian) == false))) end

blue_ospawn = { validspawn = blue_o_only }
blue_dspawn = { validspawn = blue_d_only }

yellow_o_only = function(self,player) return ((player:GetTeamId() == Team.kYellow) and ((player:GetClass() == Player.kCivilian) or (player:GetClass() == Player.kCivilian) or (player:GetClass() == Player.kCivilian))) end
yellow_d_only = function(self,player) return ((player:GetTeamId() == Team.kYellow) and (((player:GetClass() == Player.kCivilian) == false) and ((player:GetClass() == Player.kCivilian) == false) and ((player:GetClass() == Player.kCivilian) == false))) end

yellow_ospawn = { validspawn = yellow_o_only }
yellow_dspawn = { validspawn = yellow_d_only }

green_o_only = function(self,player) return ((player:GetTeamId() == Team.kGreen) and ((player:GetClass() == Player.kCivilian) or (player:GetClass() == Player.kCivilian) or (player:GetClass() == Player.kCivilian))) end
green_d_only = function(self,player) return ((player:GetTeamId() == Team.kGreen) and (((player:GetClass() == Player.kCivilian) == false) and ((player:GetClass() == Player.kCivilian) == false) and ((player:GetClass() == Player.kCivilian) == false))) end

green_ospawn = { validspawn = green_o_only }
green_dspawn = { validspawn = green_d_only }

-----------------------------------------------------------------------------
Doughnut-4|4- is offline   Reply With Quote


Old 02-28-2008, 05:13 AM   #2
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Need to include base_teamplay ?

Also, you can consolidate all those func_buttons down quite a bit. I'll do that for you when I get time.

And, what parts aren't working? Are there any errors in the console?
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 02-29-2008, 03:37 AM   #3
Doughnut-4|4-
 
Join Date: May 2007
Posts Rated Helpful 0 Times
I think the maps close to beta. Not much is working. I was hoping someone could spot something obvious in the code. I can keep busy for now on the map, and I'll bug ya later on this LUA if nothings been posted.
Doughnut-4|4- is offline   Reply With Quote


Old 02-29-2008, 03:39 AM   #4
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Well, I'd say this is the most glaring omission:

Code:
IncludeScript("base_teamplay");
Not sure if it's needed, but there's no reason not to include it.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 02-29-2008, 09:19 AM   #5
Doughnut-4|4-
 
Join Date: May 2007
Posts Rated Helpful 0 Times
After toying around a little tonight I can tell you I took it ("base_teamplay") out because while removed I could still spawn... even though my class specific spawns weren't working... so I left it out. But ya it needs to go back in I guess and I need to fix the spawns so they work.

I just ran into a bug where my supply bags aren't appearing in certain spawns. I move them outside the spawn and they appear. I'm like wtf? Double checking my coordinates... and I just need sleep right now. lol

Last edited by Doughnut-4|4-; 03-01-2008 at 01:59 AM.
Doughnut-4|4- is offline   Reply With Quote


Old 02-29-2008, 02:45 PM   #6
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
Quote:
Originally Posted by Doughnut-4|4-
After toying around a little tonight I can tell you I took it out because while removed I could still spawn... even though my class specific spawns weren't working... so I left it out. But ya it needs to go back in I guess and I need to fix the spawns so they work.

I just ran into a bug where my supply bags aren't appearing in certain spawns. I move them outside the spawn and they appear. I'm like wtf? Double checking my coordinates... and I just need sleep right now. lol
I think you have to have the base_teamplay.lua for things like green_ammobackpack to work or show up at all.
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 02-29-2008, 07:13 PM   #7
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Doughnut, if you want help you're going to have to stop using unexplained pronouns and perhaps start to follow my advice. Include base_teamplay first and try that. Then, explain what you're talking about when you say "it".
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 03-04-2008, 05:57 PM   #8
Doughnut-4|4-
 
Join Date: May 2007
Posts Rated Helpful 0 Times
I got a beta and I got sleep. Hopefully i'll make more sense in the future. Thanks to Sidd I even got my Batch Compiler running. I released the beta and I got several LUA problems. Please note the LUA with the beta map zip isn't what I want; I just zipped it so people would have an LUA. The original LUA posted above is close to what I want... if it'd work.

Map Thread:
http://www.fortress-forever.com/foru...ad.php?t=14888

#1) I can't get four teams to spawn
(i will want all 10 classes).
#2) It'd be nice to make the teleporters team color only.
#3) I couldn't get Civilian Only spawns to work for specbox.

Last edited by Doughnut-4|4-; 03-04-2008 at 06:09 PM.
Doughnut-4|4- is offline   Reply With Quote


Old 03-05-2008, 05:35 PM   #9
public_slots_free
 
Join Date: Sep 2007
Posts Rated Helpful 0 Times
you need to include base_ctf4 to get all 4 teams to spawn or take a bunch of code from that lua. Team color teleporters is possible. Assign the teleporter a name that is an LUA function, the function checks the team color and allows if they are the right color and denies if they arent.
public_slots_free is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 07:07 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.