Jump to content

Recommended Posts

Posted
	self.e = 0
	function Loading() -- Hook Load Map.
			--local camera = worldMars:FindEntity("Camera")
			--camera:Hide()
		
			while self.e < worldMars:GetCurrent():CountEntities()  do
				if Wind:IsClosed() then return( false )   end
				App:Update()
				self.e = self.e + 1
			

				Context:GetCurrent():DrawRect(0,0,Context:GetCurrent():GetWidth(),Context:GetCurrent():GetHeight())
				Context:GetCurrent():Sync()
			
			end
	end

Why is it that there are commands that are not officially documented? As in this case, find the total number of entities that a world has.

 

CountEntities()

Is there any place where I can see those commands that may not exist due to lack of documentation?

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Posted
CountEntities()

Another issue is that this command when one loads a map with a terrain depending on the size of the map returns more or less entities on the map.  

 

https://media2.giphy.com/media/3o72F7YT6s0EMFI0Za/200.gif

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Posted
	self.e = 0
	function Loading()

		
			while self.e < worldMars:GetCurrent():CountEntities()/1025.0  do
				if Wind:IsClosed() then return( false )   end
				App:Update()
				self.e = self.e + 1 * Time:GetSpeed()
				
			
				

				self.context:DrawRect(0,0,Context:GetCurrent():GetWidth(),Context:GetCurrent():GetHeight())
				Wind:Update()
			
			end
	end

A 2048 x 2048 map returns 1025 entities with the count command in the world. Then the system evaluates all these entities on the hook when loading the map. The solution is that knowing that data is divided and the count would be in relation to the entities that actually exist on the map. Although this value can be manipulated so that for example in the case of loading only three entities on the map, we can simulate an animation in a time that suits our taste.

Always something new to learn. 

Translated with www.DeepL.com/Translator (free version)

 

 

Astrocuco.thumb.png.c76e0fb3de2d6e437e7dca099625e11e.png

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...