09-14-2011, 06:31 AM | #1 |
Jay|mOfO|Mills
Beta Tester
Join Date: Feb 2009
Location: Santa Fe, NM
Gametype: Snag the flag beotches Posts Rated Helpful 8 Times
|
Gonna need lots of lua help
I have a new map I'm working on ff_castle_island. It's going to be objective based with command points and flag captures....... Ideally. MY problem atm is this, I borrowed and modified code from ff_dropdown.
So far I can get the generator up and running, the light bridge working etc. I would like it so that a Red team members detpack destroys the generator again so the doorhack closes and needs repaired again. Here is the modified borrowed code I'm using. Note I changed the 1 and 0 for a few functions bluefire/bluegenup in certain places attempting to get it to work. Any help would be great. ---------------------------------------------------------------------------- Ideally this destroys the generator when it's running -------------------------------------------------------------------------- blue_gen_trigger = trigger_ff_script:new({ team = Team.kBlue }) bluefire = 0 function blue_gen_triggernexplode( trigger_entity ) if IsDetpack( trigger_entity ) then local detpacka = CastToDetpack( trigger_entity ) if detpacka:GetTeamId() == defenders then if bluegenup == 1 then if bluefire == 1 then OutputEvent( "blue_doorhack", "Close" ) BroadCastMessage("Generator Destroyed - Light Bridge Deactivated!") bluefire = 0 bluegenup = 0 end end end end return EVENT_ALLOWED end function blue_gen_trigger:allowed( trigger_entity ) return EVENT_DISALLOWED end -------------------------------------------------------------------------- -- This basically says if you're in the trigger brush w/a spanner then bluescannerclang==1 -------------------------------------------------------------------------- blue_gen_repair_trigger = func_button:new({ team = Team.kBlue }) blue_gen_repair_trigger_script = trigger_ff_script:new() bluespannerclang = 0 bluegenup = 0 blueclangcntr = 0 function blue_gen_repair_trigger_scriptntouch( touch_entity ) if IsPlayer( touch_entity ) then local player = CastToPlayer( touch_entity ) if player:GetActiveWeaponName() == "ff_weapon_spanner" then bluespannerclang = 1 DisplayMessage( player, "You are repairing the Light Bridge" ) end end end function blue_gen_repair_trigger_scriptnendtouch() bluespannerclang = 0 end ----------------------------------------------------------------------------- -- This basically says if bluescannerclang==1 aand the generator is down you can fix it -- What does bluefire do? ----------------------------------------------------------------------------- function blue_gen_repair_triggerndamage() if bluespannerclang == 1 then if bluegenup == 0 then if bluefire == 0 then OutputEvent( "bluespannerhit", "PlaySound" ) blueclangcntr = blueclangcntr + 1 if blueclangcntr == 10 then BroadCastMessage("The Generator is halfway fixed") end if blueclangcntr > 20 then blueclangcntr = 0 BroadCastMessage("The generator is fixed. Light Bridge Activated!") OpenDoor("blue_doorhack") bluespannerclang = 0 bluegenup = 1 bluefire = 1 end end end end return EVENT_DISALLOWED end |
|
09-14-2011, 04:38 PM | #2 |
NeoNL
Wiki Team
Beta Tester Join Date: Oct 2008
Location: Boston, Mass
Class/Position: Soldier, Medic Gametype: AvD Affiliations: +M|M+ -RS Posts Rated Helpful 170 Times
|
Try looking up the ff_security_b1 lua and map. I believe that is about what you need. The map remaker was Exo (Churchmoth) ask him if you need any help I presume.
__________________
|
|
09-14-2011, 06:24 PM | #3 |
Jay|mOfO|Mills
Beta Tester
Join Date: Feb 2009
Location: Santa Fe, NM
Gametype: Snag the flag beotches Posts Rated Helpful 8 Times
|
I'll try that lua thanks. Exo said he didnt know much lua
|
|
09-15-2011, 05:57 AM | #4 |
Jay|mOfO|Mills
Beta Tester
Join Date: Feb 2009
Location: Santa Fe, NM
Gametype: Snag the flag beotches Posts Rated Helpful 8 Times
|
So I tried usind the lua from security. Most of it works. Problem is the red detpacks dont actually destroy the generator and OUTPUT closing the blue_doorhack......
here is lua. I need help NUM_HITS_TO_REPAIR = 20 FORT_POINTS_PER_DET = 30 FORT_POINTS_PER_REPAIR = 30 function gen_ondet( team ) local teamstring = "blue" if team == Team.kRed then teamstring = "red" end BroadCastMessage("#FF_"..string.upper(teamstring). ."_GENBLOWN") -- outputs, add any thing you want to happen when the generator is detted here -- teamstring is either "red" or "blue" OutputEvent( "blue_doorhack", "Close" ) BroadCastMessage ("The generator is destroyed, blue engies repair it!") end function gen_onrepair( team ) local teamstring = "blue" if team == Team.kRed then teamstring = "red" end BroadCastMessage("#FF_"..string.upper(teamstring). ."_GEN_OK") -- outputs, add any thing you want to happen when the generator is repaired here -- teamstring is either "red" or "blue" OutputEvent( "blue_doorhack", "Open") BroadCastMessage("The generator is fixed. Light Bridge 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 OutputEvent( "bluespannerhit", "PlaySound" ) end generators = { [Team.kBlue] = { -- I made this one and the generators now get activated but det doesn't work status=1, repair_status=0 }, [Team.kRed] = { status=0, repair_status=0 } } base_gen_trigger = trigger_ff_script:new({ team = Team.kUnassigned }) function base_gen_triggernexplode( trigger_entity ) if generators[self.team].status == 0 then if IsDetpack( trigger_entity ) then detpack = CastToDetpack( trigger_entity ) if IsPlayer( detpack:GetOwner() ) then local player = detpack:GetOwner() --if player:GetTeamId() ~= self.team then if player:GetTeamId() == Team.kRed then player:AddFortPoints( FORT_POINTS_PER_DET, "Detting the generator" ) gen_ondet( self.team ) generators[self.team].status = 1 generators[self.team].repair_status = 0 end end end end return EVENT_ALLOWED end function base_gen_trigger:allowed( trigger_entity ) if IsPlayer( trigger_entity ) then return EVENT_ALLOWED end return EVENT_DISALLOWED end function base_gen_triggerntouch( trigger_entity ) if IsPlayer( trigger_entity ) then local player = CastToPlayer( trigger_entity ) if player:GetTeamId() ~= self.team then if generators[self.team].status == 0 then BroadCastMessageToPlayer( player, "You can detonate this generator using a detpack" ) end else if generators[self.team].status == 1 then BroadCastMessageToPlayer( player, "You can repair this generator by hitting it with a wrench" ) end end end end blue_gen_trigger = base_gen_trigger:new({ team = Team.kBlue }) red_gen_trigger = base_gen_trigger:new({ team = Team.kRed }) base_gen = func_button:new({ team = Team.kUnassigned }) function base_genndamage() if generators[self.team].status == 1 then if IsPlayer( GetPlayerByID(info_attacker) ) then local player = CastToPlayer( GetPlayerByID(info_attacker) ) if player:GetTeamId() == self.team then if info_classname == "ff_weapon_spanner" then generators[self.team].repair_status = generators[self.team].repair_status + 1 if generators[self.team].repair_status == 10 then BroadCastMessage("The Generator is halfway fixed") end if generators[self.team].repair_status >= NUM_HITS_TO_REPAIR then player:AddFortPoints( FORT_POINTS_PER_REPAIR, "Repairing the generator" ) gen_onrepair( self.team ) generators[self.team].status = 0 else gen_onclank( player ) end end end end end end blue_gen = base_gen:new({ team = Team.kBlue }) red_gen = base_gen:new({ team = Team.kRed }) |
|
09-16-2011, 02:23 PM | #5 |
crystaLcity
D&A Member
Beta Tester Join Date: May 2009
Location: Pittsburgh, PA
Class/Position: Soldier D Gametype: Capture the Flag Affiliations: Goodfellas Posts Rated Helpful 7 Times
|
psshh!! piece of cake. Ask squeek for help. He's never let me down before with lua help..
__________________
83745 L0LZ ff_nyx_b2 ff_schrape_b3 ff_security_b1 ff_baked_b2 ff_reloaded_b1 ff_mulch_dm_b2 ff_oppose_b1 |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|