Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 08-16-2009, 08:07 PM   #1
zE
Pew pew ze beams
 
zE's Avatar
 
Join Date: Jan 2008
Gametype: Gathers
Affiliations: pew pew
Posts Rated Helpful 11 Times
Lua ffix

Some time ago squeek did this for me for a mitair dm map (ff_psyz), but now im redoing it, and i want to fix the lua also.
So basicly the only problem i have with is that it doesnt counts with suicides. I want it to score with a frag , and remove a point with a suicide : )

end

function player_onkill( player )
-- Test, Don't let blue team suicide.
-- if player:GetTeamId() == Team.kBlue then
-- return false
-- end
return true
end

-- Get team points for killing a player
function player_killed( player_entity, damageinfo )
-- suicides have no damageinfo
if damageinfo ~= nil then
local killer = damageinfo:GetAttacker()

local player = CastToPlayer( player_entity )
if IsPlayer(killer) then
killer = CastToPlayer(killer)
--local victim = GetPlayer(player_id)

if not (player:GetTeamId() == killer:GetTeamId()) then
local killersTeam = killer:GetTeam()
killersTeam:AddScore(1)
end
end
end
end
zE is offline   Reply With Quote


Old 08-18-2009, 03:57 PM   #2
Sidd
Lua Team
 
Join Date: Mar 2007
Posts Rated Helpful 1 Times
Haven't tested, but I think you want something like this:
Code:
-- Get team points for killing a player
function player_killed( player_entity, damageinfo )
    local player = CastToPlayer( player_entity )
-- suicides have no damageinfo
    if damageinfo ~= nil then
        local killer = damageinfo:GetAttacker()
        if IsPlayer(killer) then
            killer = CastToPlayer(killer)
            if not (player:GetTeamId() == killer:GetTeamId()) then
                local killersTeam = killer:GetTeam()
                killersTeam:AddScore(1)
            end
        end
    else  -- must be a suicide as damageinfo == nil
        local playerTeam = player:GetTeam()
        playerTeam:AddScore(-1)
    end
end
Sidd is offline   Reply With Quote


Old 08-18-2009, 11:16 PM   #3
zE
Pew pew ze beams
 
zE's Avatar
 
Join Date: Jan 2008
Gametype: Gathers
Affiliations: pew pew
Posts Rated Helpful 11 Times
ty : D

but i suicide my self 3 times, and in the top screen score still is as 0 : \

Last edited by zE; 08-18-2009 at 11:29 PM.
zE is offline   Reply With Quote


Old 08-19-2009, 12:09 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.
I'm not sure you can add negative score to teams. And I'm not sure that team scores can go below 0.
__________________
#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 08-28-2009, 01:56 AM   #5
zE
Pew pew ze beams
 
zE's Avatar
 
Join Date: Jan 2008
Gametype: Gathers
Affiliations: pew pew
Posts Rated Helpful 11 Times
k np then : ) can someone do me a basic lua where u have red and blue team with soldier demo and medic classes avaible, and yellow team named spectator with only civilian class avaible, and no grenades.

when i try to tweak my previous lua, and just erase the score part from it, respaw spots go crazy, i respaw in the wrong places :\
zE is offline   Reply With Quote


Old 09-14-2009, 05:35 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
http://dctrs8tn.privatepaste.com/db10mBdwGq

sry it took so long for somebody to help you!
__________________
(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


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 12:23 AM.


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