Jump to content

.ini to area script conversion


Recommended Posts

OK, gots me a virgin patched TOB install, and a TotL install, and I'm running the IWD to BG2 conversion now.

 

In other words, I'm ready to start work.

 

I've got this sinking feeling that the questions I have are going to sound terribly bone-headed, and I know that after I get started, it will be fine, but I do need to ask the questions to get started.

 

I've never looked under the hood for IWD, so I'm not terribly familiar with accessing the .ini files that need conversion. Where are they?

 

Also, is there any particular variable format you prefer?

Link to comment

If you open up IWD with NI, there'll be an ini section; they'll be named like areas (i.e. ar2100.ini). Now, I'm not entirely sure what the bits at the top of the ini file do--time between spawns, but outside of that, it's a bit speculative. The creature entries, OTOH:

 

[Umber01]
spec					= [255.0.0.0.101]
spec_var				= TARNEL_HULK_SPAWN_1
cre_file				= Umberhlk
script_race			 = uhGaze
script_default		  = gnMMgFG
ai_specifics			= 101
ignore_can_see		  = 1
spawn_point			 = [1800.0805:0]

When the TARNEL_HULK_SPAWN_1 global variable is 1 (or perhaps just not zero), spawn umberhlk.cre at coordinates 1800.805 facing south (0) with the default script gnmmgfg and race script uhgaze. Ignore_can_see and ai_specifics are kinda a guess--the former is probably whether it can see invisible or perhaps spawns invisible (?); the latter just seems to just be a unique value. The spec is just the generic scripting identifier [EA.GENERAL.RACE.CLASS.SPECIFIC.GENDER.ALIGN]. In this case, EA=255 (enemy) and SPECIFIC is 101.

 

As far as I can tell, the ini files are supposed to continuously spawn. In the case of something like ar8003.ini, which has no timer, as soon as you kill one of the umber hulks a new one appears instantly as long as the variable is still set. If there's a timer in the top of the file, I think it delays spawning a replacement creature by that time.

Link to comment
If you open up IWD with NI, there'll be an ini section; they'll be named like areas (i.e. ar2100.ini). Now, I'm not entirely sure what the bits at the top of the ini file do--time between spawns, but outside of that, it's a bit speculative.

The INIs appear to be divided into three sections. The first, [spawn_main] appears to break down spawns into "on entry" and "on event". The next section contains headings corresponding to the right hand sides of the [spawn_main] entries. These blocks contain a list of creatures and a respawn interval (which probably doesn't matter for "enter" spawns--it's normally 1). Finally, we have the lists of creatures corresponding to the entries in the second section. The properties of these creatures are more or less obvious. I think respawning ALWAYS requires that you kill the original creature first, and where there's no timer this simply happens instantly rather than waiting for the next respawn cycle. I suspect partial respawns are also possible, so if you kill some creatures but not others the ones you've killed will reappear, requiring a separate block for every creature in the list.

Link to comment

This might actually require some unique creatures. There are a lot of cases where we spawn several of the same CRE file and then assign each incidence different properties (specifics, death variable), which in my experience won't work through script (if you try and do it by action ordering you still end up reassigning the same creature's DV about 5 times).

Link to comment

OK, this is what I've come up with. There's an INTERVAL specified at the top of the file, so I'm guessing that's the wait between the death of the first creature and the spawning of the replacement. I realize that I'm going to have to set the DVs and override scripts for these creatures. Not a biggie, that's tp2 stuff.

 

I'm posting this code block to see if I'm as much on the same page as you guys as I think I am.

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear1","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR1",[0052.2067],12)
SetGlobal("Bear1","AR2100",1)
END

IF
 Dead("kuBear1")
 Global("Bear1","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear1T","GLOBAL",ONE_HOUR)
SetGlobal("Bear1","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear1T","GLOBAL")
 Global("Bear1","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear1","AR2100",0)
END

 

If this is the case, this shouldn't take too long.

 

For example, this would be the area script additions for AR2100:

/* [locals]

[spawn_main]
events=1_HOUR

[1_HOUR]
critters=Bear1,Bear2,Bear3,Bear4,Bear5,Bear6,Bear7,Bear8
interval=54000 */

/* [Bear1]
spec					= [255.0.0.0.101]
spec_var				= KULDAHAR_ALARM
cre_file				= KUBEAR
script_default		  = kuBear
ai_specifics			= 101
spawn_point			 = [0052.2067:12] */

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear1","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR1",[0052.2067],12)
SetGlobal("Bear1","AR2100",1)
END

IF
 Dead("kuBear1")
 Global("Bear1","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear1T","GLOBAL",ONE_HOUR)
SetGlobal("Bear1","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear1T","GLOBAL")
 Global("Bear1","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear1","AR2100",0)
END

/* [Bear2]
spec					= [255.0.0.0.102]
spec_var				= KULDAHAR_ALARM
cre_file				= KUBEAR
script_default		  = kuBear
ai_specifics			= 102
spawn_point			 = [0047.2124:12] */

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear2","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR2",[0047.2124],12)
SetGlobal("Bear2","AR2100",1)
END

IF
 Dead("kuBear2")
 Global("Bear2","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear2T","GLOBAL",ONE_HOUR)
SetGlobal("Bear2","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear2T","GLOBAL")
 Global("Bear2","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear2","AR2100",0)
END

/* [Bear3]
spec					= [255.0.0.0.103]
spec_var				= KULDAHAR_ALARM
cre_file				= KUBEAR
script_default		  = kuBear
ai_specifics			= 103
spawn_point			 = [0045.2358:12] */

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear3","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR3",[0045.2358],12)
SetGlobal("Bear3","AR2100",1)
END

IF
 Dead("kuBear3")
 Global("Bear3","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear3T","GLOBAL",ONE_HOUR)
SetGlobal("Bear3","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear3T","GLOBAL")
 Global("Bear3","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear3","AR2100",0)
END

/* [Bear4]
spec					= [255.0.0.0.104]
spec_var				= KULDAHAR_ALARM
cre_file				= KUBEAR
script_default		  = kuBear
ai_specifics			= 104
spawn_point			 = [3227.2185:8] */

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear4","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR4",[3227.2185],8)
SetGlobal("Bear4","AR2100",1)
END

IF
 Dead("kuBear4")
 Global("Bear4","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear4T","GLOBAL",ONE_HOUR)
SetGlobal("Bear4","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear4T","GLOBAL")
 Global("Bear4","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear4","AR2100",0)
END

/* [Bear5]
spec					= [255.0.0.0.105]
spec_var				= KULDAHAR_ALARM
cre_file				= KUBEAR
script_default		  = kuBear
ai_specifics			= 105
spawn_point			 = [3567.1165:2] */

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear5","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR5",[3567.1165],2)
SetGlobal("Bear5","AR2100",1)
END

IF
 Dead("kuBear5")
 Global("Bear5","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear5T","GLOBAL",ONE_HOUR)
SetGlobal("Bear5","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear5T","GLOBAL")
 Global("Bear5","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear5","AR2100",0)
END

/* [Bear6]
spec					= [255.0.0.0.106]
spec_var				= KULDAHAR_ALARM
cre_file				= KUBEAR
script_default		  = kuBear
ai_specifics			= 106
spawn_point			 = [1896.0346:0] */

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear6","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR6",[1896.0346],0)
SetGlobal("Bear6","AR2100",1)
END

IF
 Dead("kuBear6")
 Global("Bear6","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear6T","GLOBAL",ONE_HOUR)
SetGlobal("Bear6","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear6T","GLOBAL")
 Global("Bear6","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear6","AR2100",0)
END

/* [Bear7]
spec					= [255.0.0.0.107]
spec_var				= KULDAHAR_ALARM
cre_file				= KUBEAR
script_default		  = kuBear
ai_specifics			= 107
spawn_point			 = [0791.1180:0] */

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear7","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR7",[0791.1180],0)
SetGlobal("Bear7","AR2100",1)
END

IF
 Dead("kuBear7")
 Global("Bear7","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear7T","GLOBAL",ONE_HOUR)
SetGlobal("Bear7","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear7T","GLOBAL")
 Global("Bear7","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear7","AR2100",0)
END

/* [Bear8]
spec					= [255.0.0.0.108]
spec_var				= KULDAHAR_ALARM
cre_file				= KUBEAR
script_default		  = kuBear
ai_specifics			= 108
spawn_point			 = [0671.1185:0] */

IF
 Global("KULDAHAR_ALARM","GLOBAL",1)
 Global("Bear8","AR2100",0)
THEN
 RESPONSE #100
CreateCreature("KUBEAR8",[0671.1185],0)
SetGlobal("Bear8","AR2100",1)
END

IF
 Dead("kuBear8")
 Global("Bear8","AR2100",1)
THEN
 RESPONSE #100
SetGlobalTimer("kuBear8T","GLOBAL",ONE_HOUR)
SetGlobal("Bear8","AR2100",2)
END

IF 
 GlobalTimerExpired("kuBear8T","GLOBAL")
 Global("Bear8","AR2100",2)
THEN
 RESPONSE #100
SetGlobal("Bear8","AR2100",0)
END

 

And this would need to go in the tp2:

/* AR2100 */
COPY_EXISTING ~kubear.cre~ ~override/kubear1.cre~
 SAY NAME1 ~Bear~
 SAY NAME2 ~Bear~
 WRITE_ASCII 0x248 ~kuBear~ #8 // assign override script
 WRITE_ASCII 0x280 ~kuBear1~ #32 // assign DV

COPY_EXISTING ~kubear.cre~ ~override/kubear2.cre~
 SAY NAME1 ~Bear~
 SAY NAME2 ~Bear~
 WRITE_ASCII 0x248 ~kuBear~ #8 // assign override script
 WRITE_ASCII 0x280 ~kuBear2~ #32 // assign DV

COPY_EXISTING ~kubear.cre~ ~override/kubear3.cre~
 SAY NAME1 ~Bear~
 SAY NAME2 ~Bear~
 WRITE_ASCII 0x248 ~kuBear~ #8 // assign override script
 WRITE_ASCII 0x280 ~kuBear3~ #32 // assign DV

COPY_EXISTING ~kubear.cre~ ~override/kubear4.cre~
 SAY NAME1 ~Bear~
 SAY NAME2 ~Bear~
 WRITE_ASCII 0x248 ~kuBear~ #8 // assign override script
 WRITE_ASCII 0x280 ~kuBear4~ #32 // assign DV

COPY_EXISTING ~kubear.cre~ ~override/kubear5.cre~
 SAY NAME1 ~Bear~
 SAY NAME2 ~Bear~
 WRITE_ASCII 0x248 ~kuBear~ #8 // assign override script
 WRITE_ASCII 0x280 ~kuBear5~ #32 // assign DV

COPY_EXISTING ~kubear.cre~ ~override/kubear6.cre~
 SAY NAME1 ~Bear~
 SAY NAME2 ~Bear~
 WRITE_ASCII 0x248 ~kuBear~ #8 // assign override script
 WRITE_ASCII 0x280 ~kuBear6~ #32 // assign DV

COPY_EXISTING ~kubear.cre~ ~override/kubear7.cre~
 SAY NAME1 ~Bear~
 SAY NAME2 ~Bear~
 WRITE_ASCII 0x248 ~kuBear~ #8 // assign override script
 WRITE_ASCII 0x280 ~kuBear7~ #32 // assign DV

COPY_EXISTING ~kubear.cre~ ~override/kubear8.cre~
 SAY NAME1 ~Bear~
 SAY NAME2 ~Bear~
 WRITE_ASCII 0x248 ~kuBear~ #8 // assign override script
 WRITE_ASCII 0x280 ~kuBear8~ #32 // assign DV

Link to comment

Hope this is right, by the way, because I've gotten through about a quarter of them. Not that recoding would be a big deal if it isn't, but it would be fun to know.

 

About using game timers as opposed to real timers, I'm guessing that it's game timers, because AFAIK, IWD didn't have real timers, but if the spawns are too frequent, I can easily recode for real timers.

 

Edit: BTW: I realize you don't want the comments in the finished script, but leaving them in until I doublecheck everything.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...