My problem is I created a custom Win Condition to edit the AI Resource Bonus and Camera Zoom.
I followed the parameters of a few other posts and I get a Fatal SCAR Error.
I tried the mod as it was created and the game ran fine. Once I put in the code, the game is frozen
at the beginning of a match and I get the message.
The two codes are:
Help is always appreciated.
[HELP] AI Resource and Camera Zoom Error
4 Sep 2017, 10:53 AM
#1

Posts: 59
4 Sep 2017, 17:58 PM
#2


Posts: 817 | Subs: 5
I don't have experience with Win Conditions and SCAR, but I have experience with many other programming languages so I will try to help you.
It seems that the function which you use requires a 'float' parameter which is a decimal number, like 0,0 instead of just 0. The 'received=nil' means that you gave to few values or a variable without value.
The second code might freeze because there's an 'end' missing. I see 1 function, 1 for-loop and 3 if-blocks, but only 4 end.
It seems that the function which you use requires a 'float' parameter which is a decimal number, like 0,0 instead of just 0. The 'received=nil' means that you gave to few values or a variable without value.
The second code might freeze because there's an 'end' missing. I see 1 function, 1 for-loop and 3 if-blocks, but only 4 end.
4 Sep 2017, 21:09 PM
#3

Posts: 59
Appreciate the help.
My experience is very limited as well. I followed the Tutorials provided by Eliwood on his Youtube Channel. I followed his example, but I get this error. I have looked up the ScarDoc to make sense of it, but Lua is a very new thing to me.
My experience is very limited as well. I followed the Tutorials provided by Eliwood on his Youtube Channel. I followed his example, but I get this error. I have looked up the ScarDoc to make sense of it, but Lua is a very new thing to me.
4 Sep 2017, 21:34 PM
#4

Posts: 59
Ok, I got the camera function to work. Now I need to work on the AI Resource code. You stated
I see 1 function, 1 for-loop and 3 if-blocks, but only 4 end.At where do you think I should put the "end"?
-- My Stuff: ------------------------------------------------------------------
for p = 1, World_GetPlayerCount() do -- iterate over all the players
local player = World_GetPlayerAt(p) -- get more information about this player
if (AI_IsAIPlayer(player)) then
if (AI_GetDifficulty(player)==AD_Hard) then
Modify_PlayerResourceRate(player,RT_Manpower,0.67,MUT_Multiplication)
Modify_PlayerResourceRate(player,RT_Munition,0.67,MUT_Multiplication)
Modify_PlayerResourceRate(player,RT_Fuel,0.67,MUT_Multiplication)
end
if (AI_GetDifficulty(player)==AD_Hardest) then
Modify_PlayerResourceRate(player,RT_Manpower,0.5,MUT_Multiplication)
Modify_PlayerResourceRate(player,RT_Munition,0.5,MUT_Multiplication)
Modify_PlayerResourceRate(player,RT_Fuel,0.5,MUT_Multiplication)
end
end -- loop over all the players
-- End of My Stuff. ----------------------------------------------------------
4 Sep 2017, 22:04 PM
#5

Posts: 59
Ok, I adjusted a few things. I got the the game to run and looked into the Warnings.log and there were no errors. YAY
Now, I'm not sure if the AI Resource Bonus code I input is working. I watched a replay and it "seems" to work need to look into it further.
If you or someone could look into the code to verify all my ducks are in a row. That would be much appreciated.
Now, I'm not sure if the AI Resource Bonus code I input is working. I watched a replay and it "seems" to work need to look into it further.
If you or someone could look into the code to verify all my ducks are in a row. That would be much appreciated.
local function WinCondition_Init()
for p = 1, World_GetPlayerCount()
do -- iterate over all the players
local player = World_GetPlayerAt(p) -- get more information about this player
if (AI_IsAIPlayer(player)) then
end
if (AI_GetDifficulty(player)==AD_Hard) then
Modify_PlayerResourceRate(player,RT_Manpower,0.67,MUT_Multiplication)
Modify_PlayerResourceRate(player,RT_Munition,0.67,MUT_Multiplication)
Modify_PlayerResourceRate(player,RT_Fuel,0.67,MUT_Multiplication)
end
if (AI_GetDifficulty(player)==AD_Hardest) then
Modify_PlayerResourceRate(player,RT_Manpower,0.5,MUT_Multiplication)
Modify_PlayerResourceRate(player,RT_Munition,0.5,MUT_Multiplication)
Modify_PlayerResourceRate(player,RT_Fuel,0.5,MUT_Multiplication)
end
end -- loop over all the players
local distMin = 3;
local distMax = 75;
Camera_SetTuningValue(TV_DistMin, 3);
Camera_SetTuningValue(TV_DistMax, distMax);
Camera_SetZoomDist(50);
Rule_AddInterval(WinCondition_Check, 3)
end
Scar_AddInit(WinCondition_Init)
PAGES (1)

1 user is browsing this thread:
1 guest
Livestreams
![]() |
![]() |
![]() |
156 | ||
![]() |
![]() |
![]() |
99 | ||
![]() |
![]() |
![]() |
37 | ||
![]() |
![]() |
![]() |
11 | ||
![]() |
![]() |
![]() |
32 | ||
![]() |
![]() |
![]() |
13 | ||
![]() |
![]() |
![]() |
10 | ||
![]() |
![]() |
![]() |
4 | ||
![]() |
![]() |
![]() |
4 | ||
![]() |
![]() |
![]() |
1 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.43965.871+3
- 2.5416.771+1
- 3.447154.744+9
- 4.710249.740+2
- 5.315119.726+11
- 6.10551.673-3
- 7.675104.866-1
- 8.318169.653+1
- 9.10929.790+10
- 10.19665.751+9
Replay highlight
VS
-
cblanco ★
-
보드카 중대
-
VonManteuffel
-
Heartless Jäger

Einhoven Country

Honor it
15

Download
1444
Board Info
428 users are online:
428 guests
0 post in the last 24h
4 posts in the last week
24 posts in the last month
4 posts in the last week
24 posts in the last month
Registered members: 56532
Welcome our newest member, Gavig539
Most online: 2043 users on 29 Oct 2023, 01:04 AM
Welcome our newest member, Gavig539
Most online: 2043 users on 29 Oct 2023, 01:04 AM