Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 08-20-2012, 06:44 AM   #81
FDA_Approved
Beta Tester
 
FDA_Approved's Avatar
 
Join Date: Nov 2011
Gametype: Capture the Flag
Posts Rated Helpful 293 Times
I got it all working except the clip refill. It says:

Attempted to create unknown entity type func_regenerate!
Can't init func_regenerate

The damage script works though.
FDA_Approved is offline   Reply With Quote


Old 08-20-2012, 07:32 AM   #82
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.
Not sure where that error is coming from, but it's not the Lua (Lua errors/messages are all prefixed with [SCRIPT]). I just tested the resupply script I posted and it seems to work for me.

Could you post your whole Lua?
__________________
#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

Last edited by squeek.; 08-20-2012 at 07:33 AM.
squeek. is offline   Reply With Quote


Old 08-20-2012, 07:39 AM   #83
FDA_Approved
Beta Tester
 
FDA_Approved's Avatar
 
Join Date: Nov 2011
Gametype: Capture the Flag
Posts Rated Helpful 293 Times
Code:
-----------------------------------------------------------------------------
-- set class limits
-----------------------------------------------------------------------------
function startup()
SetGameDescription("Fly!")

-- set up team limits on each team
SetPlayerLimit(Team.kBlue, 0)
SetPlayerLimit(Team.kRed, 0)
SetPlayerLimit(Team.kYellow, -1)
SetPlayerLimit(Team.kGreen, -1)

local team = GetTeam(Team.kBlue)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kSniper, SNIPER_LIMIT)

team = GetTeam(Team.kRed)
team:SetClassLimit(Player.kCivilian, -1)
team:SetClassLimit(Player.kSniper, SNIPER_LIMIT)
end 

-----------------------------------------------------------------------------
-- Player spawn: give full health, armor, and ammo
-----------------------------------------------------------------------------
function player_spawn( player_entity ) 
   local player = CastToPlayer( player_entity ) 

   player:AddHealth( 400 ) 
   player:AddArmor( 400 ) 

   player:AddAmmo( Ammo.kNails, 400 ) 
   player:AddAmmo( Ammo.kShells, 400 ) 
   player:AddAmmo( Ammo.kRockets, 400 ) 
   player:AddAmmo( Ammo.kCells, 400 ) 
end

-----------------------------------------------------------------------------
-- Spawn functions
-----------------------------------------------------------------------------
redspawn = { validspawn = redallowedmethod }
bluespawn = { validspawn = blueallowedmethod }
greenspawn = { validspawn = greenallowedmethod }
yellowspawn = { validspawn = yellowallowedmethod }

	
	SetPlayerLimit(Team.kBlue, 0)
	SetPlayerLimit(Team.kRed, 0)
	SetPlayerLimit(Team.kYellow, -1)
	SetPlayerLimit(Team.kGreen, -1)
	resupply_settings = {
	resupply_interval = 1, -- in seconds
	reload_clips = true,
	health = 0,
	armor = 0,
	grenades = 0, -- blue/green pipes
	shells = 0,
	nails = 0,
	rockets = 0,
	cells = 0,
	detpacks = 0,
	mancannons = 0,
	gren1 = 0,
	gren2 = 0
}

-- utility function to return a list of all players in the server
function resupply_getallplayers()
	local players = {}
	for index=1,22 do
		local player = GetPlayerByID(index)
		if (player ~= nil) then
			table.insert( players, player );
		end
	end
	return players
end

-- so we don't overwrite startup
local resupply_savedfuncs = {}
resupply_savedfuncs.startup = startup

function startup()
	-- check to make sure the saved function is actually a function
	if type(resupply_savedfuncs.startup) == "function" then
		-- call the saved function
		resupply_savedfuncs.startup()
	end
	
	-- start resupply schedule
	AddScheduleRepeating( "resupply_schedule", resupply_settings.resupply_interval, resupply_scheduled );
end

function resupply_scheduled()
	local players = resupply_getallplayers();
	for i,player in pairs(players) do
		resupply( player )
	end
end

function resupply( player )
	if IsPlayer( player ) then
		-- reload clips
		if resupply_settings.reload_clips == true then player:ReloadClips() end
	
		-- give player health and armor
		if resupply_settings.health ~= nil then player:AddHealth( self.health ) end
		if resupply_settings.armor ~= nil then player:AddArmor( self.armor ) end
	
		-- give player ammo
		if resupply_settings.nails ~= nil then player:AddAmmo(Ammo.kNails, self.nails) end
		if resupply_settings.shells ~= nil then player:AddAmmo(Ammo.kShells, self.shells) end
		if resupply_settings.rockets ~= nil then player:AddAmmo(Ammo.kRockets, self.rockets) end
		if resupply_settings.cells ~= nil then player:AddAmmo(Ammo.kCells, self.cells) end
		if resupply_settings.detpacks ~= nil then player:AddAmmo(Ammo.kDetpack, self.detpacks) end
		if resupply_settings.mancannons ~= nil then player:AddAmmo(Ammo.kManCannon, self.mancannons) end
		if resupply_settings.gren1 ~= nil then player:AddAmmo(Ammo.kGren1, self.gren1) end
		if resupply_settings.gren2 ~= nil then player:AddAmmo(Ammo.kGren2, self.gren2) end
	end
end

-- so we don't overwrite the function
local nodamage_savedfuncs = {}
nodamage_savedfuncs.player_ondamage = player_ondamage

function player_ondamage( player, damageinfo )

	-- check to make sure the saved function is actually a function
	if type(nodamage_savedfuncs.player_ondamage) == "function" then
		-- call the saved function
		nodamage_savedfuncs.player_ondamage( player, damageinfo )
	end

	-- if no damageinfo do nothing
	if not damageinfo then return end
	
	-- set damage to zero
	damageinfo:SetDamage(0)
	
end
FDA_Approved is offline   Reply With Quote


Old 08-20-2012, 08:04 AM   #84
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.
Here's a working version:



Changes I made:
- Removed team:SetClassLimit(Player.kSniper, SNIPER_LIMIT) lines in startup() as SNIPER_LIMIT wasn't defined and therefore broke things (error in console was [SCRIPT] Error calling startup (no overload of 'Team:SetClassLimit' matched the arguments (Team, number, nil) candidates are: Team:SetClassLimit(number, number))
- Fixed indenting because it bothered me
- Removed the four SetPlayerLimit() calls outside of startup because they shouldn't exist
- Included base_teamplay as its just a good idea in general unless you really know what you're doing
__________________
#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

Last edited by squeek.; 08-20-2012 at 08:04 AM.
squeek. is offline   Reply With Quote


Old 08-20-2012, 08:20 AM   #85
FDA_Approved
Beta Tester
 
FDA_Approved's Avatar
 
Join Date: Nov 2011
Gametype: Capture the Flag
Posts Rated Helpful 293 Times
Yes sir that worked. Thank you very much squeek.
FDA_Approved is offline   Reply With Quote


Old 08-20-2012, 08:24 AM   #86
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.
No problem.
__________________
#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 09-06-2012, 10:37 PM   #87
FDA_Approved
Beta Tester
 
FDA_Approved's Avatar
 
Join Date: Nov 2011
Gametype: Capture the Flag
Posts Rated Helpful 293 Times
Would it be possible for a lua to spawn a player with a diminishing buff that you usually get from the medic. And then when ever you get a kill, reload your clips and resup you to that buff?
FDA_Approved is offline   Reply With Quote


Old 09-07-2012, 12:36 AM   #88
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.
Not sure what you mean by "usually get from the medic," but it sounds possible.
__________________
#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 09-07-2012, 01:14 AM   #89
FDA_Approved
Beta Tester
 
FDA_Approved's Avatar
 
Join Date: Nov 2011
Gametype: Capture the Flag
Posts Rated Helpful 293 Times
Quote:
Originally Posted by squeek. View Post
Not sure what you mean by "usually get from the medic," but it sounds possible.
I'm talking about how the medic buffs you up to, what is it, 125%? And then it slowly diminishes.
FDA_Approved is offline   Reply With Quote


Old 09-07-2012, 01:33 AM   #90
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.
Not actually sure if Lua can give players health above 100%. If it doesn't, it'd be easy to add that functionality.
__________________
#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 09-07-2012, 08:56 AM   #91
Elmo
Gets tickled by FF
Fortress Forever Staff
 
Elmo's Avatar
 
Join Date: Jun 2007
Location: UK
Class/Position: Med Solly HW
Gametype: Any/CTF
Posts Rated Helpful 41 Times
Quote:
Originally Posted by FDA_Approved View Post
Would it be possible for a lua to spawn a player with a diminishing buff that you usually get from the medic. And then when ever you get a kill, reload your clips and resup you to that buff?
That'd work well for a king of the hill kinda scenario for those that are king
__________________
Support FF:
Done: ff_monkey
Done: ff_bases
Done: ff_warpath
Forever Doing: ff_medieval (beta#99999999)
Elmo is offline   Reply With Quote


Old 09-07-2012, 07:50 PM   #92
FDA_Approved
Beta Tester
 
FDA_Approved's Avatar
 
Join Date: Nov 2011
Gametype: Capture the Flag
Posts Rated Helpful 293 Times
Quote:
Originally Posted by Elmo View Post
That'd work well for a king of the hill kinda scenario for those that are king
Yeah it would. What I'm trying to do though is basicly make an mge mod map for FF. If you're unfamiliar, it's like mulch, but with terrain to jump around on. It's kind of half about dm half about height advantage/king of the hill type thing.

Seeing as how it's partly about manuvering the terrain, the buff helps take away some of the penalty of your first couple rocket jumps.

http://steamcommunity.com/sharedfile...s/?id=94592638

Plan is to to have multiple rooms like that for people to choose from.

And I'm gonna need help with the lua, because I'm dumb.
FDA_Approved is offline   Reply With Quote


Old 01-19-2013, 09:15 AM   #93
FDA_Approved
Beta Tester
 
FDA_Approved's Avatar
 
Join Date: Nov 2011
Gametype: Capture the Flag
Posts Rated Helpful 293 Times
Ok I'd like to request a lua if anyone is willing to help. It may be a little bit hefty. It comes down to three main things.

It's going to be a DM map with multiple arenas. So I'd like a lua that makes it so when you die in a certain area, you spawn in one of the spawn points in that area. Let me know what I need to do on the mapping end to acheive this. (naming spawn points, making a trigger, w/e is needed)

This next part is what we were talking about earlier in the thread. So if it's possible I'd like every time a player spawns, for them to spawn at 125% 150% health, what ever the medic buffs limit is. I want it to act exactly like the buff a medic can apply to his team. Spawn at the buff cap, and have it slowly diminish. The map features lots of terrain to fight for, on, around. This buff makes it much more viable to rocket jump on all this stuff.

And the last part is a resup/clip refill on kill. I'd like it so that any time a player kills someone, their clips are refilled, and health restored. I'd also like it so that it restores their health to the buff they spawned at. This keeps the pace going, and eliminates any need to take a break to go grab bags and reload.

So is this possible, and what do I need to do on the mapping end?
__________________
Currently equipped: Rad Scarf of liberating happiness.

Last edited by FDA_Approved; 01-19-2013 at 09:16 AM.
FDA_Approved is offline   Reply With Quote


Old 02-16-2013, 11:45 AM   #94
homie in reboks'
 
homie in reboks''s Avatar
 
Join Date: Jun 2011
Location: USA
Class/Position: Soldier & Medic
Affiliations: ( ir :: ) iv| K^ †
Posts Rated Helpful 80 Times
Hi.

I'm trying to remake 55 from TFC. There's two main things I need help with lua wise.

1. I need two sets of capture points. A normal one on the bats and a second set in a pit worth 20 points. I tried to use this from the FF wiki:
Code:
-- This is my first base trigger!
endzone = trigger_ff_script:new({
       points_per_score = 6,
       fortpoints_per_score = 100
       allowedmethod = redTeamOnly
})
--Access to events is typically in the following format:

function endzone:ontrigger( entity )
  --What to do when this method is called
  --return anything, if necessary
end
Modified to fit my needs, but I messed it up because when I added it to my lua it re-enabeld all 4 teams and wouldn't allow me to choose a class.

2. In 55, there are two yard vents on each base that use a trigger to push you into the opposite team's battlements. The yard vents work just fine, but I need them to differentiate between classes. As it stands, each class is pushed the same distance. I need heavier classes to be pushed at a decreased rate so as to be true to the TFC version and combat heavy Offense usage. Here's the vent part of the lua:
Code:
--------------------------------------------------------------------------
-- Yard Lift
--------------------------------------------------------------------------
base_angle_jump = trigger_ff_script:new( {pushz=0, pushx=0, pushy=0} )

function base_angle_jump:ontouch( trigger_entity )
	if IsPlayer(trigger_entity) then
		local player = CastToPlayer(trigger_entity)
		local playerVel = player:GetVelocity()
		if self.pushz ~= 0 then playerVel.z = self.pushz end
		if self.pushx ~= 0 then playerVel.x = self.pushx end
		if self.pushy ~= 0 then playerVel.y = self.pushy end
		player:SetVelocity( playerVel )
	end
end

yardvent_red = base_angle_jump:new( {pushz=760, pushx=-0, pushy=1800} )
yardvent_blue = base_angle_jump:new( {pushz=760, pushx=-0, pushy=-1800} )
fr_vent_red2 = base_angle_jump:new( {pushy=-1600} )
fr_vent_blue2 = base_angle_jump:new( {pushy=1600} )
yardvent_red & yardvent_blue are the two specific one's Im looking to modify.

I didn't even know where to begin with the lua here, but Squeek mentioned it was possible.

Also, I'm bad and dumb. So, I might have silly followup questions. Thanks in advanced.
__________________
homie in reboks' is offline   Reply With Quote


Old 02-16-2013, 12:36 PM   #95
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.
Code:
-- save all the functions in a table
-- so we don't accidentally overwrite any saved functions in other files
local saved_functions = {}

-- save the function in the table
saved_functions.basecap = {}
saved_functions.basecap.ontrigger = basecap.ontrigger

function basecap:ontrigger( trigger_entity )
	-- save last points per capture
	local last_points_per_cap = POINTS_PER_CAPTURE
	local last_fortpoints_per_cap = FORTPOINTS_PER_CAPTURE

	-- set points per capture to this cap points settings if they are defined
	if self.teampoints ~= nil then POINTS_PER_CAPTURE = self.teampoints end
	if self.fortpoints ~= nil then FORTPOINTS_PER_CAPTURE = self.fortpoints end
	
	if type(saved_functions.basecap.ontrigger) == "function" then
		-- call the saved function
		saved_functions.basecap.ontrigger( self, trigger_entity )
	end
	
	-- reset points per cap to what it was
	POINTS_PER_CAPTURE = last_points_per_cap
	FORTPOINTS_PER_CAPTURE = last_fortpoints_per_cap
end

-- cap points that give 20 points instead of 10
blue_cap_bonus = blue_cap:new({teampoints = 20, fortpoints = 2000})
red_cap_bonus = red_cap:new({teampoints = 20, fortpoints = 2000})
yellow_cap_bonus = yellow_cap:new({teampoints = 20, fortpoints = 2000})
green_cap_bonus = green_cap:new({teampoints = 20, fortpoints = 2000})

--------------------------------------------------------------------------
-- Yard Lift with push based on the triggering class's speed
-- Push is multiplied by the class's speed / 400 (scout speed) to the power of speedbias
-- Higher speedbias = slow classes get pushed a lot less and vice versa
--------------------------------------------------------------------------
base_angle_jump = trigger_ff_script:new( {pushz=0, pushx=0, pushy=0, speedbias=0} )

function base_angle_jump:ontouch( trigger_entity )
	if IsPlayer(trigger_entity) then
		local player = CastToPlayer(trigger_entity)
		local playerVel = player:GetVelocity()
		local speedRatio = (player:MaxSpeed() / 400) ^ self.speedbias;
		if self.pushz ~= 0 then playerVel.z = self.pushz * speedRatio end
		if self.pushx ~= 0 then playerVel.x = self.pushx * speedRatio end
		if self.pushy ~= 0 then playerVel.y = self.pushy * speedRatio end
		player:SetVelocity( playerVel )
	end
end

yardvent_red = base_angle_jump:new( {pushz=760, pushx=-0, pushy=1800, speedbias = 1} )
yardvent_blue = base_angle_jump:new( {pushz=760, pushx=-0, pushy=-1800, speedbias = 1} )
fr_vent_red2 = base_angle_jump:new( {pushy=-1600} )
fr_vent_blue2 = base_angle_jump:new( {pushy=1600} )
Totally untested. If you ever run into the 4 teams of death, open the console and look for [SCRIPT] errors. It usually tells you what broke.

The cap point stuff had to be done in a dumb way because the base Lua's were written in a dumb way. It wouldn't be hard to add proper support for points set per cap point. I'll edit base_teamplay for the next patch.
__________________
#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

Last edited by squeek.; 02-18-2013 at 02:17 AM.
squeek. is offline   Reply With Quote


1 members found this post helpful.
Old 02-16-2013, 06:22 PM   #96
homie in reboks'
 
homie in reboks''s Avatar
 
Join Date: Jun 2011
Location: USA
Class/Position: Soldier & Medic
Affiliations: ( ir :: ) iv| K^ †
Posts Rated Helpful 80 Times
Squeek, you never cease to amaze.
__________________
homie in reboks' is offline   Reply With Quote


Old 10-26-2013, 02:31 AM   #97
Jay Mofo Mills
Jay|mOfO|Mills
Beta Tester
 
Join Date: Feb 2009
Location: Santa Fe, NM
Gametype: Snag the flag beotches
Posts Rated Helpful 8 Times
Engy spanner func_button help?

I am trying to create a button that when ANY engineer hits it a certain number of times it creates a few outputs. Only needs to activate once. I borrowed ff_security_b1 code and tried to change it and also tried to just create what I needed.... I didnt receive lua errors but the func_button I named engy_spanner_button didnt fire... I didn't receive any console lua errors either. Please help this noob, maps almost done.

heres the code:
----------------------------
--first attempt modified slightly from ff_security_b1
----------------------------
NUM_HITS_TO_REPAIR = 10
FORT_POINTS_PER_REPAIR = 100

function gen_onrepair( team )
-- outputs, add any thing you want to happen when the generator is repaired here
-- teamstring is either "red" or "blue"
OutputEvent( "beam2", "TurnOn" )
OutputEvent( "tele_2_trigger", "Enable" )
BroadCastMessage("Beam 2 has been activated")
end

function gen_onclank( player )
-- add any thing you want to happen when the generator is hit by a wrench (while its detted) here
BroadCastMessage("whats going on here?")
end

generators = {
[Team.kUnassigned] = {
status=0,
repair_status=0
}
}


base_gen = func_button:new({ team = Team.kUnassigned })

function base_genndamage()
if IsPlayer( GetPlayerByID(info_attacker) ) then
local player = CastToPlayer( GetPlayerByID(info_attacker) )
if info_classname == "ff_weapon_spanner" then
generators[self.team].repair_status = generators[self.team].repair_status + 1
if generators[self.team].repair_status >= NUM_HITS_TO_REPAIR then
player:AddFortPoints( FORT_POINTS_PER_REPAIR, "Repairing the Crane" )
gen_onrepair( self.team )
generators[self.team].status = 0
else
gen_onclank( player )
end
end
end
end


----------------------------------------------------------
-- my attempt to create a engy spanner button
-----------------------------------------------------------
base_gen = func_button:new({ team = Team.kUnassigned })

function base_genndamage()
if IsPlayer( GetPlayerByID(info_attacker) ) then
local player = CastToPlayer( GetPlayerByID(info_attacker) )
if info_classname == "ff_weapon_spanner" then
generators.repair_status = generators.repair_status + 1
if generators.repair_status >= NUM_HITS_TO_REPAIR then
player:AddFortPoints( FORT_POINTS_PER_REPAIR, "Repairing the Crane" )
OutputEvent( "beam2", "TurnOn" )
OutputEvent( "tele_2_trigger", "Enable" )
BroadCastMessage("Beam 2 has been activated")
else
gen_onclank( player )
end
end
end
end


engy_spanner_button = base_gen:new({ team = Team.kUnassigned })
Jay Mofo Mills is offline   Reply With Quote


Old 10-26-2013, 03:45 AM   #98
Dexter
internet user
Fortress Forever Staff
 
Dexter's Avatar
 
Join Date: Jun 2007
Posts Rated Helpful 42 Times
try this for base_gen : ondamage (and generators)

Code:
generators = 
{
	status = 0,
	repair_status = 0
}	

function base_gen:ondamage()
	if info_classname == "ff_weapon_spanner" then
		generators.repair_status = generators.repair_status + 1
		if generators.repair_status >= NUM_HITS_TO_REPAIR then
			local player = CastToPlayer( GetPlayerByID(info_attacker) )
			player:AddFortPoints( FORT_POINTS_PER_REPAIR, "Repairing the Crane" )
			OutputEvent( "beam2", "TurnOn" )
			OutputEvent( "tele_2_trigger", "Enable" )
			BroadCastMessage("Beam 2 has been activated")
			generators.repair_status = 0
		else 
			gen_onclank( player )
		end
	end

	return true
end
__________________
9:17 PM - DEXTER: can you teach me how to play o
9:17 PM - squeek.: you jump a lot
9:18 PM - squeek.: and do sweet moves

8:55 PM - FDA: fart in you fridge and blame it on wild animals
Dexter is offline   Reply With Quote


Old 10-27-2013, 03:25 AM   #99
Jay Mofo Mills
Jay|mOfO|Mills
Beta Tester
 
Join Date: Feb 2009
Location: Santa Fe, NM
Gametype: Snag the flag beotches
Posts Rated Helpful 8 Times
ok so Dexter's code from above works, but if I have this code in the lua as well the func_button named engy_spanner_button and gen_onclank doesn't work. Everything else in my lua is fine, I tested it, but this code here makes the func_button not operate when both are in the same lua.....

Code:
FORT_POINTS_PER_DET = 100

detpack_trigger = trigger_ff_script:new({})
function detpack_trigger:onexplode( trigger_entity )
	if IsDetpack( trigger_entity ) then
		detpack = CastToDetpack( trigger_entity )
		if IsPlayer( detpack:GetOwner() ) then
		local player = detpack:GetOwner()
			--if player:GetTeamId() ~= self.team then
			BroadCastMessage("Beam 1 has been activated")
			OutputEvent("beam1", "TurnOn")
			OutputEvent("wrecking_ball_trigger", "Enable")
			OutputEvent("beam_sound", "PlaySound")
			player:AddFortPoints( FORT_POINTS_PER_DET, "Detting the generator" )
			end
		end
	return EVENT_ALLOWED
end
-- Don't want any body touching/triggering it except the detpack
function trigger_detpackable_door:allowed( trigger_entity ) return EVENT_DISALLOWED 
end

Last edited by Dexter; 10-27-2013 at 04:40 AM.
Jay Mofo Mills is offline   Reply With Quote


Old 10-27-2013, 04:41 AM   #100
Dexter
internet user
Fortress Forever Staff
 
Dexter's Avatar
 
Join Date: Jun 2007
Posts Rated Helpful 42 Times
i stuck your code in code tags so the smileys stop messing it up, taking a look now
__________________
9:17 PM - DEXTER: can you teach me how to play o
9:17 PM - squeek.: you jump a lot
9:18 PM - squeek.: and do sweet moves

8:55 PM - FDA: fart in you fridge and blame it on wild animals
Dexter 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 01:36 PM.


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