02-18-2008, 09:07 AM | #1 |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
quad and invul
After an evening of disturbing the peace of the players with various painful lua experiments Turbowolf ended up asking about quad in the IRC channel.
As I've seen so many threads about it and way smarter people than me have rubbed their grey brain cells to solve it, I thought, naah, this can't be done. But squeek was very helpful and he helped us put together the following simple function: Code:
function player_ondamage( player, damageinfo ) if player:GetClass() ~= Player.kSoldier then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) end if player:GetClass() ~= Player.kDemoman then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) end end I just added an IncludeScript("base_quad"); to the exisiting conc luas I already got for the concmaps. We tested to play with it for a couple of hours and we all agree that * 4 damage is very close to TFC. Its much easier to rocket and pipe jump in FF with this than in TFC. If you want to test it quad and invul is added to conc_oneeyed_b2, conc_adam and conc_adam2_r on the Euroskillz FF server 85.114.140.42:27015. Maybe some lua pro can help us tweek it and make it better. Maybe add glow to the classes who got quad. CURRENT TWEEKED VERSION Credits: DD who optimised the lua Galdur who made the quad hud icon This gives sollys and demomens quad and invul on red team. To fix: When you go spec from red solly or demo the hud icon don't disappear. Download hud icon (Put in materials/vgui) Code:
-- base_quad.lua ---------------------------------------------------------------------- -- Quad icon ---------------------------------------------------------------------- hudicon = "hud_quad" hudx = 5 hudy = 110 hudw = 48 hudh = 48 huda = 1 hudstatusicon = "hud_quad.vtf" ---------------------------------------------------------------------- -- Set hud icon at spawn ---------------------------------------------------------------------- function player_spawn( player_entity ) local player = CastToPlayer( player_entity ) local class = player:GetClass() if class == Player.kSoldier or class == Player.kDemoman then if player:GetTeamId() ~= Team.kRed then RemoveHudItem( player, hudstatusicon ) else AddHudIcon(player, hudicon, hudstatusicon, hudx, hudy, hudw, hudh, huda) end else RemoveHudItem( player, hudstatusicon ) end end ---------------------------------------------------------------------- -- Remove hud icon if player changes to spectator ---------------------------------------------------------------------- function player_switchteam( player, currentteam, desiredteam ) if desiredteam == Team.kSpectator then RemoveHudItem( player, hudstatusicon ) end return true end ---------------------------------------------------------------------- -- Set quad and invul when damage is taken by soldier and demoman -- on red team ---------------------------------------------------------------------- function player_ondamage( player, damageinfo ) if player:GetTeamId() ~= Team.kRed then return end local class = player:GetClass() if class == Player.kSoldier or class == Player.kDemoman then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) end end Last edited by Lt Llama; 03-07-2008 at 03:05 PM. |
|
02-18-2008, 03:06 PM | #2 |
Lua Team
Join Date: Mar 2007
Posts Rated Helpful 1 Times
|
~= is "not equal" in lua
you seem to be under the impression that ~= is equals. In your code: A soldier is not a demoman, therefore multiply by 4 and a soldier is not a pyro, so multiply by 4 again Fixed: Code:
function player_ondamage( player, damageinfo ) if player:GetClass() == Player.kSoldier then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) elseif player:GetClass() == Player.kDemoman then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) elseif player:GetClass() == Player.kPyro then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) end end Last edited by Sidd; 02-18-2008 at 04:17 PM. |
|
02-18-2008, 03:46 PM | #3 |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
It's great to finally be able to use proper quad & invulnerability, it seems even more fun that it was in TFC.
When testing with my map I noticed the top piece of code worked but was bugged slightly in that every class got quad+invul (medics could just use quad nades instead of concing etc). I decided to have a play around with the lua and came up with this: Code:
function player_ondamage( player, damageinfo ) class = player:GetClass() if class == Player.kSoldier or class == Player.kDemoman then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) end Code:
function player_ondamage( player, damageinfo ) class = player:GetClass() if class == Player.kSoldier or class == Player.kDemoman or class == Player.kPyro then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) end |
|
02-18-2008, 04:16 PM | #4 |
Lua Team
Join Date: Mar 2007
Posts Rated Helpful 1 Times
|
it probably should be "elseif" wherever i wrote "elif"
too much python, not enough lua :/ |
|
02-18-2008, 06:43 PM | #5 |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
Thanks DD, added to first post as current tweeked version.
|
|
02-18-2008, 10:54 PM | #6 |
Community Member
Server Owner
Beta Tester Forum Moderator Join Date: Mar 2007
Location: Hawthorne, California
Class/Position: Soldier/Spy/Scout Gametype: AvD Affiliations: :e0:Eternal Order Leader Posts Rated Helpful 12 Times
|
You should add this to Wiki
__________________
|
|
02-19-2008, 06:43 PM | #7 |
Retired FF Staff
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
Would it be possible to have a tweaked version that affects BLUE team only? If so, anyone care to write the code down?
|
|
02-19-2008, 07:38 PM | #8 |
Join Date: Sep 2007
Posts Rated Helpful 0 Times
|
Oh my god. You guys are amazing! If this works as stated.. I'll have to start porting some of my quad maps to FF, among some new ones
|
|
02-19-2008, 10:22 PM | #9 | |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
Quote:
Code:
function player_ondamage( player, damageinfo ) if player:GetTeamId() ~= Team.kBlue then return end local class = player:GetClass() if class == Player.kSoldier or class == Player.kDemoman then local damageforce = damageinfo:GetDamageForce() damageinfo:SetDamageForce(Vector( damageforce.x * 4, damageforce.y * 4, damageforce.z * 4)) damageinfo:SetDamage( 0 ) end end |
|
|
02-19-2008, 10:42 PM | #10 |
Fortress Forever Staff
|
Now all we need is our god damn glow effect.
|
|
02-19-2008, 10:55 PM | #11 |
Banned
Join Date: Sep 2007
Location: Internet
Posts Rated Helpful 0 Times
|
Is it possible to add some client side message or pic to show you have quad? That would be easier, and quicker(Maybe).
|
|
02-19-2008, 11:54 PM | #12 | |
Stuff Do-er
Lua Team
Wiki Team Fortress Forever Staff |
Quote:
__________________
#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 |
|
|
02-20-2008, 06:42 AM | #13 |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
I think we need a new hud icon for this. I looked at all the stuff in the materials/vgui folder but couldnt find anything suitable. It would also be good with some triggers which enables quad and invul. Btw, what models is it in the models/items/armour/ folder?
If someone could make a 256 x 256 helmet texture with a white background. I can make the vtf and vmt files. Last edited by Lt Llama; 02-20-2008 at 08:44 AM. |
|
02-20-2008, 02:06 PM | #14 | |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
Quote:
More maps being either ported or made from scratch would be more than welcome as there's a short supply of skills maps atm sadly. |
|
|
02-20-2008, 02:25 PM | #15 | |
Banned
Join Date: Sep 2007
Location: Internet
Posts Rated Helpful 0 Times
|
Quote:
|
|
|
02-20-2008, 03:36 PM | #16 | |
Wiki Team
Fortress Forever Staff Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly Gametype: PAYLOAD Affiliations: DET- Posts Rated Helpful 19 Times
|
Quote:
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf (Beta) alchimy_b1 (Lua) base_payload_2015 (Models) props_trainyard |
|
|
02-20-2008, 09:52 PM | #17 |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
Added a hud icon made by Galdur and tried to make a lua that works.
It works for red team's solly and demo. The hud icon disappears when you change to any other class or team. But, if you change to spectator from solly or demo on red team the hud icon stays. What forward can I use to catch when a player goes spec so I can remove it from them to? Btw, changed to red team as thats the traditional quad team. Sorry Sh4x. Updated first post. Last edited by Lt Llama; 02-20-2008 at 09:58 PM. |
|
02-20-2008, 11:17 PM | #18 | |
Fortress Forever Staff
|
Quote:
For true glowing, we need to essentially draw models twice, making the second model scaled up and using a glow material. Of course, another method would be to just draw some cool shit in the first pass. Anyways, we have shit planned, but haven't done anything cool yet. Now that 2.0 is out of the way, we can finally get back to doing a lot more aesthetic shit like this. |
|
|
02-25-2008, 05:51 AM | #19 |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
Really annoying, but I can't get the hud_quad.vtf and hud_quad.vmt to upload to clients and my res files looks normal to me. Is it a matter of precaching or something?
The res file for conc_adam when I tested on that: Code:
"resources" { "maps/conc_adam.bsp" "file" "maps/conc_adam.txt" "file" "maps/conc_adam.lua" "file" "materials/vgui/hud_quad.vtf" "file" "materials/vgui/hud_quad.vmt" "file" } |
|
03-01-2008, 09:12 AM | #20 |
Join Date: Sep 2007
Posts Rated Helpful 0 Times
|
download hud icon link does not work and nice work boys
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|