Fortress Forever

Fortress Forever (https://forums.fortress-forever.com/index.php)
-   Mapping (https://forums.fortress-forever.com/forumdisplay.php?f=13)
-   -   destroy to win?? (https://forums.fortress-forever.com/showthread.php?t=19980)

mentalERROR 06-27-2009 05:02 AM

destroy to win??
 
How to make it where once 1 of 2 objects is destroyed by 1 team against another team determines winner? ex blue destroys reds wall so blue wins a round and map resets without losing score. Thx

Bridget 06-27-2009 07:03 AM

I'm presuming you mean like a detpack wall. There's some lua in the ff_bases (by Squeek?) for the generator at flag location that can be destroyed for points. Here it is edited a bit.

Code:

game_ended = false

function restart_round()
        game_ended = false
        RespawnAllPlayers()
        ResetMap()
end

fr_computer = trigger_ff_script:new({ team = Team.kUnassigned, enemy_team = Team.kUnassigned })

function fr_computer:onexplode( explosion_entity )
        if IsDetpack( explosion_entity ) then
                if game_ended == false then
                        local detpack = CastToDetpack(explosion_entity)

                        if detpack:GetTeamId() == self.team then return EVENT_ALLOWED end

                        local points = 5
                        local team = detpack:GetTeam()
                        team:AddScore(points)

                        local player = detpack:GetOwner()
                        player:AddFortPoints(points * 100, "Destroyed Mainframe" )

                        SmartMessage(player, "You destroyed the enemy mainframe!", "Your team

destroyed the enemy mainframe!", "Your mainframe has been destroyed!")
                        game_ended = true
                        AddSchedule( "restart_round", 5, restart_round )
                end
        end

        return EVENT_ALLOWED
end

blue_computer = fr_computer:new({ team = Team.kBlue, enemy_team = Team.kRed })
red_computer = fr_computer:new({ team = Team.kRed, enemy_team = Team.kBlue })

This is it, edited. I'm not sure how good of a job I did editing it. Essentially, once the detpack area is destroyed (trigger brush named "x_computer", x is color) it sets game_ended to true, which prevents any more detpacks from affecting the same trigger or your team's trigger. Then, after five seconds, the map is renewed and players respawned. You can edit it further from here. You can use outputs to make the ground shake with an env_shake, force sounds to play, or make func_breakables break. I hope it works properly (My test worked fine. But, try it with multiple people.) :s

GeoKill-----> 06-27-2009 05:18 PM

We need more details on what you mean by destroy... Can anyone class damaged it? detpack only? etc..

mentalERROR 06-27-2009 10:24 PM

Ok so open map dm style with objects in map that 1 team has to destroy other teams objects to win.

Dr.Satan 06-27-2009 10:25 PM

lmao...I am mapping something almost exactly like that right now.

mentalERROR 06-28-2009 01:12 AM

Well I added that script to the lua and when I load map it will not let me pick a class once I choose team. hrmmmm

squeek. 06-28-2009 01:13 AM

Quote:

Originally Posted by mentalERROR (Post 441875)
Ok so open map dm style with objects in map that 1 team has to destroy other teams objects to win.

Destroy with what? "Destroy" is the most ambiguous term you could possibly use in this situation.

mentalERROR 06-28-2009 01:17 AM

:D satan!! COPYCAT!!! jk What sort of lua scripting are you using?

mentalERROR 06-28-2009 01:21 AM

Quote:

Originally Posted by squeek. (Post 441886)
Destroy with what? "Destroy" is the most ambiguous term you could possibly use in this situation.

Each team having 1 big couch that other team uses rockets, nades, shottys etc to "break" it hence destroying it :P using func_breakable

GeoKill-----> 06-28-2009 01:22 AM

fuck yo couch?

squeek. 06-28-2009 01:29 AM

Quote:

Originally Posted by mentalERROR (Post 441890)
Each team having 1 big couch that other team uses rockets, nades, shottys etc to "break" it hence destroying it :P using func_breakable

Then Bridget's code isn't what you want. You'll either have to wait for 2.4 so you can use a func_breakable and :onbreak() lua, or use a func_button and something like this (this is from a beta version of an AvD "damage to win" type map)

NOTE: The following code will NOT be functional without huge amounts of rewriting or additional code. In short, what you want to do is not trivial by any means, but will become easier once 2.4 is out and :onbreak() is working.

Code:

base_target = func_button:new({})

function base_target:ondamage()
        if gates_open then
                if IsPlayer( GetPlayerByID(info_attacker) ) then
                        local player = CastToPlayer( GetPlayerByID(info_attacker) )
                        if player:GetTeamId() == attackers then
                                local scaled_damage = info_damage / DAMAGE_POINTS_SCALE
                                local damage_points = info_damage
                                local team = GetTeam( attackers )
                                local scaled_damage = 0
                                local playerid = player:GetId()
                               
                                if info_classname == "ff_projectile_nail" then
                                        playerDamageTable[playerid].nail = playerDamageTable[playerid].nail + 1
                                        if playerDamageTable[playerid].nail >= POINT_EVERY_X_HITS_NAIL then
                                                ConsoleToAll( "[script] nail point" )
                                                scaled_damage = 1
                                                damage_points = damage_points * POINT_EVERY_X_HITS_NAIL
                                                playerDamageTable[playerid].nail = 0
                                                target_damage_outputs()
                                        end
                                elseif info_classname == "ff_weapon_assaultcannon" then
                                        playerDamageTable[playerid].ac = playerDamageTable[playerid].ac + 1
                                        if playerDamageTable[playerid].ac >= POINT_EVERY_X_HITS_ASSAULTCANNON then
                                                ConsoleToAll( "[script] ac point" )
                                                scaled_damage = 1
                                                damage_points = damage_points * POINT_EVERY_X_HITS_ASSAULTCANNON
                                                playerDamageTable[playerid].ac = 0
                                                target_damage_outputs()
                                        end
                                else
                                        -- round to the nearest whole number
                                        scaled_damage = math.floor(( info_damage / DAMAGE_POINTS_SCALE ) + .5)
                                        target_damage_outputs()
                                end
                               
                                if scaled_damage > 0 then
                                        team:AddScore( scaled_damage )
                                        player:AddFortPoints( damage_points, "Damaging the Target" )
                                       
                                        RemoveSchedule( "shutout" )
                                        RemoveSchedule( "timer_schedule" )
                                        RemoveSchedule( "defenders_period_scoring" )
                                        RemoveSchedule( "init_defenders_period_scoring" )
                                        RemoveSchedule( "init_defenders_countdown" )
                                       
                                        target_status = true
                                        update_hud_text()
                                        update_target_status()
                                       
                                        AddSchedule( "init_defenders_countdown", DAMAGE_RESET_TIME, init_defender_countdown )
                                       
                                        playerDamageTable[playerid].points = playerDamageTable[playerid].points + scaled_damage
                                end
                        end
                end
        end
end


Dr.Satan 06-28-2009 02:51 AM

Quote:

Originally Posted by mentalERROR (Post 441888)
:D satan!! COPYCAT!!! jk What sort of lua scripting are you using?

lmao...I was planning on recruiting squeek or pon to make me one once I had a decent working map to test shit on. But I have a few ideas for what might work.

Crazycarl 06-28-2009 09:50 PM

Here, I just put func_button + lua documentation up on the wiki(squeek look at this stuff I'm putting up and make sure it's correct/complete):
http://www.fortress-forever.com/wiki...ua:func_button

squeek. 06-28-2009 11:31 PM

Quote:

Originally Posted by Crazycarl (Post 441943)
Here, I just put func_button + lua documentation up on the wiki(squeek look at this stuff I'm putting up and make sure it's correct/complete):
http://www.fortress-forever.com/wiki...ua:func_button

Added some corrections and altered the example lua.

Dr.Satan 07-10-2009 09:17 PM

so essentially as it stands now, there is no way to check HOW MUCH damage a button receives. There is only a way to check IF a button takes damage...:cry:

squeek. 07-11-2009 01:48 AM

Quote:

Originally Posted by Dr.Satan (Post 443090)
so essentially as it stands now, there is no way to check HOW MUCH damage a button receives. There is only a way to check IF a button takes damage...:cry:

No, info_damage is the numerical amount of damage the func_button takes.

Dr.Satan 07-11-2009 03:20 AM

Quote:

Originally Posted by squeek. (Post 443114)
No, info_damage is the numerical amount of damage the func_button takes.

yeah I know...idk what the hell I did to make my .lua not work, but I messed it up good!

Edit: actually carl might have found it for me...of to test!\
Edit2: yeah it works I was calling a :Collection() when I should have just been using an integer!


All times are GMT. The time now is 10:44 PM.

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