| View previous topic :: View next topic | 
	
	
		| Author | Message | 
	
		| RedMaverickZero Three pointed, red disaster!
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 12 Jul 2003
 Posts: 1459
 
 
 | 
			
				|  Posted: Sun Sep 17, 2006 3:59 pm    Post subject: Level Up Boosts |   |  
				| 
 |  
				| I'm working on this script for my game, where upon every level up, if the hero has a certain item equipped they gain a boost in a specific stat. Well, the script I have was working good, but then I realized it did it's effects after every single battle. I was wondering if somebody could help me alter my script so it accomodates this idea. 
 
  	  | Code: |  	  | if(check equipment(findhero(hero:Mark),5)==30) then(Add to Stat (hero:Mark,stat:Strength,random(1,3)))
 | 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| TwinHamster ♫ Furious souls, burn eternally! ♫
 
 
 
  
 Joined: 07 Mar 2004
 Posts: 1352
 
 
 | 
			
				|  Posted: Sun Sep 17, 2006 4:18 pm    Post subject: |   |  
				| 
 |  
				| I'm not sure if you've tried this yet, but it would probably help if you added: 
 
 Before Battle:
 
 
  	  | Code: |  	  | set variable (Old level, getherolevel(hero:Mark))
 
 | 
 
 *FYTE
 
 After Battle:
 
 
  	  | Code: |  	  | if(
 Old Level<<get hero level (hero:Mark)
 )
 then(
 
 if(check equipment(findhero(hero:Mark),5)==30)
 then(Add to Stat (hero:Mark,stat:Strength,random(1,3)))
 
 )
 
 | 
 
 So basically, if the hero's level after a battle is higher than it is before the battle, he'll get the armour's stat bonus.
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Moogle1 Scourge of the Seas
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 15 Jul 2004
 Posts: 3377
 Location: Seattle, WA
 
 | 
			
				|  Posted: Sun Sep 17, 2006 5:08 pm    Post subject: |   |  
				| 
 |  
				| That may work, but I'm also pretty sure there's a new command that asks if a hero has gained a level during the last battle, which would be even easier. _________________
 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| TwinHamster ♫ Furious souls, burn eternally! ♫
 
 
 
  
 Joined: 07 Mar 2004
 Posts: 1352
 
 
 | 
			
				|  Posted: Sun Sep 17, 2006 5:46 pm    Post subject: |   |  
				| 
 |  
				| Oh yeah! I believe you're talking about 'heroleveled' 
 So the after battle script would be:
 
 
  	  | Code: |  	  | 
 if(heroleveled(hero:Mark)>>0)
 then(
 if(check equipment(findhero(hero:Mark),5)==30)
 then(Add to Stat (hero:Mark,stat:Strength,random(1,3)))
 )
 | 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| RedMaverickZero Three pointed, red disaster!
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 12 Jul 2003
 Posts: 1459
 
 
 | 
			
				|  Posted: Sun Sep 17, 2006 5:54 pm    Post subject: |   |  
				| 
 |  
				| OH! Will that automatically update each time the hero levels up? (Thanks by the way) |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| Camdog 
 
 
 
 Joined: 08 Aug 2003
 Posts: 606
 
 
 | 
			
				|  Posted: Sun Sep 17, 2006 5:55 pm    Post subject: |   |  
				| 
 |  
				| Bear in mind that herolevelled returns the number of levels a hero gained after an encounter (or a give experience command).  Therefore, you must take into account the possibility of a hero gaining more than one level in an encounter, so you'd probably want something more like this: 
 
  	  | Code: |  	  | variable(loop) levelCount := herolevelled(hero:Mark)
 
 for(loop, 1, levelCount) do(
 add to stat (hero:Mark,stat:Strength,random(1,3))
 )
 | 
 |  | 
	
		| Back to top |  | 
	
		|  | 
	
		| RedMaverickZero Three pointed, red disaster!
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 12 Jul 2003
 Posts: 1459
 
 
 | 
			
				|  Posted: Sun Sep 17, 2006 6:36 pm    Post subject: |   |  
				| 
 |  
				| That one line of code saved my tail. Thanks you guys for helping. |  | 
	
		| Back to top |  | 
	
		|  | 
	
		|  |