Fortress Forever

Go Back   Fortress Forever > Editing > Mapping

Reply
 
Thread Tools Display Modes
Old 09-14-2007, 05:17 PM   #1
Adam-g1
 
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!
Adam-g1 is offline   Reply With Quote


Old 09-15-2007, 12:51 AM   #2
Circuitous
Useless
Retired FF Staff
 
Join Date: Jun 2005
Class/Position: D Soldier, O Scout
Gametype: AvD
Posts Rated Helpful 9 Times
Send a message via AIM to Circuitous Send a message via MSN to Circuitous Send a message via Yahoo to Circuitous Send a message via Skype™ to Circuitous
Code:
function player_ondamage( player, damageinfo )
	damageinfo:SetDamage( 0 )
end
There's invulnerability. Quad I still haven't figured out. It's not a simple command.
__________________
Look at all those dead links.
Circuitous is offline   Reply With Quote


Old 09-15-2007, 01:01 AM   #3
nodnarb
 
Join Date: Mar 2007
Posts Rated Helpful 5 Times
Quote:
Originally Posted by Circuitous
Code:
function player_ondamage( player, damageinfo )
	damageinfo:SetDamage( 0 )
end
There's invulnerability. Quad I still haven't figured out. It's not a simple command.
If you got that out of my map, it doesn't work.
nodnarb is offline   Reply With Quote


Old 09-15-2007, 01:03 AM   #4
Circuitous
Useless
Retired FF Staff
 
Join Date: Jun 2005
Class/Position: D Soldier, O Scout
Gametype: AvD
Posts Rated Helpful 9 Times
Send a message via AIM to Circuitous Send a message via MSN to Circuitous Send a message via Yahoo to Circuitous Send a message via Skype™ to Circuitous
I just wrote that. No reason for it not to work.
__________________
Look at all those dead links.
Circuitous is offline   Reply With Quote


Old 09-15-2007, 01:06 AM   #5
nodnarb
 
Join Date: Mar 2007
Posts Rated Helpful 5 Times
Code:
-- Disable damage
function player_ondamage( player, damageinfo )
	damageinfo:SetDamage(0);
nodnarb is offline   Reply With Quote


Old 09-15-2007, 01:11 AM   #6
Circuitous
Useless
Retired FF Staff
 
Join Date: Jun 2005
Class/Position: D Soldier, O Scout
Gametype: AvD
Posts Rated Helpful 9 Times
Send a message via AIM to Circuitous Send a message via MSN to Circuitous Send a message via Yahoo to Circuitous Send a message via Skype™ to Circuitous
Needs an end.
__________________
Look at all those dead links.
Circuitous is offline   Reply With Quote


Old 09-15-2007, 01:12 AM   #7
nodnarb
 
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
nodnarb is offline   Reply With Quote


Old 09-15-2007, 02:14 AM   #8
hlstriker
QUAD ROCKET
Server Owner
Fortress Forever Staff
 
hlstriker's Avatar
 
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
hlstriker is offline   Reply With Quote


Old 09-15-2007, 02:15 AM   #9
A1win
Nutcracker
 
A1win's Avatar
 
Join Date: Sep 2007
Location: Kuopio, Finland
Posts Rated Helpful 0 Times
Send a message via MSN to A1win
Code:
function player_ondamage( player, damageinfo )
	player:AddHealth( 400 )
end
You lose and gain health but at least you don't die

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
A1win is offline   Reply With Quote


Old 09-15-2007, 02:25 AM   #10
hlstriker
QUAD ROCKET
Server Owner
Fortress Forever Staff
 
hlstriker's Avatar
 
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?
hlstriker is offline   Reply With Quote


Old 09-15-2007, 02:32 AM   #11
A1win
Nutcracker
 
A1win's Avatar
 
Join Date: Sep 2007
Location: Kuopio, Finland
Posts Rated Helpful 0 Times
Send a message via MSN to A1win
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
With that I stay constantly at ~17 health when taking damage. Also it doesn't add armor back, and I have no idea how to detect how much armor was lost.

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.
A1win is offline   Reply With Quote


Old 09-15-2007, 11:35 AM   #12
diablo`-
Rocket p00nz
 
diablo`-'s Avatar
 
Join Date: Mar 2007
Location: Belgium, Ghent
Class/Position: soldier
Gametype: skillz ;)
Posts Rated Helpful 0 Times
woot adam? started mapping FF_quadrocket_adam? ?
diablo`- is offline   Reply With Quote


Old 09-15-2007, 02:39 PM   #13
Circuitous
Useless
Retired FF Staff
 
Join Date: Jun 2005
Class/Position: D Soldier, O Scout
Gametype: AvD
Posts Rated Helpful 9 Times
Send a message via AIM to Circuitous Send a message via MSN to Circuitous Send a message via Yahoo to Circuitous Send a message via Skype™ to Circuitous
Do me a favor and try player:SetDamage( 0 ).
__________________
Look at all those dead links.
Circuitous is offline   Reply With Quote


Old 09-15-2007, 04:27 PM   #14
hlstriker
QUAD ROCKET
Server Owner
Fortress Forever Staff
 
hlstriker's Avatar
 
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
hlstriker is offline   Reply With Quote


Old 09-16-2007, 12:54 AM   #15
Steven_m64
Insane Coder
 
Join Date: Jun 2007
Posts Rated Helpful 0 Times
Send a message via ICQ to Steven_m64 Send a message via AIM to Steven_m64 Send a message via MSN to Steven_m64 Send a message via Yahoo to Steven_m64
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.
Steven_m64 is offline   Reply With Quote


Old 09-16-2007, 01:59 AM   #16
hlstriker
QUAD ROCKET
Server Owner
Fortress Forever Staff
 
hlstriker's Avatar
 
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.
hlstriker is offline   Reply With Quote


Old 09-16-2007, 03:28 AM   #17
A1win
Nutcracker
 
A1win's Avatar
 
Join Date: Sep 2007
Location: Kuopio, Finland
Posts Rated Helpful 0 Times
Send a message via MSN to A1win
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.
A1win is offline   Reply With Quote


Old 09-16-2007, 06:43 AM   #18
stino
 
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
stino is offline   Reply With Quote


Old 09-17-2007, 12:17 AM   #19
zero
 
Join Date: Sep 2007
Posts Rated Helpful 0 Times
Both of these are the same:

Code:
obj.func( obj, argument )
obj:func( argument )
: is syntactic sugar that makes free functions work like member functions.
zero is offline   Reply With Quote


Old 09-17-2007, 03:13 AM   #20
Ihmhi
[AE] 0112 Ihmhi *SJB
Wiki Team
Fortress Forever Staff
 
Ihmhi's Avatar
 
Join Date: Mar 2007
Location: Newark, NJ, United States
Class/Position: A little bit o' everythin'
Gametype: Also a little bit o' everythin'
Affiliations: [AE] Asseater, *SJB Straight Jacket Brigade
Posts Rated Helpful 3 Times
Send a message via AIM to Ihmhi Send a message via MSN to Ihmhi Send a message via Yahoo to Ihmhi
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:
__________________
Support FF:
Anime: The Thread: Reloaded
The one and only anime thread on these here forums.

Select the pistol, and then, select your horse.
Ihmhi 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 07:53 PM.


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