From CryWiki
Lua Sample Walkthrough
You can add this code in any lua file. If you don't know which one, use scripts/main.lua
|
Lua (main.lua)
|
System.AddCCommand("feigndeath","ToggleFeignDeath()","Feign Death");
function ToggleFeignDeath()
-- Check if the global feigndeath var is available
-- If it's not: we need need to activate feign death
if feigndeath == nil or feigndeath == false then
feigndeath = true;
-- Activate ragdoll
g_localActor.actor:SetPhysicalizationProfile("ragdoll");
-- We need to set this or else the AI will still shoot you.
System.SetCVar("ai_IgnorePlayer",1);
-- Revive the player again.
else
feigndeath = false;
g_localActor.actor:Revive()
System.SetCVar("ai_IgnorePlayer",0);
end
end
|
|
Now you can type in 'feigndeath' in the console and the script will execute.
You can also bind this command to a key: type 'bind <key> feigndeath' in the console.
|
|
|
About this Sample
Name
- Simple feign death command
Created by
- ins
Description
- A simple feign death command. When you execute this, it will activate ragdoll and the AI will ignore you. Once you execute again, ragdoll gets disabled and the AI can see you again.
|
|
» Discuss this sample...
» View other Lua Samples
» Return to Crysis Modding Code Samples