| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| captain whatthehell Guest
 
 
 
 
 
 
 
 | 
			
				|  Posted: Thu Jan 20, 2005 4:47 pm    Post subject: Life counter... |   |  
				| 
 |  
				| I need a script that has a variable (like 100 or 1000) and can be decremented whenever an "enemy NPC" touches you. When the varaible hits zero the game runs a gameover script... How whould that be set up??? |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Guest 
 
 
 
 
 
 
 
 | 
			
				|  Posted: Thu Jan 20, 2005 4:49 pm    Post subject: |   |  
				| 
 |  
				| kind of like what was on smokey magoo??? |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| RPGCreations E Pluribus Unum
 
 
 
  
 Joined: 18 May 2003
 Posts: 345
 
 
 | 
			
				|  Posted: Thu Jan 20, 2005 6:13 pm    Post subject: |   |  
				| 
 |  
				| on mapload, define a global variable. 
 Now, have the NPC activated to touch, and have it run a script that does
 
 set global variable ( globvar , globvar -- 1 )
 
 you can also do the check for the gameover in that too, if you want.
 _________________
 
  |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| msw188 
 
 
 
 Joined: 02 Jul 2003
 Posts: 1041
 
 
 | 
			
				|  Posted: Fri Jan 21, 2005 11:44 am    Post subject: |   |  
				| 
 |  
				| I don't think that you can define global variables within a script.  You define them in the master script text file (otherwise you would be trying to redefine the global variable everytime the script is called - not good).  The rest of RPGCreation's looks good.  I'd also like to point out that an NPC calling a script sends it two arguments, which you might be able to use.  The first is defined by you in Custom in the 'Edit NPC' menu in the Map Editor.  This might allow you to make certain NPCs decrease the global variable more than others.  The second is an automatic argument that is a reference to the NPC that called the script.  Very useful if you want something to happen to the NPC when it touches you. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |