Bes 
 
 
		
		
		
			
			
			
 
 
			
Posts: 5453 
	
		
	 | 
	
		
			
			 
			
				Katarina, можно... вопрос лишь упрётся в смену описания... 
если очень горит, постараюсь нарыть тот самый кусок кода, который когда-то создал Дьякон для Гавани
			 
			
			
			
		 |  
	 
 | 
	| 01.08.2014 17:18 | 
	
		
	 | 
	
		
		Katarina 
 
 
		
		
		
			
			
			 
			
Posts: 37 
	
		
	 | 
	
		
			
			 
			
				Не к спеху, но если что-то есть - было бы неплохо.
			 
			
			
			
		 |  
	 
 | 
	| 01.08.2014 19:15 | 
	
		
	 | 
	
		
		igrik 
 
 
		
		
		
			
			
			
 
 
			
Posts: 2821 
	
		
	 | 
	
		
			
			 
			
				Первый раз использую эровские переменные типа  !!SN:W^[моя_переменная]^/0; Не перенамудрил ли я? Можно ли данный код сделать короче чтоле, но не используя функций и переменных типа " v" и флагов, т.е. максимально непересекаемо с другими скриптами и модами. 
Скрипт - при нападении на нейтралов, оковы войны не действуют, и герой может сбежать
 
			 
			
			
  
game bug fixes extended.dll  ||  My Plugins  ||  My GitHub
			
				
(This post was last modified: 13.08.2014 02:03 by igrik.)
 
			 
		 |  
	 
 | 
	| 13.08.2014 01:50 | 
	
		
	 | 
	
		
		Algor 
 
 
		
		
		
			
			
 
 
			
 
 
			
Posts: 3883 
	
		
	 | 
	
		
			
			 
			
				 (13.08.2014 01:50)igrik Wrote:  Не перенамудрил ли я? Можно ли данный код сделать короче чтоле, но не используя функций и переменных типа "v" и флагов, т.е. максимально непересекаемо с другими скриптами и модами. 
Перенамудрил. Можно.
 
			 
			
			
  
			
		 |  
	 
 | 
	| 13.08.2014 03:10 | 
	
		
	 | 
	
		
		igrik 
 
 
		
		
		
			
			
			
 
 
			
Posts: 2821 
	
		
	 | 
	
		
 | 
	| 13.08.2014 10:30 | 
	
		
	 | 
	
		
		igrik 
 
 
		
		
		
			
			
			
 
 
			
Posts: 2821 
	
		
	 | 
	
		
 | 
	| 13.08.2014 14:17 | 
	
		
	 | 
	
		
		Valery 
 
 
		
		
		
			
			
			
 
 
			
Posts: 2196 
	
		
	 | 
	
		
			
			 
			
				Prisons in random maps are a plague. So far I have a script removing them but the reset of the hero levels/stats/skills is more complicate.  
 
I need to make an ini file (like the one from call to arms), set inside all heroes initial levels then read from it values. Can anyone give me a clue how those ini files are made? A short example will help me to understand, thanks.
			 
			
			
			
		 |  
	 
 | 
	| 18.08.2014 02:14 | 
	
		
	 | 
	
		
		Bes 
 
 
		
		
		
			
			
			
 
 
			
Posts: 5453 
	
		
	 | 
	
		
			
			 
			
				for example,restore defaul sex hero... 
ini file looks as...
 
Code: 
 [defaultsex] 
0=0 
1=1 
2=0 
3=1 
4=0 
... 
152=0 
153=1 
154=0
  
			 
			
			
			
		 |  
	 
 | 
	| 18.08.2014 11:40 | 
	
		
	 | 
	
		
		Valery 
 
 
		
		
		
			
			
			
 
 
			
Posts: 2196 
	
		
	 | 
	
		
			
			 
			
				bes, and how to make writable options into ini file, is possible? 
 
For example player can set in ini file if script will run: 
 
[player options] 
Remove relics: 0 (will not) / 1 (will do) 
 
Or must be like this? 
 
[player options] 
;remove relics 0/no, 1/yes 
0=0
			 
			
			
			
				
(This post was last modified: 19.08.2014 02:17 by Valery.)
 
			 
		 |  
	 
 | 
	| 19.08.2014 02:15 | 
	
		
	 | 
	
		
		Berserker 
 
 
		
		
		
			
			
 
 
			
 
 
			
Posts: 16788 
	
		
	 | 
	
		
			
			 
			
				
Code: 
 [player options] 
Remove relics=1
  
era.dll 
function  ReadStrFromIni (Key, SectionName, FilePath, Res: pchar): boolean; stdcall; 
function  WriteStrToIni (Key, Value, SectionName, FilePath: pchar): boolean; stdcall;
 
Just don't forget that writable ini should be placed in real Data/Maps/etc folder, not in mods one. If you are planning to use ini only for reading then you can place it in Mods\ModName folder.
			  
			
			
  
Скачать Герои 3 Эра и всё, что с ней связано / ERA 2.46f для старых модов 
Поддержать проект 
			
		 |  
	 
 | 
	| 19.08.2014 12:04 | 
	
		
	 | 
	
		
		Bes 
 
 
		
		
		
			
			
			
 
 
			
Posts: 5453 
	
		
	 | 
	
		
			
			 
			
				
Code: 
 [Player options] 
;remove relics 0/no, 1/yes 
77=0
  
имхо, нет нужды вводить текстовые параметры в секциях (в частном случае), ибо и числовыми вполне можно обозначить всё что угодно... тем более запись в ini через UN:N5 короче в плане кода, чем через ERA-команды
			  
			
			
			
		 |  
	 
 | 
	| 19.08.2014 13:18 | 
	
		
	 | 
	
		
		Valery 
 
 
		
		
		
			
			
			
 
 
			
Posts: 2196 
	
		
	 | 
	
		
			
			 
			
				Ok, made my first ini and is working. But as I have no clue how it works, I must ask: is there anything more to add? On reload game, on instructions, PI? Is this OK? 
if I use same word more than once in ini, will the code read the correct one?
 
Ini file
 
Code: 
 [Player settings] 
 
;The pillars will replace the objects listed below. Change values between 0 and 10 to set your custom replacement ratio for each object. (0=none, 10=maximum) 
 
Den of Thieves=10 
Learning Stones=10 
Creature Banks=0 
Crypts=0 
Schools of Magic=0 
Creature Generators=10 
Taverns=10 
Obelisks=3 
Prisons=10 
 
;The following value will automatically activate/deactivate (0/OFF, 1/ON) the watcher for all the game length. The watcher allows to the player to know what the other pillars offer.  
;The premonition lasts 7 days. If option is off, the player will have to find the watcher by his own. Default value is off. 
 
Watcher=1
  
Script:
 
Once the ini made, I had to delete the previous erm code which went through each option. Economized 300 script lines!
			  
			
			
			
				
(This post was last modified: 20.08.2014 00:40 by Valery.)
 
			 
		 |  
	 
 | 
	| 19.08.2014 21:30 | 
	
		
	 | 
	
		
		Berserker 
 
 
		
		
		
			
			
 
 
			
 
 
			
Posts: 16788 
	
		
	 | 
	
		
 | 
	| 20.08.2014 00:53 | 
	
		
	 | 
	
		
		Valery 
 
 
		
		
		
			
			
			
 
 
			
Posts: 2196 
	
		
	 | 
	
		
			
			 
			
				Ok for v1. Without the slash, the ini file isn't found if in Mod folder. I don't want it in data folder, for easier location, players are lazy..
			 
			
			
			
		 |  
	 
 | 
	| 20.08.2014 00:56 | 
	
		
	 |