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
8 | |||||
6 | |||||
3 | |||||
1 |
Ladders Top 10
-
#Steam AliasWL%Streak
- 1.831222.789+37
- 2.605218.735+1
- 3.34957.860+14
- 4.1109614.644+10
- 5.276108.719+27
- 6.305114.728+1
- 7.916405.693-2
- 8.722440.621+4
- 9.261137.656+2
- 10.1041674.607-2
Replay highlight
VS
- cblanco ★
- 보드카 중대
- VonManteuffel
- Heartless Jäger
Einhoven Country
Honor it
9
Download
1235
Board Info
870 users are online:
1 member and 869 guests
Jolliyastefan
Jolliyastefan
0 post in the last 24h
8 posts in the last week
34 posts in the last month
8 posts in the last week
34 posts in the last month
Registered members: 49108
Welcome our newest member, Jolliyastefan
Most online: 2043 users on 29 Oct 2023, 01:04 AM
Welcome our newest member, Jolliyastefan
Most online: 2043 users on 29 Oct 2023, 01:04 AM