Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 09-02-2008, 01:40 PM   #1
zE
Pew pew ze beams
 
zE's Avatar
 
Join Date: Jan 2008
Gametype: Gathers
Affiliations: pew pew
Posts Rated Helpful 11 Times
Score via lua

Some time ago, squeek did this for ff_bounce lua --------------------
--points
--------------------

function player_killed( player, damageinfo )
local attacker = damageinfo:GetAttacker()
if IsPlayer( attacker ) then
local team = attacker:GetTeam()
team:AddScore( 1 )

end
end

The idea was to give one point per frag to the team and it works fine.

My problem now is that i used that code also in my dm map ff_psyz and what happens is that the team score board and your own scoreboard does not match now.. because that lua dont take suicides in consideration so it doesn't take u one less point : )

plz reply the lua line that takes one frag per suicide. ty : )
zE is offline   Reply With Quote


Old 09-02-2008, 07:07 PM   #2
Hawk Eye
Who the fuck is this guy?
D&A Member
Beta Tester
 
Hawk Eye's Avatar
 
Join Date: Mar 2007
Class/Position: O Preferred
Gametype: AvD
Affiliations: [AE] Asseaters
Posts Rated Helpful 2 Times
Quote:
function player_killed( player_id )
-- If you kill yourself, lose a point
local killer = GetPlayer(killer)
local victim = GetPlayer(player_id)

if (victim:GetTeamId() == killer:GetTeamId()) then
local victimsTeam = victim:GetTeam()
victimsTeam:AddScore(-1)
end
end
Dunno if that would work... it should.. maybe.
Hawk Eye is offline   Reply With Quote


Old 09-03-2008, 02:51 AM   #3
zE
Pew pew ze beams
 
zE's Avatar
 
Join Date: Jan 2008
Gametype: Gathers
Affiliations: pew pew
Posts Rated Helpful 11 Times
hm i ve tryed it and i think its not working, went to a map suicide myself and the score board dint change to -1/-2 etc.

Maybe was my problem copy pasting that code into the lua, cuse im not sure if i did it right, can u paste the part that i had together with the part u did .. cuse im not sure if to copy paste if before the end/end or after : P ty
zE is offline   Reply With Quote


Old 09-03-2008, 04:24 AM   #4
Jester
Fortress Forever Staff
 
Jester's Avatar
 
Join Date: Sep 2007
Class/Position: O: Scout
Affiliations: {NFO} - New Family Order
Posts Rated Helpful 0 Times
Code:
--------------------
--points
--------------------

function player_killed( player, damageinfo )
	local attacker = damageinfo:GetAttacker()
	if IsPlayer( attacker ) then
		if attacker:GetTeam() == player:GetTeam() then
			local team = player:GetTeam()
			team:AddScore( -1 )
		end
		if attacker:GetTeam() ~= player:GetTeam() then
			local team = attacker:GetTeam()
			team:AddScore( 1 )
		end
	end
end
I don't know if you could just do if attacker == player, so try what I put above.
Jester is offline   Reply With Quote


Reply


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

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 04:41 AM.


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