| 
			
				|  | Castle Paradox 
 
 |  
 
	
		| View previous topic :: View next topic |  
		| Author | Message |  
		| Awful Waffle 
 
 
 
 Joined: 18 Jun 2003
 Posts: 73
 Location: Canada
 
 | 
			
				|  Posted: Thu Mar 29, 2007 11:19 pm    Post subject: SetHeroStat problem |   |  
				| 
 |  
				| The stat changes I make to a hero in my game using SetHeroStat seem to be over-written when I level-up or equip an item that changes stats.  It reverts the stats back to their "base course" that the min and max determine I set in custom.exe, and then calculates the offset of the item or level, but not the changes with SetHeroStat.  The exception is with "HP" and "MP" which work just fine. 
 I got over the problem of stats resetting when I level by using the "after-battle" event, but the problem is now when I make equipment changes.
 
 Hero X has 15 STR, and 5 added through script to make it 20.  When I equip a weapon that adds 3 STR, it calculates from base stat of 15, and + 3 to make it 18, when it should be 23 in the end.
 
 Hero is how i'm altering stats...
 
 
  	  | Code: |  	  | setHeroStat(findHero(hero: hero), stat:str, getHeroStat(findHero(hero: hero), stat:str, currentStat) + 5, currentStat)
 
 | 
 
 Is there a way to have SetHeroStat imbedded into the hero's stats?  Possibly without using a +/- stat changing item for every case? lol
 |  |  
		| Back to top |  |  
		|  |  
		| Moogle1 Scourge of the Seas
 Halloween 2006 Creativity Winner
 
  
 
  
 Joined: 15 Jul 2004
 Posts: 3377
 Location: Seattle, WA
 
 | 
			
				|  Posted: Fri Mar 30, 2007 6:53 am    Post subject: |   |  
				| 
 |  
				| You should set both the current stat and the maximum stat. _________________
 
 |  |  
		| Back to top |  |  
		|  |  
		| Bob the Hamster OHRRPGCE Developer
 
 
 
  
 Joined: 22 Feb 2003
 Posts: 2526
 Location: Hamster Republic (Southern California Enclave)
 
 | 
			
				|  Posted: Fri Mar 30, 2007 6:57 am    Post subject: |   |  
				| 
 |  
				| Here is what you need to do: 
 
  	  | Code: |  	  | setHeroStat(findHero(hero: hero), stat:str, getHeroStat(findHero(hero: hero), stat:str, currentStat) + 5, currentStat)
 setHeroStat(findHero(hero: hero), stat:str, getHeroStat(findHero(hero: hero), stat:str, maximumStat) + 5, maximumStat)
 
 | 
 
 if you want the changes to persist, you need to change both currentstat and maximumstat
 
 ...although I would probably write it like this myself:
 
 
  	  | Code: |  	  | script, increase stat, who, whichstat, amount, begin
 setHeroStat(who, whichstat, getHeroStat(who, whichstat, currentStat) + amount, currentStat)
 setHeroStat(who, whichstat, getHeroStat(who, whichstat, maximumStat) + amount, maximumStat)
 end
 
 | 
 
 and then you could use that as:
 
 
  	  | Code: |  	  | increase stat(find hero(hero:hero), stat:str, 5)
 
 | 
 |  |  
		| Back to top |  |  
		|  |  
		| Awful Waffle 
 
 
 
 Joined: 18 Jun 2003
 Posts: 73
 Location: Canada
 
 | 
			
				|  Posted: Fri Mar 30, 2007 9:47 am    Post subject: |   |  
				| 
 |  
				| Awesome thanks! 
 I had tried setting both current and max before, just never both at the same time
  |  |  
		| Back to top |  |  
		|  |  
		|  |  
  
	| 
 
 | You can post new topics in this forum You can reply to topics in this forum
 You cannot edit your posts in this forum
 You cannot delete your posts in this forum
 You cannot vote in polls in this forum
 
 |  
 Powered by phpBB © 2001, 2005 phpBB Group
 
 
 |