Login

russian armor

Remove retreat option

7 Jul 2015, 19:19 PM
#1
avatar of Stafkeh
Patrion 14

Posts: 1006

:wave:

I'd like to remove the retreat option for grenadiers in SCAR, any idea how this is possible? Couldn't find anything in Relic missions or in ScarDoc.
7 Jul 2015, 20:00 PM
#2
avatar of Contrivance

Posts: 165 | Subs: 2

Whether an SBP can retreat or not, and what type it uses (retreat or reverse), is controlled by an extension in the AE for that SBP. So if you're willing to make a tuning pack for this then that'd be the best course of action. I don't think it's possible to change a particular SBP's retreat type via SCAR, but EliwOOd would be the expert on that.
7 Jul 2015, 20:28 PM
#3
avatar of Stafkeh
Patrion 14

Posts: 1006

So if you're willing to make a tuning pack for this then that'd be the best course of action.


Its for a SP sccenario. Sorry, I should have mentioned this in my first post.
7 Jul 2015, 20:40 PM
#4
avatar of IronMedic

Posts: 318

there is an upgrade used in the tow mission "no retreat, no surrender" and will disable the ability to retreat for all units under the "upgraded" players command.
Use in "Mission_Start()"

player1 = World_GetPlayerAt(1)
Cmd_Upgrade(player1, BP_GetUpgradeBlueprint("order227"), 1, true)
7 Jul 2015, 21:06 PM
#5
avatar of Stafkeh
Patrion 14

Posts: 1006

there is an upgrade used in the tow mission "no retreat, no surrender" and will disable the ability to retreat for all units under the "upgraded" players command.
Use in "Mission_Start()"

player1 = World_GetPlayerAt(1)
Cmd_Upgrade(player1, BP_GetUpgradeBlueprint("order227"), 1, true)


Thanks. Once they completed an objective I'd like to remove this "Upgrade". How is this possible? I didn't find anything like remove upgrade.
7 Jul 2015, 21:19 PM
#6
avatar of IronMedic

Posts: 318

Should be something like this.


player1 = World_GetPlayerAt(1)
Player_RemoveUpgrade(player1, BP_GetUpgradeBlueprint("order227"))
7 Jul 2015, 22:05 PM
#7
avatar of Stafkeh
Patrion 14

Posts: 1006

Hmmm. Removing the order227 doesn't work like that, retreat option remains disabled.
7 Jul 2015, 22:25 PM
#8
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

The upgrade does a lot of other stuff, so for a pure SCAR approach, here is a function similar to existing Relic SCAR functions:

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)


Keep in mind that both methods enable/disable retreat for ALL of the player's units. There is no way to enable/disable for a specific unit in SCAR.
7 Jul 2015, 23:08 PM
#9
avatar of Stafkeh
Patrion 14

Posts: 1006


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::OnFatalScarError: [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
7 Jul 2015, 23:55 PM
#10
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

I'm not seeing any issues with my function, but I noticed you're missing the end to your BaseBuild function. I'll double check when I get home.
8 Jul 2015, 10:26 AM
#11
avatar of Stafkeh
Patrion 14

Posts: 1006

I didn't upload whole the function here. Maybe its better if I upload whole the code :)

http://pastebin.com/cNr1pyCZ

Line 47 Modify_Enable_PlayerIssueRetreat();
Line 53 Rule_AddOneShot(NoRetreat, 1)
Line 149 function Modify_Enable_PlayerIssueRetreat(playerid, value)
Line 162 Modify_Enable_PlayerIssueRetreat(player1, false)
Line 315 Modify_Enable_PlayerIssueRetreat(player1, true)
8 Jul 2015, 12:53 PM
#12
avatar of eliw00d
Honorary Member Badge

Posts: 756 | Subs: 8

Here is the problem:

-- Function call
Restriction();
InitializeObjectives();
Villageattack(); -- Call villageattack function
Modify_Enable_PlayerIssueRetreat();


In OnInit, you call the function without arguments. Hence the nil.
1 user is browsing this thread: 1 guest

Ladders Top 10

  • #
    Steam Alias
    W
    L
    %
    Streak
Data provided by Relic Relic Entertainment

Replay highlight

VS
  • U.S. Forces flag cblanco ★
  • The British Forces flag 보드카 중대
  • Oberkommando West flag VonManteuffel
  • Ostheer flag Heartless Jäger
uploaded by XXxxHeartlessxxXX

Board Info

518 users are online: 1 member and 517 guests
Makros
9 posts in the last 24h
39 posts in the last week
152 posts in the last month
Registered members: 45059
Welcome our newest member, mickreyt42
Most online: 2043 users on 29 Oct 2023, 01:04 AM