Jump to content

Check state of mesh via script


Recommended Posts

I'm working with meshes that animate. I'm wondering if you can check the current state of a mesh via script? Specifically, I'm working with Harvest Containers and I'm curious if you can check to see which state the mesh is in--opened or closed? All via script.

Link to comment
Share on other sites

Maybe you can find something in this complete list of functions

 

I really doubt it. I think you need to set a variable when onactivate but the thing is, how to unset that variable later as that is the tricky part. You could check in gamemode if there is something added to the container and then unset that variable.

 

Maybe something like this??

Scn HarvetstContainer


short state
float timer
ref Item

Start OnActivate

	Set State to 1
	
end


Start GameMode

	If ( State == 0 )
		Return ; Do not waste fps... ;)
	Endif

	If ( Timer < 10 )
		Set Timer to Timer + getSecondsPassed
		return ; Quitting this script as fast as possible
	Else
		;GetItemCount <item>  ;  Or even better to use: GetInventoryObject 0 or 1
		Set Item to GetInventoryObject 1 ; (or 0 but it does not always work)
		
		If ( Item != 00000000 )
			;Do what you wanna do here
			;Do what you wanna do here
			;Do what you wanna do here
			;Do what you wanna do here
			
			Set State to 0
		Endif
		
		Set Timer to 0
	Endif
Endif

That bloody GetInventoryObject are tricky as it sometimes seems to pick itself -> the container, I use it twice if I use it and do something like this and also print the result to the console

Set Iem00 to GetInventoryObject 0
Set Iem01 to GetInventoryObject 1
Printc "Item00 = %i & Item01 = %i", Item00, Item01
Edited by Pellape
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...