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
|   |   |   | 40 | ||
|   |   |   | 4 | ||
|   |   |   | 5 | ||
|   |   |   | 4 | ||
|   |   |   | 2 | ||
|   |   |   | 1 | 
Ladders Top 10
- 
							#Steam AliasWL%Streak
- 1.46467.874+6
- 2.794136.854-1
- 3.14465.689-1
- 4.21154.796+4
- 5.400212.654+2
- 6.353186.655+2
- 7.501325.607+4
- 8.298128.700-1
- 9.327117.736+4
- 10.857232.787+4
Replay highlight
VS
					- 
									 cblanco ★ cblanco ★
- 
									 보드카 중대 보드카 중대
- 
									 VonManteuffel VonManteuffel
- 
									 Heartless Jäger Heartless Jäger
 
											
						Einhoven Country
						
							
								
									 
								
								 
								
								
				 
								
								Honor it
								15
							
						
						
												
							
								
									 
								
								Download
								2705
							
						
												
					Board Info
						577 users are online:
									577 guests
					
		
			2 posts in the last 24h
2 posts in the last week
24 posts in the last month
		
		2 posts in the last week
24 posts in the last month
			
			
				Registered members: 61868
Welcome our newest member, topacinc
Most online: 4501 users on 26 Oct 2025, 01:00 AM
	Welcome our newest member, topacinc
Most online: 4501 users on 26 Oct 2025, 01:00 AM
 
	 
			 
			 
  
  
  
										 
									 
 
 
						 
						 
						 
						 
						 
						 Relic Entertainment
						 Relic Entertainment