Difference between revisions of "Player onconc"

From Fortress Forever Wiki
Jump to navigationJump to search
(New page: {{Infobox manual/Header}} ==player_onconc(player_entity, effector_entity)== This function is called whenever a player receives a concussion effect. Returning false will prevent players fro...)
 
(Removing all content from page)
 
Line 1: Line 1:
−
{{Infobox manual/Header}}
 
−
==player_onconc(player_entity, effector_entity)==
 
−
This function is called whenever a player receives a concussion effect. Returning false will prevent players from being concussed
 
−
===Inputs===
 
−
*player_entity(CBaseEntity) The entity that got conced
 
−
*effector_entity(CBaseEntity) The entity that caused the concussion
 
  
−
===Variables===
 
−
The following variables are set in the global lua namespace before this function is called:
 
−
*conc_duration: The amount of time the conc effect will last in seconds. -1 means forever
 
−
*conc_iconduration: The amount of time the conc indicator icon will stay on the player's screen. -1 means forever
 
−
*conc_concspeed: Don't know if this does anything.
 
−
Changing these variables will alter the duration of the conc effect. Ignoring them will leave them at default values.
 
−
===Examples===
 
−
<pre>
 
−
 
−
function player_onconc(player_entity, effector_entity)
 
−
-- make conc effect last 20 seconds
 
−
conc_duration = 20
 
−
-- make conc status icon last 1 second
 
−
conc_iconduration = 1
 
−
 
−
return EVENT_ALLOWED
 
−
-- or you can just return “true” to let the conc happen. If you return false no conc effect happens
 
−
end
 
−
</pre>
 
−
<pre>
 
−
-- player_entity is guy getting conc’d
 
−
-- effector_entity is the one doing the conc’ing
 
−
function player_onconc(player_entity, effector_entity)
 
−
--effector_entity is a CBaseEntity type, we need to verify that it's a player before we do anything with it
 
−
if isPlayer(effector_entity) then
 
−
local concer = CastToPlayer(effector_entity)
 
−
--Award some fortress points for concing somebody.
 
−
concer:AddFortPoints(5, "Conc-Tagging a player")
 
−
end
 
−
--Don't actually concuss the other guy
 
−
return false
 
−
end
 
−
</pre>
 
−
 
−
[[Category:Lua Callbacks]]
 
−
{{Infobox manual/Footer}}
 

Latest revision as of 20:23, 11 May 2009