Fortress Forever

Go Back   Fortress Forever > Editing > Mapping

Reply
 
Thread Tools Display Modes
Old 09-25-2007, 02:59 PM   #1
Adam-g1
 
Join Date: Sep 2007
Posts Rated Helpful 0 Times
Quad/Invinc ever comming out?

Sorry.. I know these both are bugged, don't work, or we cant figure them out yet, but I'm itching to make some quad rocketing / quad pipe maps. Is this going to be added / fixed in the next patch? Thanks!
Adam-g1 is offline   Reply With Quote


Old 09-25-2007, 03:32 PM   #2
shock
 
Join Date: May 2007
Posts Rated Helpful 0 Times
Have you tried a trigger_hurt with negative amounts triggered by a trigger_multiple (ontouch) ?

I know its just a workaround but better than nothing i guess.
shock is offline   Reply With Quote


Old 09-25-2007, 04:26 PM   #3
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
There are some callbacks that get run on the Lua side when a player takes damage where you can modify the damage and such given out.

In the base_soldierarena.lua you can see "player_ondamage" which takes a player object [ie. CFFPlayer *] and a "damageinfo" object [ie. CTakeDamageInfo].

From the "damageinfo" you can adjust the damage value, see who the attacker is, see who the inflictor is, etc. Note: some of these values might be null sometimes so you need to make sure you check conditions like that.

Anyway, if you marked a player as having quad somehow - like giving them some kind of item - in the player_ondamage you could see if the attacker is this player based on if they had the item then do something like:

Code:
damageInfo:SetDamage(damageInfo:GetDamage() * 4)
to scale the damage up 4x.

As for the item part of it just treat the quad model part of it like a CTF flag - perhaps something like this [untested code]:

Code:
function player_ondamage(player, damageinfo)

	-- Entity that is attacking
	local attacker = damageInfo:GetAttacker()

	-- If no attacker do nothing
	if not attacker then return end

	-- If attacker not a player do nothing
	if not IsPlayer(attacker) then return end
	
	-- Get the attacker as a player [ie. CFFPlayer *]
	local playerAttacker = CastToPlayer(attacker)

	-- Find the quad entity (this is an expensive call - storing a reference to the actual quad object somewhere would be tons better)
	local quadEntity = GetEntityByName("red_quad")

	-- If "red_quad" couldn't be found do nothing
	if not quadEntity then return end

	-- If the quad isn't carried (ie. a player doesn't have it) then do nothing
	if not quad:IsCarried() then return end

	-- Find out who is carrying the quad
	local quadCarrier = quad:GetCarrier()

	-- If something bad happened do nothing
	if not quadCarrier then return end

	-- Cast the quad carrier as a player
	-- NOTE: We could have already known this if we grabbed a reference to this when the quad was touched/taken (but be sure to watch when its dropped as well!) [ie. have a trigger_ff_script that when touched gives the player touching it the quad - right there we should store a reference to the player and then all this other crap ^^ isn't needed]
	local quadPlayer = CastToPlayer(quadCarrier)

	if quadPlayer == playerAttacker then
		damageInfo:SetDamage(damageInfo:GetDamage() * 4)
	end
end
So that might work... but I'm not sure if the "quadPlayer == playerAttacker " comparison will actually do what we want it to do. If it doesn't then you can compare the players' entindex's through "GetId()" so like:

Code:
if quadPlayer:GetId() == playerAttacker:GetId() then
__________________
Head of the Orca Revolution (TM)
Mulchman MM is offline   Reply With Quote


Old 09-25-2007, 05:20 PM   #4
A1win
Nutcracker
 
A1win's Avatar
 
Join Date: Sep 2007
Location: Kuopio, Finland
Posts Rated Helpful 0 Times
Send a message via MSN to A1win
damageInfo:SetDamage() isn't working at the moment though, hopefully fixed in the next patch?
A1win is offline   Reply With Quote


Old 09-25-2007, 10:19 PM   #5
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
Are you sure or is there a typo somewhere that's choking the script? I can't remember if "Warning()"'s get compiled out of release builds but if they don't then on a local server you should see red text in the console saying if shit failed in Lua.
__________________
Head of the Orca Revolution (TM)
Mulchman MM is offline   Reply With Quote


Old 09-26-2007, 10:53 AM   #6
A1win
Nutcracker
 
A1win's Avatar
 
Join Date: Sep 2007
Location: Kuopio, Finland
Posts Rated Helpful 0 Times
Send a message via MSN to A1win
After fixing all the typos and problems in the script and editing it to fit what I need, it looks like this:

Code:
function player_ondamage( player, damageInfo )

	-- Entity that is attacking
	local attacker = damageInfo:GetAttacker()

	-- If no attacker do nothing
	if not attacker then return end

	-- If attacker not a player do nothing
	if not IsPlayer(attacker) then return end
	
	-- Get the attacker as a player [ie. CFFPlayer *]
	local playerAttacker = CastToPlayer(attacker)

	if not playerAttacker:HasItem("flag") then return end

	damageInfo:SetDamage(damageInfo:GetDamage() * 4)

end
It works until the SetDamage function, which gives me this in console:
Quote:
[SCRIPT] Error calling player_ondamage (no overload of 'Damage:SetDamage' matched the arguments (const Damage, number)
candidates are:
Damage:SetDamage(custom [float])
) ent: NULL
Oh btw: http://www.fortress-forever.com/foru...ad.php?t=10791
Why did you make a new thread about this?

Last edited by A1win; 09-26-2007 at 08:38 PM.
A1win is offline   Reply With Quote


Old 09-27-2007, 06:12 AM   #7
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
I just modified ff_dm's player_ondamage and everything is working for me.

Code:
function player_ondamage( player_entity, damageinfo )

	if not player_entity then return end
	if not damageinfo then return end

	local attackerPlayer = CastToPlayer(damageinfo:GetAttacker())
	if not attackerPlayer then return end

	local weapon = damageinfo:GetInflictor():GetClassName()
	local player = CastToPlayer(player_entity)

	if ( player:GetId() == attackerPlayer:GetId() ) then
		
		if ( weapon == "ff_projectile_rocket" ) then
			damageinfo:SetDamage(damageinfo:GetDamage() * 4);
		-- green pipes
		elseif ( weapon == "ff_projectile_pl" ) then
			damageinfo:SetDamage(0);
		-- blue pipes
		elseif ( weapon == "ff_projectile_gl" ) then
			damageinfo:SetDamage(0);
		end
	end
end
This allows self shot rockets to do 4x damage to yourself and then self shot green/blue pipes won't do any damage to yourself. The only difference I see are the semi-colons which shouldn't matter (it's just a habit from C/C++ to automatically put one at the end of certain lines).

I'm testing on debug code though, about to try it on what you guys got.

EDIT: Hrm, so it works on a debug build but not a release build.
__________________
Head of the Orca Revolution (TM)

Last edited by Mulchman MM; 09-27-2007 at 06:26 AM.
Mulchman MM is offline   Reply With Quote


Old 09-27-2007, 06:58 AM   #8
Mulchman MM
Retired FF Staff
 
Mulchman MM's Avatar
 
Join Date: Dec 2004
Location: Lacey, WA
Posts Rated Helpful 0 Times
Send a message via ICQ to Mulchman MM Send a message via AIM to Mulchman MM Send a message via MSN to Mulchman MM Send a message via Yahoo to Mulchman MM Send a message via Skype™ to Mulchman MM
This will be fixed in the next version.
__________________
Head of the Orca Revolution (TM)
Mulchman MM 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 09:05 PM.


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