Jump to content

Creature re-creation for BGII, help needed


ericp07

Recommended Posts

Note that the creature spawning and random movement are two very separate tasks, and I would try to implement them one at a time.

If you are distributing new areas with embedded creatures in the mod, you can include random movement behavior just like BioWare does, as part of the destination coordinates, but if you're spawning creatures via script in existing areas, as most modern mods do, then your best bet is to follow Mike1072's advice.

 

I don't usually recommend patching the "hard code" of area files just to spawn creatures. If you're changing area transitions, item placement, or door, lock, or trap behavior, you have no choice, but to do it just to spawn a creature is kind of silly. Script works just as well, and it's a lot more player-friendly. Most players will install your mod on an in-progress game. Since area patching only occurs if the area has never been visited before, it's a good idea to avoid it if you possibly can.

Link to comment
Note that the creature spawning and random movement are two very separate tasks, and I would try to implement them one at a time.

If you are distributing new areas with embedded creatures in the mod, you can include random movement behavior just like BioWare does, as part of the destination coordinates, but if you're spawning creatures via script in existing areas, as most modern mods do, then your best bet is to follow Mike1072's advice.

 

I don't usually recommend patching the "hard code" of area files just to spawn creatures. If you're changing area transitions, item placement, or door, lock, or trap behavior, you have no choice, but to do it just to spawn a creature is kind of silly. Script works just as well, and it's a lot more player-friendly. Most players will install your mod on an in-progress game. Since area patching only occurs if the area has never been visited before, it's a good idea to avoid it if you possibly can.

 

Well and good, then. I don't want to change the areas in any way other than to add the creature, and I'm not creating any new areas, either.

 

So, at this point, my understanding is that I am to add the EXTEND_TOP lines in my .tp2 for each relevant area, and create a little ARxxxx.baf in my scripts folder for each one as well.

 

Thanks!

Eric

Link to comment

If you use EXTEND_TOP, you absoultely MUST determine whether you need to add Continue() to each and every spawn block or you can break the game. Having it there will never hurt. Area scripts usually contain OnCreation() blocks that can be aborted by a mod's EXTEND_TOP.

 

Here's an example of one spawn block containing Continue():

// b!ar2000.baf - Spawns Goody Marli 

IF
 Global("B!Herb05Spawn","AR2000",0)
THEN
 RESPONSE #100
 CreateCreature("b!herb05",[494.2288],0)				   // Goody Marli 
 SetGlobal("B!Herb05Spawn","AR2000",1) 
 Continue() 
END

Link to comment
If you use EXTEND_TOP, you absoultely MUST determine whether you need to add Continue() to each and every spawn block or you can break the game. Having it there will never hurt. Area scripts usually contain OnCreation() blocks that can be aborted by a mod's EXTEND_TOP.

 

Here's an example of one spawn block containing Continue():

// b!ar2000.baf - Spawns Goody Marli 

IF
 Global("B!Herb05Spawn","AR2000",0)
THEN
 RESPONSE #100
 CreateCreature("b!herb05",[494.2288],0)				   // Goody Marli 
 SetGlobal("B!Herb05Spawn","AR2000",1) 
 Continue() 
END

 

My tentative coding for each of the area scripts follows this convention, I think, as I have Continue() as the line after CreateCreature and before END. I just finished creating all the area BAFs, and soon I'll choose coordinates in each area I've selected for the spawn points.

 

Thanks, I'm getting ever closer now :suspect:

Eric

Link to comment
Would that be the extent of a file "beast_spawn.baf" for this?

That should be all you need to spawn the creature in an area.

 

Also, which script would this be (I have nothing specified for class, race, or general)? The Hunting Panther's .cre has only the override script and default script specified; the override script is set to the one I created that handles the shapeshift from one form to the other (EP#MABSH), and the default script is set to WTASIGHT. Would beast_spawn become a customized version of WTASIGHT that I would create and then specify as the default script?

The script block in beast_spawn.baf should not be executed by the creature. With EXTEND_TOP, we add this block to the beginning of different area scripts in the game, so the creature can be created when the party first visits that area.

 

The creature's scripts start running after the creature is created. The RandomWalk() behaviour should go in one of them and execute when the creature is not attacking.

 

I wasn't aware that RandomWalk() was rarely used in the vanilla game, so thanks for pointing that out, Berelinde. In the example wdrunsgt script, the RandomWalk() block is located at the very bottom. This ensures it will only occur when the creature is not doing anything more important. It should be easy to create a customised WTASIGHT by adding the same block to the end to achieve similar behaviour.

 

Note that the creature spawning and random movement are two very separate tasks, and I would try to implement them one at a time.

 

I'd thought that adding the spawning block to the creature's override script would simplify things, and someone suggested I add it in there. Is that not so? I'll remove it from there, if not, and instead use it in the area scripts. That does make more sense to me. If I do it this way, though, I don't see the point of also creating the beast_spawn.baf script.

 

Currently, the override script (EP#MABSH.baf) consists of:

 

IF
See(NearestEnemyOf(Myself))
Global("TimerStarted","LOCALS",0)
THEN
RESPONSE #100
SetGlobal("TimerStarted","LOCALS",1)
StartTimer("PanthAttack",12)
END
IF
TimerExpired("PanthAttack")
THEN
RESPONSE #100
CreateCreature("EP#MABCS",[-1.-1],0)
CreateVisualEffectObject("SPPOLYMP","EP#MABCS")
DestroySelf()
END

 

Should I add a block before this one to control the creature's behavior after it spawns? As it roams around, it's hunting for adventurers, and should target spellcasters as highest priority victims in a party, and then (if it survives) simply attack any other party members. It always fights to the death, which is handled by WTASIGHT, as I understand it.

 

Thanks,

Eric

Link to comment

I'll wait to add the creature's simulated hunting behavior till after I've ironed out the random spawning issue. Once I know that I'm coding that part correctly, I'll test it in-game.

 

For movement, in addition to RandomWalk, there's also RandomWalkContinuous. However, something tells me that using Hunter.bcs for the race script will handle the hunting, if that's indeed what it does. The creature doesn't necessarily have to attack every other creature in an area. It might keep things simpler to have it moving around, and attack characters on sight, a la WTASIGHT.

 

Thanks,

Eric

Link to comment
I'd thought that adding the spawning block to the creature's override script...

You can't spawn the creature from its own override script. The override won't run until the creature is actually spawned. Usually, creatures are spawned in the area scripts. It's possible to use Hinaeriel's override script to spawn creatures, but if you're going to do that, you will need to use CreateCreatureOffScreen() or CreateCreatureObjectOffset() rather than CreateCreature().

Link to comment
I'd thought that adding the spawning block to the creature's override script...

You can't spawn the creature from its own override script. The override won't run until the creature is actually spawned. Usually, creatures are spawned in the area scripts. It's possible to use Hinaeriel's override script to spawn creatures, but if you're going to do that, you will need to use CreateCreatureOffScreen() or CreateCreatureObjectOffset() rather than CreateCreature().

 

Yes, I'm starting to see how these things work the way they do, so this is another good sanity check. No, I don't think it would be wise to use the NPC's own override script to spawn anything. If she had an animal companion, I could see the logic in including code for that in her override script (but I could be off base there, too). Even with the details I'm including, I want to keep this as simple as I can. It is, in part, a learning exercise, after all, as well as a labor of love :suspect:

 

Thanks,

Eric

Link to comment
So, at this point, my understanding is that I am to add the EXTEND_TOP lines in my .tp2 for each relevant area, and create a little ARxxxx.baf in my scripts folder for each one as well.

Yes, you need an EXTEND_TOP for each area you are extending. No, you do not need multiple .bafs. Please re-read this post. beast_spawn.baf takes the place of all of the ARxxxx.baf files you are creating.

Link to comment
So, at this point, my understanding is that I am to add the EXTEND_TOP lines in my .tp2 for each relevant area, and create a little ARxxxx.baf in my scripts folder for each one as well.

Yes, you need an EXTEND_TOP for each area you are extending. No, you do not need multiple .bafs. Please re-read this post. beast_spawn.baf takes the place of all of the ARxxxx.baf files you are creating.

 

OK, I've created beast_spawn.baf as a separate file, and added the filename to the COMPILE section of my .tp2. I'm not clear about this:

 

And you would use this code to extend an area script with it, specifying the coordinates for the different spawn points in that area:

 

EXTEND_TOP ~AR1900.BCS~ ~Hinaeari/script/beast_spawn.baf~
 TEXT_SPRINT p1 ~500.800~
 TEXT_SPRINT p2 ~2000.1250~
 TEXT_SPRINT p3 ~1000.2000~
 EVALUATE_BUFFER

 

So, one copy of this block for each area goes into my .tp2, right? I see that this supplies the coordinates, and I imagine I can change the coordinates for each area, if needed.

 

Thanks,

Eric

Link to comment
OK, I've created beast_spawn.baf as a separate file, and added the filename to the COMPILE section of my .tp2.

You only need to use COMPILE if you are trying to create a new script. We are trying to add the information in this file to existing scripts, so we are using EXTEND_TOP instead.

 

I'm not clear about this:

 

And you would use this code to extend an area script with it, specifying the coordinates for the different spawn points in that area:

 

EXTEND_TOP ~AR1900.BCS~ ~Hinaeari/script/beast_spawn.baf~
 TEXT_SPRINT p1 ~500.800~
 TEXT_SPRINT p2 ~2000.1250~
 TEXT_SPRINT p3 ~1000.2000~
 EVALUATE_BUFFER

 

So, one copy of this block for each area goes into my .tp2, right? I see that this supplies the coordinates, and I imagine I can change the coordinates for each area, if needed.

Yep. :suspect:

Link to comment
OK, I've created beast_spawn.baf as a separate file, and added the filename to the COMPILE section of my .tp2.

You only need to use COMPILE if you are trying to create a new script. We are trying to add the information in this file to existing scripts, so we are using EXTEND_TOP instead.

 

I'm not clear about this:

 

And you would use this code to extend an area script with it, specifying the coordinates for the different spawn points in that area:

 

EXTEND_TOP ~AR1900.BCS~ ~Hinaeari/script/beast_spawn.baf~
 TEXT_SPRINT p1 ~500.800~
 TEXT_SPRINT p2 ~2000.1250~
 TEXT_SPRINT p3 ~1000.2000~
 EVALUATE_BUFFER

 

So, one copy of this block for each area goes into my .tp2, right? I see that this supplies the coordinates, and I imagine I can change the coordinates for each area, if needed.

Yep. :suspect:

 

You mean just copy a BAF to the override folder during installation, and not worry about it not being translated to a BCS? That's fine with me, if so :)

 

OK, I'm glad to have guessed correctly there, as I've already added the blocks to my .tp2, and now get to look at all the area maps to deal with spawn coordinates *LOL*

 

Thanks!

Eric

Link to comment
You mean just copy a BAF to the override folder during installation, and not worry about it not being translated to a BCS? That's fine with me, if so :suspect:

Both COMPILE and EXTEND_TOP translate the .baf commands into .bcs format, the difference is that COMPILE creates a new script containing the contents of the .baf and EXTEND_TOP adds the contents of the .baf to the start of a script that may already exist. EXTEND_TOP is all you need to use here.

Link to comment
You mean just copy a BAF to the override folder during installation, and not worry about it not being translated to a BCS? That's fine with me, if so :suspect:

Both COMPILE and EXTEND_TOP translate the .baf commands into .bcs format, the difference is that COMPILE creates a new script containing the contents of the .baf and EXTEND_TOP adds the contents of the .baf to the start of a script that may already exist. EXTEND_TOP is all you need to use here.

 

I was wondering about that. Thanks for the explanation :)

 

- E

Link to comment

I've taken a different approach to spawning the creature, and it works as it should in test games. For the test, I have it set to spawn in one area only, which is the same area where the NPC appears and approaches the party (AR1200). What happens is that either 0, one, or up to six creatures will appear, representing the idea that these creatures occur individually, in pairs, or in packs of three to six. I'm using CreateCreatureObjectOffScreen to bring in a "leader" (a duplicate of the hunting panther, but with its own DV); if more than one creature is to spawn, I'm using CreateCreatureObjectOffset and supplying coordinates for the additional creatures to spawn near the leader.

 

For the test, the trigger looks like this:

 

IF
InParty("EP#Hin")
AreaCheck("AR1200")
CombatCounter(0)
Global("EP#BeastSpawn","GLOBAL",0)

 

I'm already satisfied that things are working as they should, so I'll have to change AreaCheck("AR1200") to something else that ensures the spawning will occur in any outdoor, above-ground area that's not a city or a dungeon. I may need to limit the number of places this may happen, but that's OK. So, my thinking is to write something like "OR !AreaType(CITY) !AreaType(DUNGEON)", etc., but I'm sure that's not exactly the way to write it. I'd rather avoid having to supply a list of area numbers, but instead specify by excluding inappropriate types of areas, as I'm hoping this will simplify things a bit. Is this a workable approach? If so, how should this be set up?

 

The spawning script is in EP#Hin.baf. The creature's transformation script is what makes up EP#MABSH.baf.

 

Please advise on how to proceed along these lines.

 

Thanks,

Eric

Link to comment

Archived

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

×
×
  • Create New...