09-25-2007, 02:59 PM | #1 |
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!
|
|
09-25-2007, 03:32 PM | #2 |
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. |
|
09-25-2007, 04:26 PM | #3 |
Retired FF Staff
|
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) 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 Code:
if quadPlayer:GetId() == playerAttacker:GetId() then
__________________
Head of the Orca Revolution (TM) |
|
09-25-2007, 05:20 PM | #4 |
Nutcracker
|
damageInfo:SetDamage() isn't working at the moment though, hopefully fixed in the next patch?
|
|
09-25-2007, 10:19 PM | #5 |
Retired FF Staff
|
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) |
|
09-26-2007, 10:53 AM | #6 | |
Nutcracker
|
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 Quote:
Why did you make a new thread about this? Last edited by A1win; 09-26-2007 at 08:38 PM. |
|
|
09-27-2007, 06:12 AM | #7 |
Retired FF Staff
|
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 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. |
|
09-27-2007, 06:58 AM | #8 |
Retired FF Staff
|
This will be fixed in the next version.
__________________
Head of the Orca Revolution (TM) |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|