function Modify_Enable_PlayerIssueRetreat(playerid, value)
if value == true then
value = 1
elseif value == false then
value = 0
end
-- create the appropriate modifier
local modifier = Modifier_Create(MAT_Player, "modifiers\\enable_player_issue_retreat.lua", MUT_Enable, false, value, "")
Modifier_ApplyToPlayer( modifier, playerid )
end
Example of use:
Modify_Enable_PlayerIssueRetreat(player1, true)
I tried using this, but it gives me a Fatal error.
SCAR ERROR Callstack:
C [C] Ln -1 (Modifier_Create)
Lua test.scar"] Ln 337 (Modify_Enable_PlayerIssueRetreat)
Lua test.scar"] Ln 47 (OnInit)
GameObj:nFatalScarError: [Invalid parameter 5 (type expected=float, received=nil) in function Modifier_Create
Lua test.scar"] Ln 337 (Modify_Enable_PlayerIssueRetreat)
Lua test.scar"] Ln 47 (OnInit)
]
function Modify_Enable_PlayerIssueRetreat(playerid, value)
if value == true then
value = 1
elseif value == false then
value = 0
end
-- Create the appropriate modifier
local modifier = Modifier_Create(MAT_Player, "modifiers\\enable_player_issue_retreat.lua", MUT_Enable, false, value, "")
Modifier_ApplyToPlayer(modifier, playerid)
end
function BaseBuild()
Modify_Enable_PlayerIssueRetreat(player1, true)
Camera_MoveTo(mkr_camerabase, true, SLOW_CAMERA_PANNING, true, true);
Game_FadeToBlack(FADE_OUT, 0)
EGroup_DeSpawn(firstbase);
Rule_AddOneShot(OBJ_Farm_Mission, 2);
Rule_AddOneShot(CP_Meter, 1)
Rule_AddOneShot(BaseStart, 1)
Rule_AddOneShot(NoRetreat, 1)
function NoRetreat()
Modify_Enable_PlayerIssueRetreat(player1, false)
end