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
53 | |||||
20 | |||||
13 | |||||
5 | |||||
5 | |||||
1 | |||||
1 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.845.944+25
- 2.843223.791+6
- 3.1103405.731+8
- 4.37659.864+22
- 5.943411.696-1
- 6.281108.722+32
- 7.308114.730+4
- 8.1156643.643+2
- 9.725441.622+3
- 10.10729.787+8
Replay highlight
VS
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Einhoven Country
Honor it
13
Download
1278
Board Info
370 users are online:
370 guests
0 post in the last 24h
14 posts in the last week
62 posts in the last month
14 posts in the last week
62 posts in the last month
Registered members: 50723
Welcome our newest member, sprunkiincredibox
Most online: 2043 users on 29 Oct 2023, 01:04 AM
Welcome our newest member, sprunkiincredibox
Most online: 2043 users on 29 Oct 2023, 01:04 AM