Banned
Join Date: Sep 2008
Class/Position: Soldier Gametype: AVD Affiliations: TALOS Posts Rated Helpful 5 Times
|
FF LUA documentation
Quote:
Originally Posted by squeek
Might as well post this here. This is what I use for reference, although I'm not sure how helpful it'll be to someone just learning lua.
A big help to me was looking at other examples. Check out base_ luas and other big luas for examples of most everything you can do with lua.
There is also a few new lua functions that are documented in the 2.1 changelog (the very bottom of the page).
|
Quote:
Code:
Global functions
// global functions
AddHudIcon , void * CFFPlayer * , const char * , const char * , int , int &FFLib::AddHudIcon ,
AddHudIcon , void * CFFPlayer * , const char * , const char * , int , int , int , int , int &FFLib::AddHudIcon ,
AddHudIconToAll , void * const char * , const char * , int , int , int , int , int &FFLib::AddHudIconToAll ,
AddHudText , &FFLib::AddHudText ,
AddHudTimer , &FFLib::AddHudTimer ,
AddSchedule , void * const char* , float , const luabind::adl::object& &FFLib::AddSchedule ,
AddSchedule , void * const char* , float , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddSchedule ,
AddSchedule , void * const char* , float , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddSchedule ,
AddSchedule , void * const char* , float , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddSchedule ,
AddSchedule , void * const char* , float , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddSchedule ,
AddScheduleRepeating , void * const char* , float , const luabind::adl::object& &FFLib::AddScheduleRepeatin g ,
AddScheduleRepeating , void * const char* , float , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddScheduleRepeatin g ,
AddScheduleRepeating , void * const char* , float , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddScheduleRepeatin g ,
AddScheduleRepeating , void * const char* , float , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddScheduleRepeatin g ,
AddScheduleRepeating , void * const char* , float , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddScheduleRepeatin g ,
AddScheduleRepeatingNotInfinitely , void * const char* , float , const luabind::adl::object& , int &FFLib::AddScheduleRepeatingNotInfinitely ,
AddScheduleRepeatingNotInfinitely , void * const char* , float , const luabind::adl::object& , int , const luabind::adl::object& &FFLib::AddScheduleRepeatin gNotInfinitely ,
AddScheduleRepeatingNotInfinitely , void * const char* , float , const luabind::adl::object& , int , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddScheduleRepeatin gNotInfinitely ,
AddScheduleRepeatingNotInfinitely , void * const char* , float , const luabind::adl::object& , int , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddScheduleRepeatin gNotInfinitely ,
AddScheduleRepeatingNotInfinitely , void * const char* , float , const luabind::adl::object& , int , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& , const luabind::adl::object& &FFLib::AddScheduleRepeatin gNotInfinitely ,
ApplyToAll , &FFLib::ApplyToAll ,
ApplyToTeam , &FFLib::ApplyToTeam ,
ApplyToPlayer , &FFLib::ApplyToPlayer ,
AreTeamsAllied , bool * CTeam* , CTeam* &FFLib::AreTeamsAllied ,
AreTeamsAllied , bool * int , int &FFLib::AreTeamsAllied ,
BroadCastMessage , &FFLib::BroadcastMessage ,
BroadCastMessageToPlayer , &FFLib::SendPlayerMessage ,
BroadCastSound , &FFLib::BroadcastSound ,
BroadCastSoundToPlayer , &FFLib::SendPlayerSound ,
CastToBeam , &FFLib::CastToBeam ,
CastToPlayer , &FFLib::CastToPlayer ,
CastToInfoScript , &FFLib::CastToItemFlag ,
CastToTriggerScript , &FFLib::CastToTriggerScript ,
CastToTriggerClip , &FFLib::CastToTriggerClip ,
CastToGrenade , &FFLib::CastToGrenade ,
CastToDispenser , &FFLib::CastToDispenser ,
CastToSentrygun , &FFLib::CastToSentrygun ,
CastToDetpack , &FFLib::CastToDetpack ,
ConsoleToAll , &FFLib::ConsoleToAll ,
DeleteSchedule , &FFLib::DeleteSchedule ,
RemoveSchedule , &FFLib::RemoveSchedule ,
GetConvar , &FFLib::GetConvar ,
GetEntity , &FFLib::GetEntity ,
GetEntityByName , &FFLib::GetEntityByName ,
GetInfoScriptById , &FFLib::GetInfoScriptById ,
GetInfoScriptByName , &FFLib::GetInfoScriptByName ,
GetGrenade , &FFLib::GetGrenade ,
GetPacketloss , &FFLib::GetPacketloss ,
GetPing , &FFLib::GetPing ,
GetPlayer , &FFLib::GetPlayer ,
GetPlayerByID , &FFLib::GetPlayerByID , // TEMPORARY
GetServerTime , &FFLib::GetServerTime ,
GetSteamID , &FFLib::GetSteamID ,
GetTeam , &FFLib::GetTeam ,
GetTriggerScriptByName , &FFLib::GetTriggerScriptByName ,
GoToIntermission , &FFLib::GoToIntermission ,
IncludeScript , &FFLib::IncludeScript ,
IsPlayer , &FFLib::IsPlayer ,
IsDispenser , &FFLib::IsDispenser ,
IsSentrygun , &FFLib::IsSentrygun ,
IsDetpack , &FFLib::IsDetpack ,
IsGrenade , &FFLib::IsGrenade ,
IsTurret , &FFLib::IsTurret ,
KillAndRespawnAllPlayers , &FFLib::KillAndRespawnAllPlayers ,
NumPlayers , &FF_NumPlayers ,
OutputEvent , void * const char* , const char* &FFLib::FireOutput ,
OutputEvent , void * const char* , const char* , const char* &FFLib::FireOutput ,
OutputEvent , void * const char* , const char* , const char* , float &FFLib::FireOutput ,
OutputEvent , void * const char* , const char* , const char* , float , unsigned int &FFLib::FireOutput ,
PrecacheModel , &CBaseEntity::PrecacheModel ,
PrecacheSound , &CBaseEntity::PrecacheScriptSound ,
PrintBool , &FFLib::PrintBool ,
RandomFloat , &FFLib::RandomFloat ,
RandomInt , &FFLib::RandomInt ,
RemoveEntity , &FFLib::RemoveEntity ,
RemoveHudItem , &FFLib::RemoveHudItem ,
RemoveHudItemFromAll , &FFLib::RemoveHudItemFromAll ,
RespawnAllPlayers , &FFLib::RespawnAllPlayers ,
ResetMap , &FFLib::ResetMap ,
SetGlobalRespawnDelay , &FFLib::SetGlobalRespawnDelay ,
SetPlayerLimit , &FFLib::SetPlayerLimit ,
SetPlayerLimits , &FFLib::SetPlayerLimits ,
SetClassLimits , &FFLib::SmartClassLimits ,
SetConvar , &FFLib::SetConvar ,
SetTeamClassLimit , &FFLib::SetTeamClassLimit ,
SetTeamName , &FFLib::SetTeamName ,
SmartMessage , &FFLib::SmartMessage ,
SmartSound , &FFLib::SmartSound ,
SmartTeamMessage , &FFLib::SmartTeamMessage ,
SmartTeamSound , &FFLib::SmartTeamSound ,
SpeakAll , &FFLib::SpeakAll ,
SpeakPlayer , &FFLib::SpeakPlayer ,
SpeakTeam , &FFLib::SpeakTeam
player:functions
class_<CFFPlayer , CBasePlayer> Player
AddAmmo , &CFFPlayer::LuaAddAmmo
AddArmor , &CFFPlayer::AddArmor
AddFrags , &CFFPlayer::IncrementFragCount
AddFortPoints , &CFFPlayer::AddFortPoints
AddHealth , &CFFPlayer::AddHealth
GetClass , &CFFPlayer::GetClassSlot
GetName , &CFFPlayer::GetPlayerName
GetArmor , &CFFPlayer::GetArmor
GetMaxArmor , &CFFPlayer::GetMaxArmor
GetHealth , &CFFPlayer::GetHealth
GetMaxHealth , &CFFPlayer::GetMaxHealth
HasItem , &CFFPlayer::HasItem
IsFeetDeepInWater , &CFFPlayer::IsFeetDeepInWater
IsInNoBuild , &CFFPlayer::IsInNoBuild
IsUnderWater , &CFFPlayer::IsUnderWater
IsWaistDeepInWater , &CFFPlayer::IsWaistDeepInWater
IsInAttack1 , &CFFPlayer::IsInAttack1
IsInAttack2 , &CFFPlayer::IsInAttack2
IsInUse , &CFFPlayer::IsInUse
IsInJump , &CFFPlayer::IsInJump
IsInForward , &CFFPlayer::IsInForward
IsInBack , &CFFPlayer::IsInBack
IsInMoveLeft , &CFFPlayer::IsInMoveLeft
IsInMoveRight , &CFFPlayer::IsInMoveRight
IsInLeft , &CFFPlayer::IsInLeft
IsInRight , &CFFPlayer::IsInRight
IsInRun , &CFFPlayer::IsInRun
IsInReload , &CFFPlayer::IsInReload
IsInSpeed , &CFFPlayer::IsInSpeed
IsInWalk , &CFFPlayer::IsInWalk
IsInZoom , &CFFPlayer::IsInZoom
IsOnGround , &CFFPlayer::IsOnGround
IsInAir , &CFFPlayer::IsInAir
IsDucking , &CFFPlayer::IsDucking
MarkRadioTag , &CFFPlayer::SetRadioTagged
// RemoveAmmo , void CFFPlayer::* int , const char* &CFFPlayer::RemoveAmmo
RemoveAmmo , &CFFPlayer::LuaRemoveAmmo
RemoveArmor , &CFFPlayer::RemoveArmor
RemoveLocation , &CFFPlayer::RemoveLocation
Respawn , &CFFPlayer::KillAndRemoveItems
SetDisguisable , &CFFPlayer::SetDisguisable
IsDisguisable , &CFFPlayer::GetDisguisable
SetCloakable , &CFFPlayer::SetCloakable
IsCloakable , &CFFPlayer::IsCloakable
SetRespawnable , &CFFPlayer::SetRespawnable
IsRespawnable , &CFFPlayer::IsRespawnable
SetLocation , &CFFPlayer::SetLocation
SetRespawnDelay , &CFFPlayer::LUA_SetPlayerRespawnDelay
// InstaSwitch , &CFFPlayer::InstaSwitch -- doing this as part of ApplyToPlayer
GetActiveWeaponName , &CFFPlayer::GetActiveWeaponName
GiveWeapon , &CFFPlayer::GiveNamedItem
RemoveWeapon , &CFFPlayer::TakeNamedItem
RemoveAllWeapons , &CFFPlayer::RemoveAllItems
IsFeigned , &CFFPlayer::IsCloaked // need to remove this one eventually!
IsCloaked , &CFFPlayer::IsCloaked
IsDisguised , &CFFPlayer::IsDisguised
GetDisguisedClass , &CFFPlayer::GetDisguisedClass
GetDisguisedTeam , &CFFPlayer::GetDisguisedTeam
AddEffect , &CFFPlayer::LuaAddEffect
IsEffectActive , &CFFPlayer::LuaIsEffectActive
RemoveEffect , &CFFPlayer::LuaRemoveEffect
GetSteamID , &CFFPlayer::GetSteamID
GetPing , &CFFPlayer::GetPing
GetPacketloss , &CFFPlayer::GetPacketloss
IsAlive , &CFFPlayer::IsAlive
team:functions
// CTeam
class_<CTeam> BaseTeam
AddScore , &CTeam::AddScore
GetNumPlayers , &CTeam::GetNumPlayers
GetPlayer , &CTeam::GetPlayer
GetTeamId , &CTeam::GetTeamNumber
SetName , &CTeam::SetName ,
// CFFTeam
class_<CFFTeam , CTeam> Team
SetAllies , &CFFTeam::SetEasyAllies
SetClassLimit , &CFFTeam::SetClassLimit
SetPlayerLimit , &CFFTeam::SetTeamLimits
.enum_ TeamId
[
kUnassigned , TEAM_UNASSIGNED ,
kSpectator , TEAM_SPECTATOR ,
kBlue , TEAM_BLUE ,
kRed , TEAM_RED ,
kYellow , TEAM_YELLOW ,
kGreen , TEAM_GREEN
]
buildable:functions
// Buildable base
class_<CFFBuildableObject> BaseBuildable
GetTeamId , &CFFBuildableObject::GetTeamNumber
GetOwner , &CFFBuildableObject::GetOwnerPlayer
GetTeam , &CFFBuildableObject::GetOwnerTeam ,
// GetTeamId , &CFFBuildableObject::GetOwnerTeamId ,
// Dispenser
class_<CFFDispenser , CFFBuildableObject> Dispenser ,
// Sentrygun
class_<CFFSentryGun , CFFBuildableObject> Sentrygun
GetLevel , &CFFSentryGun::GetLevel ,
Giving / receiving damage
class_<CFFGrenadeBase , CBaseEntity> Grenade
Type , &CFFGrenadeBase::GetGrenId
.enum_ GrenId
[
kNormal , CLASS_GREN ,
kCaltrop , CLASS_GREN_CALTROP ,
kNail , CLASS_GREN_NAIL ,
kMirv , CLASS_GREN_MIRV ,
kMirvlet , CLASS_GREN_MIRVLET ,
kConc , CLASS_GREN_CONC ,
kNapalm , CLASS_GREN_NAPALM ,
kGas , CLASS_GREN_GAS ,
kEmp , CLASS_GREN_EMP
] ,
// CTakeDamageInfo
class_<CTakeDamageInfo> Damage
GetAttacker , &CTakeDamageInfo::GetAttacker
GetInflictor , &CTakeDamageInfo::GetInflictor
GetDamage , &CTakeDamageInfo::GetDamage
GetDamageForce , &CTakeDamageInfo::GetDamageForce
GetDamagePosition , &CTakeDamageInfo::GetDamagePosition
GetDamageType , int CTakeDamageInfo::* void &CTakeDamageInfo::G etDamageType
GetAmmoType , &CTakeDamageInfo::GetAmmoTypeLua
SetDamage , &CTakeDamageInfo::SetDamage
.enum_ DamageTypes
[
kGeneric , DMG_GENERIC ,
kCrush , DMG_CRUSH ,
kBullet , DMG_BULLET ,
kSlash , DMG_SLASH ,
kBurn , DMG_BURN ,
kVehicle , DMG_VEHICLE ,
kFall , DMG_FALL ,
kBlast , DMG_BLAST ,
kClub , DMG_CLUB ,
kShock , DMG_SHOCK ,
kSonic , DMG_SONIC ,
kEnergyBeam , DMG_ENERGYBEAM ,
kPreventPhysForce , DMG_PREVENT_PHYSICS_FORCE ,
kNeverGib , DMG_NEVERGIB ,
kAlwaysGib , DMG_ALWAYSGIB ,
kDrown , DMG_DROWN ,
kTimeBased , DMG_TIMEBASED ,
kParalyze , DMG_PARALYZE ,
kNerveGas , DMG_NERVEGAS ,
kPoison , DMG_POISON ,
kRadiation , DMG_RADIATION ,
kDrownRecover , DMG_DROWNRECOVER ,
kAcid , DMG_ACID ,
kSlowBurn , DMG_SLOWBURN ,
kRemoveNoRagdoll , DMG_REMOVENORAGDOLL ,
kPhysgun , DMG_PHYSGUN ,
kPlasma , DMG_PLASMA ,
kAirboat , DMG_AIRBOAT ,
kDissolve , DMG_DISSOLVE ,
kBlastSurface , DMG_BLAST_SURFACE ,
kDirect , DMG_DIRECT ,
kBuckshot , DMG_BUCKSHOT ,
kGibCorpose , DMG_GIB_CORPSE ,
kShownHud , DMG_SHOWNHUD ,
kNoPhysForce , DMG_NO_PHYSICS_FORCE
]
Constants
.enum_ AmmoType
[
kShells , LUA_AMMO_SHELLS ,
kCells , LUA_AMMO_CELLS ,
kNails , LUA_AMMO_NAILS ,
kRockets , LUA_AMMO_ROCKETS ,
kDetpack , LUA_AMMO_DETPACK ,
kGren1 , LUA_AMMO_GREN1 ,
kGren2 , LUA_AMMO_GREN2 ,
kInvalid , LUA_AMMO_INVALID
] ,
class_<CFFEntity_Effect_Flags> EF
.enum_ EffectFlagId
[
kOnfire , LUA_EF_ONFIRE ,
kConc , LUA_EF_CONC ,
kGas , LUA_EF_GAS ,
kInfect , LUA_EF_INFECT ,
kRadiotag , LUA_EF_RADIOTAG ,
kHeadshot , LUA_EF_HEADSHOT ,
kLegshot , LUA_EF_LEGSHOT ,
kTranq , LUA_EF_TRANQ ,
kCaltrop , LUA_EF_CALTROP ,
kACSpinup , LUA_EF_ACSPINUP ,
kSniperrifle , LUA_EF_SNIPERRIFLE ,
kSpeedlua1 , LUA_EF_SPEED_LUA1 ,
kSpeedlua2 , LUA_EF_SPEED_LUA2 ,
kSpeedlua3 , LUA_EF_SPEED_LUA3 ,
kSpeedlua4 , LUA_EF_SPEED_LUA4 ,
kSpeedlua5 , LUA_EF_SPEED_LUA5 ,
kSpeedlua6 , LUA_EF_SPEED_LUA6 ,
kSpeedlua7 , LUA_EF_SPEED_LUA7 ,
kSpeedlua8 , LUA_EF_SPEED_LUA8 ,
kSpeedlua9 , LUA_EF_SPEED_LUA9 ,
kSpeedlua10 , LUA_EF_SPEED_LUA10
] ,
class_<CFFEntity_ApplyTo_Flags> AT
.enum_ ApplyToFlagId
[
kKillPlayers , AT_KILL_PLAYERS ,
kRespawnPlayers , AT_RESPAWN_PLAYERS ,
kDropItems , AT_DROP_ITEMS ,
kForceDropItems , AT_FORCE_DROP_ITEMS ,
kThrowItems , AT_THROW_ITEMS ,
kForceThrowItems , AT_FORCE_THROW_ITEMS ,
kReturnCarriedItems , AT_RETURN_CARRIED_ITEMS ,
kReturnDroppedItems , AT_RETURN_DROPPED_ITEMS ,
kRemoveRagdolls , AT_REMOVE_RAGDOLLS ,
kRemovePacks , AT_REMOVE_PACKS ,
kRemoveProjectiles , AT_REMOVE_PROJECTILES ,
kRemoveBuildables , AT_REMOVE_BUILDABLES ,
kRemoveDecals , AT_REMOVE_DECALS ,
kEndMap , AT_END_MAP ,
kReloadClips , AT_RELOAD_CLIPS ,
kAllowRespawn , AT_ALLOW_RESPAWN ,
kDisallowRespawn , AT_DISALLOW_RESPAWN ,
kChangeClassScout , AT_CHANGECLASS_SCOUT ,
kChangeClassSniper , AT_CHANGECLASS_SNIPER ,
kChangeClassSoldier , AT_CHANGECLASS_SOLDIER ,
kChangeClassDemoman , AT_CHANGECLASS_DEMOMAN ,
kChangeClassMedic , AT_CHANGECLASS_MEDIC ,
kChangeClassHWGuy , AT_CHANGECLASS_HWGUY ,
kChangeClassPyro , AT_CHANGECLASS_PYRO ,
kChangeClassSpy , AT_CHANGECLASS_SPY ,
kChangeClassEngineer , AT_CHANGECLASS_ENGINEER ,
kChangeClassCivilian , AT_CHANGECLASS_CIVILIAN ,
kChangeClassRandom , AT_CHANGECLASS_RANDOM ,
kChangeTeamBlue , AT_CHANGETEAM_BLUE ,
kChangeTeamRed , AT_CHANGETEAM_RED ,
kChangeTeamYellow , AT_CHANGETEAM_YELLOW ,
kChangeTeamGreen , AT_CHANGETEAM_GREEN ,
kChangeTeamSpectator , AT_CHANGETEAM_SPEC ,
kStopPrimedGrens , AT_STOP_PRIMED_GRENS
] ,
class_<CFFEntity_HudItemTypes> Hud
.enum_ HudItemTypes
[
kIcon , LUA_HUD_ITEM_ICON ,
kText , LUA_HUD_ITEM_TEXT ,
kTimer , LUA_HUD_ITEM_TIMER ,
kRemove , LUA_HUD_ITEM_REMOVE
] ,
class_<CFFEntity_AllowFlags> AllowFlags
.enum_ AllowFlags
[
kOnlyPlayers , kAllowOnlyPlayers ,
kBlue , kAllowBlueTeam ,
kRed , kAllowRedTeam ,
kYellow , kAllowYellowTeam ,
kGreen , kAllowGreenTeam
] ,
class_<CFFEntity_ClipFlags> ClipFlags
.enum_ ClipFlags
[
kClipPlayers , LUA_CLIP_FLAG_PLAYERS ,
kClipTeamBlue , LUA_CLIP_FLAG_TEAMBLUE ,
kClipTeamRed , LUA_CLIP_FLAG_TEAMRED ,
kClipTeamYellow , LUA_CLIP_FLAG_TEAMYELLOW ,
kClipTeamGreen , LUA_CLIP_FLAG_TEAMGREEN ,
kClipGrenades , LUA_CLIP_FLAG_GRENADES ,
kClipProjectiles , LUA_CLIP_FLAG_PROJECTILES
]
|
Quote:
Okay, Lua callbacks.
In quotations is the callback name (and case). Next is whether the function is global or is invoked on an existing object. If invoked on an object then the word “entity” is available to the Lua script as the actual object the script is being called on – so you could do stuff like “IsPlayer(entity)” even if there’s no mention of entity in the function already. If it’s a global function then “entity” is nil. Next are any arguments – the forward slash should be treated as an “or”, and commas will be used to designate multiple arguments. Next is the return value – “none” indicates no return value is needed. Finally, there’s a short description of when it’s used or something.
“startup” – global – () – none – called during ff_restartround. I think it should be called during map startup as well but I didn’t check
“validspawn” – info_ff_teamspawn – (CFFPlayer *) – true / false – called on a spawn point and returns true/false for whether the player can spawn at the spawn point
“validtarget” – ff_miniturret – (CBaseEntity *) – true / false – called on a turret to see if the player / sg / dispenser it is targeting is a valid target or not [cast appropriately]
“deploydelay” – ff_miniturret – (CBaseEntity *) – float – called on a turret to get the delay until it should deploy [the parameter could be a player / sg / dispenser but is sent as a CBaseEntity * and would need to be cast appropriately before anything was done to it)
“onownercloak” – CBaseEntity * [ie. info_ff_script] - (CFFPlayer *) – none – called on each info_ff_script the player ‘owns’ (is carrying) so that the entity can be notified the player is cloaking and do something about it (get dropped perhaps)
“spawn” – trigger_ff_clip – () – none – called when a trigger_ff_clip gets spawned
“player_killed” – global – (CFFPlayer *, CTakeDamageInfo *) – none – called when a player is killed. On /kill no CTakeDamageInfo is passed along . On changing class this is also called with no CTakeDamageInfo. On changing team this is also called with no CTakeDamageInfo.
Okay, I’m already tired of doing this. I’m just going to jump to player specific stuff…
“player_onkill” – global – (CFFPlayer *) – true / false – called to see whether the player can /kill themselves or not
“player_spawn” – global – (CFFPlayer *) – none – called when a player is spawning
“player_switchteam” – global – (CFFPlayer *, current team number [int], proposed team number [int]) – true / false – called when a player tries to switch team
“flaginfo” – global – (CFFPlayer *) – none – called when a player hits their flaginfo key
“dropitemcmd” – CBaseEntity * [ie. info_ff_script] – (CFFPlayer *) – none – called on each item the player ‘owns’ when the player hits their drop items button
“player_onthrowgren1 / 2” – global – (CFFPlayer *, prime time [float]) – true / false – called when trying to release a grenade
“player_ondamage” – global – (CFFPlayer *, CTakeDamageInfo *) – none – called when a player takes damage. The CTakeDamageInfo can be modified by Lua.
And I’m kind of done for the moment. There’s a ton of the Lua effect ones that need to be documented. Most of these allow you to change or deny the effect, change the duration of the effect [with -1 being infinite], and change the icon duration [like the status icon (again with -1 being infinite)]. Most of these take player being effected and then a CBaseEntity * of the entity/player doing the effecting.
These events start with “onplayer%s” and fill %s with:
“fire”, “conc”, “gas”, “infect”, “radiotag”, “headshot”, “legshot”, “tranq”, “caltrop”, “acspinup”, “sniperrifle”, speedlua1”, “speedlua2”, up to “speedlua10” (so you could have up 10 speed effects Lua controlled).
Duration is initially set to 0, icon duration is initially set to 0, and speed is initially set to 0. If any of the events don’t use these they’ll always stay 0 otherwise they’ll be filled in with the default values for you to modify and return back to the game.
These variables are “%s_duration”, “%s_iconduration”, “%s_speed” where %s are the events listed above (like “fire”, “conc”, etc).
So, in Lua you’d have something like:
Code:
-- player_entity is guy getting conc’d
-- effector_entity is the one doing the conc’ing
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
Hopefully some of this helps.
|
Wiki link
Archive:
Quote:
Originally Posted by bridget
Does anyone know if there is or will be a LUA documentation specifically for FF? I'm in the dark for learning FF LUA because I don't know the callbacks, the variables, functions, and whatever built into FF. :/
I have tons of map/gametype ideas, but I can't put them together because I don't know FFLUA. Furthermore, I don't want to have to resort to asking other people constantly if they can write entire blocks of code for me. I'd like to be able to do it myself.
|
Last edited by Dr.Satan; 07-09-2009 at 03:50 PM.
|