Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
November 10, 2024, 05:51:19 AM
News:
Zombie Master 2 discussion
Zombie Master
|
Other
|
Trouble in Terrorist Town
| Topic:
Small question..
Pages: [
1
]
Author
Topic: Small question.. (Read 3811 times)
Spartan
Poster
Posts: 36
«
on:
January 22, 2011, 10:49:13 PM »
Making a pain station for a ttt server so I thought someone might be able to give a quick answer to this. After reading BKU's thread, I daren't pm him this so... using ply:TakeDamageInfo(dmginfo) what would 'ply' need to be for it to damage the playing using the pain station. E.G. I had set ply as
local ply = self:GetOwner()
Obviously this doesn't work since when someone uses it, it damages the traitor who planted the pain station. For the life of me I cannot think of what I would put even though it looks so simple.
I know this seems like a bit of a weird question, and I'll give more info if you don't understand what I'm saying. Any help is appreciated, cheers.
Charles445
Build Tester
Posts: 2338
I LOVE THIS AVATAR
«
Reply #1 on:
January 23, 2011, 06:40:25 AM »
IIRC, whenever a health station is pressed a parameter called activator is sent to the function.
So you would probably be able to do
local ply = activator
Not sure how you've made the pain station; a copy paste would be nice.
Quote from: BaconManRules on April 15, 2011, 10:37:34 PM
del>Ok, so Bad King, you are just going to wait for Garry to fix?
What an idiotic thing to ask. Dammit weed.
Bookcases, Bookcases Everywhere
Spartan
Poster
Posts: 36
«
Reply #2 on:
January 23, 2011, 03:02:42 PM »
Most of the code is just the health station copied over. I altered some bits but I think this is what you're after:
function ENT:GiveHealth(dmginfo, ply, activator)
local dmginfo = DamageInfo()
dmginfo:SetDamage(50)
dmginfo:SetDamageType(DMG_BULLET)
dmginfo:SetAttacker(self:GetOwner())
dmginfo:SetInflictor(self.Entity)
dmginfo:SetDamageForce(Vector(0, 0, 1000))
local ply = activator()
ply:TakeDamageInfo( dmginfo )
self:EmitSound(failsound)
self:TakeDamage(25, self:GetOwner())
self:SetStoredHealth(math.min(self:GetStoredHealth() - 25))
end
I'm not worried about the values in the dmginfo for now. As you can see I tried local ply = activator() but it didn't work. Basically nil value so I'm guessing I would have to add something else into the code.
Charles445
Build Tester
Posts: 2338
I LOVE THIS AVATAR
«
Reply #3 on:
January 23, 2011, 04:57:09 PM »
Instead of
activator()
use
activator
Quote from: BaconManRules on April 15, 2011, 10:37:34 PM
del>Ok, so Bad King, you are just going to wait for Garry to fix?
What an idiotic thing to ask. Dammit weed.
Bookcases, Bookcases Everywhere
Spartan
Poster
Posts: 36
«
Reply #4 on:
January 23, 2011, 10:16:49 PM »
Using just activator gives:
attempt to index local 'ply' (a nil value)(Hook: KeyRelease)
Do I need to define what activator is before hand?
Charles445
Build Tester
Posts: 2338
I LOVE THIS AVATAR
«
Reply #5 on:
January 24, 2011, 01:21:51 AM »
Wait, hmm...
Try removing the local ply line entirely and see what happens. It looks like ply is sent as a parameter or something
Quote from: BaconManRules on April 15, 2011, 10:37:34 PM
del>Ok, so Bad King, you are just going to wait for Garry to fix?
What an idiotic thing to ask. Dammit weed.
Bookcases, Bookcases Everywhere
Spartan
Poster
Posts: 36
«
Reply #6 on:
January 24, 2011, 03:10:43 PM »
Exactly the same error occurs when the line 'local ply = activator' is removed.
Looking at the health station code, I also see this at the top:
function ENT:UseOverride(activator)
if ValidEntity(activator) and activator:IsPlayer() and activator:IsActive() then
self:GiveHealth(activator)
end
Maybe this helps? :P
Pages
: [
1
]
Zombie Master
|
Other
|
Trouble in Terrorist Town
| Topic:
Small question..
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Other
-----------------------------
=> Trouble in Terrorist Town
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Powered by SMF 1.1.21
|
SMF © 2015, Simple Machines
Page created in 0.01 seconds with 18 queries.
Loading...