HasPolicy: Difference between revisions

From Civilization Modding Wiki
Jump to navigationJump to search
(Created page with "==Description== Returns true if a player has a specified policy. ==Example== function hasPolicy(pPlayer, policyType) for policy in GameInfo.Policies() do if policy.Type ...")
 
No edit summary
 
Line 5: Line 5:
   for policy in GameInfo.Policies() do
   for policy in GameInfo.Policies() do
   if policy.Type == policyType then
   if policy.Type == policyType then
   return pPlayer:HasPolicy(policy.ID);
   return pPlayer:'''''HasPolicy'''''(policy.ID);
   end
   end
   end
   end
   return false;
   return false;
   end
   end

Latest revision as of 04:58, 17 February 2012

Description

Returns true if a player has a specified policy.

Example

 function hasPolicy(pPlayer, policyType)
 	for policy in GameInfo.Policies() do
 		if policy.Type == policyType then
 			return pPlayer:HasPolicy(policy.ID);
 		end
 	end
 	return false;
 end