09-14-2007, 05:17 PM | #1 |
Join Date: Sep 2007
Posts Rated Helpful 0 Times
|
Creating a skill map..quad/invinc?
I have everything going smoothly, bags and all, it's just.. I can't seem to figure out how to give quad damage and invincibility to the players. I know this is controlled through Lua, but I have no idea where to start really. Can anyone shed some light on this for me? Thanks!
|
|
09-15-2007, 12:51 AM | #2 |
Useless
Retired FF Staff
|
Code:
function player_ondamage( player, damageinfo ) damageinfo:SetDamage( 0 ) end
__________________
Look at all those dead links. |
|
09-15-2007, 01:01 AM | #3 | |
Join Date: Mar 2007
Posts Rated Helpful 5 Times
|
Quote:
|
|
|
09-15-2007, 01:03 AM | #4 |
Useless
Retired FF Staff
|
I just wrote that. No reason for it not to work.
__________________
Look at all those dead links. |
|
09-15-2007, 01:06 AM | #5 |
Join Date: Mar 2007
Posts Rated Helpful 5 Times
|
Code:
-- Disable damage function player_ondamage( player, damageinfo ) damageinfo:SetDamage(0); |
|
09-15-2007, 01:11 AM | #6 |
Useless
Retired FF Staff
|
Needs an end.
__________________
Look at all those dead links. |
|
09-15-2007, 01:12 AM | #7 |
Join Date: Mar 2007
Posts Rated Helpful 5 Times
|
oh, oops
Forgot to copy it. =/ Code:
-- Disable damage function player_ondamage( player, damageinfo ) damageinfo:SetDamage(0); end |
|
09-15-2007, 02:14 AM | #8 |
QUAD ROCKET
Server Owner
Fortress Forever Staff Join Date: Jul 2007
Class/Position: Soldier Gametype: Rocket Jumping Affiliations: -g1 ]qS[ -eC- :e0: [ESAD] Posts Rated Helpful 11 Times
|
I actually saw that exact code in some random file on google. I tested it last night and it didn't work. I even fiddled around with it, and it still didn't work. All that worked was the console spitting errors out at me :P
|
|
09-15-2007, 02:15 AM | #9 |
Nutcracker
|
Code:
function player_ondamage( player, damageinfo ) player:AddHealth( 400 ) end I still want to know how it's done properly though. It seems you are giving wrong parameters for damageinfo:SetDamage(). If I use your script, this is what I get in console every time I take damage: [SCRIPT] Error calling player_ondamage (no overload of 'Damage:SetDamage' matched the arguments (const Damage, number) candidates are: Damage:SetDamage(custom [float]) ) ent: NULL |
|
09-15-2007, 02:25 AM | #10 |
QUAD ROCKET
Server Owner
Fortress Forever Staff Join Date: Jul 2007
Class/Position: Soldier Gametype: Rocket Jumping Affiliations: -g1 ]qS[ -eC- :e0: [ESAD] Posts Rated Helpful 11 Times
|
Yeah, that's the error I was getting too.
I thought maybe I needed to set it as a float but 0.0 didn't work either. EDIT: Does damageinfo contain the amount of damage that was taken? If so you could just add that much health back? |
|
09-15-2007, 02:32 AM | #11 |
Nutcracker
|
The problem seems to be that the player actually takes the damage after the event, which is why we need to modify the damage. There must be a way, but it's not easy to know without documented function reference
Code:
function player_ondamage( player, damageinfo ) player:AddHealth( damageinfo:GetDamage() ) end edit: could someone tell me how to create a variable of type "custom [float]"? edit: Alright. If I do "SetDamage(0.0)" that "0.0" is actually considered as a "number" type variable which have precision of two decimals, but the precision of the damage is 12 decimals. How can I create a float that has precision of 12 decimals? Last edited by A1win; 09-15-2007 at 04:22 AM. |
|
09-15-2007, 11:35 AM | #12 |
Rocket p00nz
Join Date: Mar 2007
Location: Belgium, Ghent
Class/Position: soldier Gametype: skillz ;) Posts Rated Helpful 0 Times
|
woot adam? started mapping FF_quadrocket_adam? ?
|
|
09-15-2007, 02:39 PM | #13 |
Useless
Retired FF Staff
|
Do me a favor and try player:SetDamage( 0 ).
__________________
Look at all those dead links. |
|
09-15-2007, 04:27 PM | #14 |
QUAD ROCKET
Server Owner
Fortress Forever Staff Join Date: Jul 2007
Class/Position: Soldier Gametype: Rocket Jumping Affiliations: -g1 ]qS[ -eC- :e0: [ESAD] Posts Rated Helpful 11 Times
|
Trying that returns this error:
Code:
[SCRIPT] Error calling player_ondamage ([string "maps/ff_conc_esad.lua"]:34: attempt to call method 'SetDamage' (a nil value)) ent: NULL |
|
09-16-2007, 12:54 AM | #15 |
Insane Coder
|
i dont have anyone to test with or bots but from looking at the soldier arena include this looks like it would work.
Code:
function player_ondamage( player, damageinfo ) damageinfo:SetDamage( 0.0 ); end this is a wild guess from what i have seen so far, if i could take a look at FF's codebase i could find out what to do with a lot more ease. Last edited by Steven_m64; 09-16-2007 at 01:01 AM. |
|
09-16-2007, 01:59 AM | #16 |
QUAD ROCKET
Server Owner
Fortress Forever Staff Join Date: Jul 2007
Class/Position: Soldier Gametype: Rocket Jumping Affiliations: -g1 ]qS[ -eC- :e0: [ESAD] Posts Rated Helpful 11 Times
|
I have already tried that and it doesn't work.
|
|
09-16-2007, 03:28 AM | #17 |
Nutcracker
|
I think you need to do:
damageinfo:SetDamage( insert a float with 12 decimal precision here ) or: damageinfo.SetDamage( insert a float with 12 decimal precision here ) No idea what's the difference between : and . but when I use the first one, it returns an error even with damageinfo:SetDamage() saying I'm trying to give a number as a parameter even though there are no parameters at all. The second one gives error that I need to use "custom [float]" instead of a "number" if I try to give it a number as a parameter. But I have no idea how to convert a number into a 12 decimal float. LUA's "number" is already a float, but only with 2 decimal precision (0.00 for example). The SetDamage() function wants something like 0.000000000000, but it's converted into a number (0) if you type in just that. |
|
09-16-2007, 06:43 AM | #18 |
Join Date: Mar 2007
Posts Rated Helpful 0 Times
|
. is an object function, : is a class function, but i have no idea what vars are classes or objects
|
|
09-17-2007, 12:17 AM | #19 |
Join Date: Sep 2007
Posts Rated Helpful 0 Times
|
Both of these are the same:
Code:
obj.func( obj, argument ) obj:func( argument ) |
|
09-17-2007, 03:13 AM | #20 |
[AE] 0112 Ihmhi *SJB
Wiki Team
Fortress Forever Staff |
You know, it said something in there about a "nil value". Maybe it just can not be represented by 0?
Even "buddha", the invicibility cheat, only keeps your health from going below 1. (And while you are at 1, you do not get affected by push from any weapons.) I would just go with the health increaser dealie, but do a lot more than 400 health. A headshot does like... a thousand damage? Go with 5,000 or something. d:
__________________
Anime: The Thread: Reloaded The one and only anime thread on these here forums. Select the pistol, and then, select your horse. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|