Jump to content


BaldursGate Cutscene problem


  • Please log in to reply
19 replies to this topic

#1 -Icke-

-Icke-
  • Guest

Posted 12 March 2010 - 03:17 PM

Hi there!
I am writing a mod for Baldurs Gate using the BiG World Setup v8.3.1 (Minimal Installation, German) and I am new to this.
I managed to build a new area with some npcs, scripting and so on.

At this time I am working on a small map which has only one npc and a cutscene. (Every file is in the override folder)
The creaturefile of this npc is IMOEN.CRE and the problem is, that I can not use her as an Object in my cutscene. I have tried this with other npcs and different names but none worked. Neither she does anything nore can I *kill("Imoen")* (or whatever) her.
When I am not in the cutszene everything works fine, Dialogues and Scripts.

This is an extract from the cutscene saved in CGCUT1.BSC in the Override folder:

IF
True()
THEN
RESPONSE #100
CutSceneId("Imoen")
Wait(2)
DisplayStringHead(Myself,6701) // Keule
...
END

IF
True()
THEN
RESPONSE #100
CutSceneId(Player1)
Explore()
...
END


This is the Areascript starting the Cutscene:

IF
OnCreation()
THEN
RESPONSE #100
Wait(6)
ClearAllActions()
StartCutSceneMode()
StartCutScene("CGCUT1")
END


I already checked other cutscenes but could not find any helpfull information on this.
Furthermore this does not work on an other PC.

So i am very frustrated because I work on this for several hours now.
I would appreciate any help you could give me.
If you need more information feel free to ask.

Nevertheless I am going to sleep now. See you soon.

#2 -Icke-

-Icke-
  • Guest

Posted 12 March 2010 - 03:19 PM

O man, I'm too tired.
Pls move to http://www.shsforums...e-modding-help/

#3 -Icke-

-Icke-
  • Guest

Posted 12 March 2010 - 03:53 PM

Strg-M on the Creature I want to use for the cutscene says:
Current Area: CGKELL
CRE Resref: IMOEN
Name: Imoen
My scriptname: None <<< Is this it? *
Scripts: CGIMKE,, None, None, CGIMKE
Dialog: CGIMKE

* - I Strg-Med Gorion and his Script name is Gorion (Whatelse^^)
If this is the problem: How do I give my immy her Script name.

gn8 :)

#4 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 12 March 2010 - 06:55 PM

This is an extract from the cutscene saved in CGCUT1.BSC in the Override folder

First of all, the extension should be .bcs not .bsc. Second of all, it should be written as a .baf file then compiled to a .bcs using WeiDU. Third of all, you probably want to put all that in the area script, not a cutscene. The area script is just calling the cutscene anyway from the looks of it. Fourth of all, if you're using BWP or BGT, I believe Imoen's scripting/death variable is imoen2. It might help if you describe a bit more what you're trying to do.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#5 -Guest-

-Guest-
  • Guest

Posted 12 March 2010 - 08:55 PM

Have some faith, Miloch! He already found most the problem. :-)

Objects are referenced by script name, not by resref. If you want to change the script name of IMOEN.CRE, you can use an editor (DLTCEP or NI or whatever) or with WeiDU in the installation TP2 if that's what you're using. (Note that IMOEN.CRE is not BG2 Imoen but some freakish placeholder.)

#6 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 12 March 2010 - 10:36 PM

Have some faith, Miloch! He already found most the problem. :-)

Well it's kinda hard to tell, though I'd guess ".bsc" is just a typo at least.

Note that IMOEN.CRE is not BG2 Imoen but some freakish placeholder.

It's the Imoen you talk to in Candlekeep (BG1/Tutu/BGT) - not the joinable one later, which would be imoen2.cre at least. Probably carried over to BG2 for no good reason, like a lot of other cruft.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#7 -Icke-

-Icke-
  • Guest

Posted 13 March 2010 - 02:40 AM

Hi there, thanks for replying!

Have some faith, Miloch! He already found most the problem. :-)

Well it's kinda hard to tell, though I'd guess ".bsc" is just a typo at least.

Yep typo. (I am always thinking of BSCript or whatever)

Note that IMOEN.CRE is not BG2 Imoen but some freakish placeholder.

It's the Imoen you talk to in Candlekeep (BG1/Tutu/BGT) - not the joinable one later, which would be imoen2.cre at least. Probably carried over to BG2 for no good reason, like a lot of other cruft.

Well I actually am working on a mod for Candlekeep so I though using the Candlekeep Imoen would just work fine.
I am modding the quests in Candlekeep before you leave with Gorion.

Second of all, it should be written as a .baf file then compiled to a .bcs using WeiDU.

Actually I am writing the script in NI because none of the tutorials I read said anything about how to write it.
(i.e. http://teambg.eu/ind...als&tutorial=10 is just dealing with the scripting itself)

Objects are referenced by script name, not by resref. If you want to change the script name of IMOEN.CRE, you can use an editor (DLTCEP or NI or whatever)

That's what I needed.

Now the next question is:
How do I set the script name using NI? I am working on this but I am thankful for every help I get.

#8 -Icke-

-Icke-
  • Guest

Posted 13 March 2010 - 02:52 AM

I believe Imoen's scripting/death variable is imoen2

O dear Lord Helm.
Anyway why is it called death variable in NI. Thats not self-explanatory. (That's what I am thinking.)

#9 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 13 March 2010 - 03:09 AM

Anyway why is it called death variable in NI. Thats not self-explanatory. (That's what I am thinking.)

I assume a little... but I would say that it's because it gives a true(=1) when the character is either dead or in party... at least in the ToB game where you can ask the Spirit of Fate to summon the chars near the beginning.

Ups... well, it gives a true with this check:
Dead("<variable>")
Where the <variable> is the Death variable/Script name.

Edited by Jarno Mikkola, 13 March 2010 - 06:41 AM.

Deactivated account. The user today is known as The Imp.


#10 Lollorian

Lollorian

    smiley addict

  • Member
  • 4150 posts

Posted 13 March 2010 - 05:40 AM

Ummm, this may be a stupid question but ... how do I find out the death variable of an NPC in NI?? :P

"I am the smiley addict, yellow and round, this is my grin :D when I'm usually around :P.
When there's trouble brewing, see me post, cuz it's usually a wall o' yellow and your eyes are toast!!!"

BWP GUIDE - BWP FIXES - impFAQ - NPC LIST - KIT LIST - AREA LIST

GitHub Links : BWP Fixpack | Lolfixer | BWP Trimpack | RezMod


#11 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 13 March 2010 - 06:33 AM

Ummm, this may be a stupid question but ... how do I find out the death variable of an NPC in NI?? :P

You just open the .cre file as usual and in the window(View -> Stats) you'll see the Script name, it's the that variable. --at least in the first 'Near Infinity v20.jar' from here.

Edited by Jarno Mikkola, 13 March 2010 - 06:36 AM.

Deactivated account. The user today is known as The Imp.


#12 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 13 March 2010 - 09:17 AM

You don't want to change the DV with NI but it's fine for just looking at it. If you're making your own CREs, you want to use DLTCEP so they don't get corrupted. The field there is on the Icons & scripts tab, called "Scripting name (Death variable)".

You wouldn't want to change the DV on an NPC anyway, or you'd break a lot of other mods, and vanilla game stuff too. But if you did, you'd use WeiDU to do something like:
COPY_EXISTING imoen1.cre override
  WRITE_ASCII 0x280 ~myvar~ #32 //Death variable
BUT_ONLY_IF_IT_CHANGES
All of the offsets etc. are in the IESDP.

Edit: anyhow, it should work if you use imoen2 in your script instead of imoen.

Edited by Miloch, 13 March 2010 - 09:28 AM.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#13 -Icke-

-Icke-
  • Guest

Posted 13 March 2010 - 04:21 PM

You don't want to change the DV with NI but it's fine for just looking at it. If you're making your own CREs, you want to use DLTCEP so they don't get corrupted. The field there is on the Icons & scripts tab, called "Scripting name (Death variable)".

You wouldn't want to change the DV on an NPC anyway, or you'd break a lot of other mods, and vanilla game stuff too.


So it would be better do create new creatures for my mod than using existing ones?

Actually I plan to edit this creatues in Candlekeep (Act1)
-Imoen
-Gorion
-Reevor
-Drepin
-Phylia
-Fuller
-the two "Assasins"
and this areas
-Candlekeep itself (AR0015) (moving/deleting NPCs, editing Areascript)
-AR6506 The warehouse with the rats (adding a door to a basement)

#14 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 13 March 2010 - 05:43 PM

So it would be better do create new creatures for my mod than using existing ones?

Actually I plan to edit this creatues in Candlekeep (Act1)
-Imoen
-Gorion
-Reevor
-Drepin
-Phylia
-Fuller
-the two "Assasins"
and this areas
-Candlekeep itself (AR0015) (moving/deleting NPCs, editing Areascript)

It all depends on what you're changing. Changing script variables is a bad idea, but you can interject dialogue, change their stats etc., EXTEND_BOTTOM the area script. Use WeiDU for that.

-AR6506 The warehouse with the rats (adding a door to a basement)

This is going to be really tough without overwriting a new .tis file. It could be done with a BAM if you don't need an open/closed sort of door (just a dark archway leading down perhaps). There are examples in the Aurora mod of that sort of thing. But that is really advanced modding, so I'd save it til last.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#15 -Icke-

-Icke-
  • Guest

Posted 14 March 2010 - 06:02 AM

It all depends on what you're changing. Changing script variables is a bad idea, but you can interject dialogue, change their stats etc., EXTEND_BOTTOM the area script. Use WeiDU for that.

No, I am not changing script variables. I am rewriting whowl dialogues (such as Imoens and Gorions) and editing minor things in others.
Yes, I am using EXTEND_BOTTOM for Areascripting.

-AR6506 The warehouse with the rats (adding a door to a basement)

This is going to be really tough without overwriting a new .tis file. It could be done with a BAM if you don't need an open/closed sort of door (just a dark archway leading down perhaps). There are examples in the Aurora mod of that sort of thing. But that is really advanced modding, so I'd save it til last.

The bottom flap will be open (no interaction) so I am replacing the areabitmap. I am thinking of how to add a new travelarea (if this is its name) to an existing area without replacing the whole thing. I will look into the Aurora mod. Thanks.

At the moment I am reading more stuff dealing with WeiDU scripting and stuff. I don't know how to create Strings for new Items or Infopoints in Areas. (actually I am just creating new .ITM files and editig them -> interim solution to see if the scripting works)
Do you know a modder who wrote a making-of to his/her mod?

#16 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 14 March 2010 - 08:41 PM

I don't know how to create Strings for new Items or Infopoints in Areas. (actually I am just creating new .ITM files and editig them -> interim solution to see if the scripting works)

That is very easy, but you should do it with WeiDU to avoid corrupting your dialog.tlk file. There is a very simple template for that sort of modding in the BAM Batcher utility (link in my signature) but it's basically:
COPY ~mymod/myitem.itm~ ~override~
  SAY NAME1 ~My Item~
  SAY DESCRIPTION ~Blah blah blah~
  etc.

Do you know a modder who wrote a making-of to his/her mod?

Not really as such, but there is a lot in the Tutorials section. Most of it is dialogue or NPC-related though, not this type of modding, maybe someone should write such a thing.

The bottom flap will be open (no interaction) so I am replacing the areabitmap.

In that case, you may just want to edit and overwrite the .tis file. I gave some basic instructions on how to do that here.

I am thinking of how to add a new travelarea (if this is its name) to an existing area without replacing the whole thing.

The Aurora mod uses a very cunning macro (compliments of Nythrun) to do this sort of thing to quite a few areas in its .tp2 code. If you have any questions, ask... it's actually quite intuitive once you get the hang of it.

Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#17 -Guest-

-Guest-
  • Guest

Posted 15 March 2010 - 09:49 AM

I don't know how to create Strings for new Items or Infopoints in Areas. (actually I am just creating new .ITM files and editig them -> interim solution to see if the scripting works)

That is very easy, but you should do it with WeiDU to avoid corrupting your dialog.tlk file. There is a very simple template for that sort of modding in the BAM Batcher utility (link in my signature) but it's basically:
COPY ~mymod/myitem.itm~ ~override~
  SAY NAME1 ~My Item~
  SAY DESCRIPTION ~Blah blah blah~
  etc.

The WeiDU-Readme(WeiDU Documentation) was very helpful :D
There I found answers to many questions I had which most tutorials do not go into.
It helped me restructering my files so I can (re)install it using weidu which helps a lot.

I am thinking of how to add a new travelarea (if this is its name) to an existing area without replacing the whole thing.

The Aurora mod uses a very cunning macro (compliments of Nythrun) to do this sort of thing to quite a few areas in its .tp2 code. If you have any questions, ask... it's actually quite intuitive once you get the hang of it.

I am using tp2 scriptparts from the german mod Breagar of Ascalon. He is using the tp2 to insert a trigger into the docsdistrict of Athkatla which I could use (modified of course). I know where the code is and searching it in in Aurora could be painful because I don't know the mod.


The bottom flap will be open (no interaction) so I am replacing the areabitmap.

In that case, you may just want to edit and overwrite the .tis file. I gave some basic instructions on how to do that here.

I will read through it. (Again: Ascalon modified the blacksmith's shop in Beregost)

Newest problem:
At the momend I am thinking of how to erase actors from a map using tp2. I want to delete the assasins in candlekeep (ar6502 and ar6507) because I am planing on relocating them to an other area.
I don't know how to actually delete whole actors from an area so (at the moment) I am replacing their creaturefiles and names with the ones from the tutors in candlekeep. (using tp2 for this) Shank is easy but in ar6507 there are three more creatures and I am trying to figure out which one actually is Carbos using tp2 coding. (WHILE Loop + READ_ASCII the Creaturefiles and if it's a match rewrite it)
If you know an easier way (or how to delete whole actors savely) let me know ;)
by the way: I hate edit files with tp2 - replacing the whole thing would be much easier :P

#18 Jarno Mikkola

Jarno Mikkola

    The Imp in his pink raincoat.

  • Member
  • 10911 posts

Posted 15 March 2010 - 12:37 PM

The WeiDU-Readme(WeiDU Documentation) was very helpful :D

Erhm, unfortunately, that's not exactly up to date, this is... cause my linked one is the v213's readme, not the old v185 one like yours.

Deactivated account. The user today is known as The Imp.


#19 Miloch

Miloch

    Barbarian

  • Modder
  • 6579 posts

Posted 15 March 2010 - 12:43 PM

The WeiDU-Readme(WeiDU Documentation) was very helpful :D
There I found answers to many questions I had which most tutorials do not go into.
It helped me restructering my files so I can (re)install it using weidu which helps a lot.

Yes, it is a modder's best friend, next to the IESDP (but get the most recent WeiDU document Jarno linked or the one included with WeiDU v213).

I am using tp2 scriptparts from the german mod Breagar of Ascalon. He is using the tp2 to insert a trigger into the docsdistrict of Athkatla which I could use (modified of course). I know where the code is and searching it in in Aurora could be painful because I don't know the mod.

Ok, well here's an example from the code. First you want to copy this file to mymod/lib or somewhere like that, so you can INCLUDE the code in your mod.
Attached File  fj_add_are_struct.tpa   29.41K   161 downloads
Then you can do stuff like this:
INCLUDE ~mymod/lib/fj_add_are_struct.tpa~ //Includes the area function code

COPY_EXISTING ar0500.are override //Bridge District
  PATCH_IF SOURCE_SIZE > 0x28f BEGIN //Makes sure the area has a valid size
    LPF fj_add_are_structure //LPF is short for LAUNCH_PATCH_FUNCTION
      INT_VAR
      fj_loc_x          = 2780 //X coordinate
      fj_loc_y          = 1955 //Y coordinate
      fj_dest_loc_x     = 2780 //Same as above unless the creature moves around
      fj_dest_loc_y     = 1955
      fj_animation      = 0x6110 //fighter female human
      fj_orientation    = 15     //South-southeast
      STR_VAR
      fj_structure_type = actor  //Tells it to add a creature (actor) to the area
      fj_name           = Aurora
      fj_cre_resref     = agaurora //Filename of the .cre
    END
    LPF fj_add_are_structure
      INT_VAR
      fj_type         = 2    //Travel region
      fj_box_left     = 3415
      fj_box_top      = 625
      fj_box_right    = 3450
      fj_box_bottom   = 700
      fj_cursor_index = 30   //Door cursor
      fj_vertex_0     = 3415 + (625 << 16) //X+Y of each vertex in the travel polygon
      fj_vertex_1     = 3450 + (650 << 16)
      fj_vertex_2     = 3450 + (700 << 16)
      fj_vertex_3     = 3415 + (676 << 16)
      STR_VAR
      fj_structure_type   = region
      fj_name             = Tran0540
      fj_destination_area = ag0540
      fj_destination_name = Exit0500
    END
    LPF fj_add_are_structure
      INT_VAR
      fj_loc_x       = 3490 //Adds a new entrance from another area
      fj_loc_y       = 655
      fj_orientation = 10   //Northeast
      STR_VAR
      fj_structure_type = entrance
      fj_name           = Exit0540
    END
  END
BUT_ONLY
These are 3 examples: adding an actor, a travel region (going to another area) and an entrance (coming from another area). But using similar syntax, it will do just about anything, possibly even the dishes. Well maybe not, but anything with adding something to an area, even an animation for a new door.

Newest problem:
At the momend I am thinking of how to erase actors from a map using tp2. I want to delete the assasins in candlekeep (ar6502 and ar6507) because I am planing on relocating them to an other area.
I don't know how to actually delete whole actors from an area so (at the moment) I am replacing their creaturefiles and names with the ones from the tutors in candlekeep. (using tp2 for this) Shank is easy but in ar6507 there are three more creatures and I am trying to figure out which one actually is Carbos using tp2 coding. (WHILE Loop + READ_ASCII the Creaturefiles and if it's a match rewrite it)
If you know an easier way (or how to delete whole actors savely) let me know ;)

You want to use a FOR loop instead of WHILE (more efficient) and no need to rewrite, since you can delete the actor from the area as long as you update all the offsets.
BACKUP ~mymod/backup~
AUTHOR ~whatever~

BEGIN ~Area Patching Example~

//This code allows your mod to be compatible with both Tutu and BGT
ACTION_IF FILE_EXISTS_IN_GAME ~fw0125.are~ BEGIN //If Tutu
  OUTER_SPRINT tutu_var ~_~
  OUTER_SPRINT ckpq ~fw2602~ //Candlekeep Priest's Quarters
END ELSE BEGIN //Otherwise (if BGT)
  OUTER_SPRINT tutu_var ~~
  OUTER_SPRINT ckpq ~ar6502~ //Candlekeep Priest's Quarters
END

COPY_EXISTING ~%ckpq%.are~ override //fw2602 in Tutu; ar6502 in BGT
  PATCH_IF SOURCE_SIZE > 0x28f BEGIN //Makes sure the area has a valid size
    READ_LONG 0x54 actor_offset
    READ_SHORT 0x58 actor_count
    FOR (i = 0; i < actor_count; i += 1) BEGIN //Cycle through actors
      READ_ASCII (i * 0x110 + actor_offset + 0x80) cre_file //Read the filename
      PATCH_IF (~%cre_file%~ STRING_EQUAL_CASE ~%tutu_var%shank~ = 1) BEGIN //If Shank found
        DELETE_BYTES (i * 0x110 + actor_offset) 0x110 //Delete him
        actor_count -= 1
        WRITE_SHORT 0x58 actor_count
        PATCH_FOR_EACH offset IN 0x5c 0x60 0x68 0x70 0x78 0x7c 0x84 0x88 0xa0 0xa8 0xb0 0xb8 0xbc 0xc0 0xc4 0xcc BEGIN
          READ_LONG offset old_value
          PATCH_IF old_value >= 0x110 BEGIN //If it's not a zeroed offset
            WRITE_LONG offset (old_value - 0x110) //Update offset to account for deleted actor
          END
        END
      END
    END
  END
BUT_ONLY
I tried to comment it so it's fairly clear what everything does. But the only thing you'd have to change to reuse it elsewhere (such as for Carbos) is the area name (or variable) and cre filename.

by the way: I hate edit files with tp2 - replacing the whole thing would be much easier :P

It is very easy to do this sort of thing with DLTCEP (just load the area, click on the Actors tab and Delete Shank). But if you start overwriting a bunch of stuff, people will hate your mod because it won't be compatible with other mods. Now rewriting the tileset *might* be ok for such a small area, because the chance of another modder wanting to change it is fairly slim. But you never know. It is almost as easy (maybe easier) to make a BAM for your new door and add it with the function above if you really want to be compatible.

And WeiDU code may be a pain to learn, but it's not as bad as it looks. Plus you've already conceded it's main benefit:

It helped me restructering my files so I can (re)install it using weidu which helps a lot.


Infinity Engine Contributions
Aurora * BG1 NPC * BG1 Fixpack * Haiass * Infinity Animations * Level 1 NPCs * P5Tweaks
PnP Free Action * Thrown Hammers * Unique Containers * BG:EE * BGII:EE * IWD:EE
================================================================
Player & Modder Resources
BAM Batcher * Creature Lister * Creature Checker * Creature Fixer * Tutu/BGT Area Map & List * Tutu Mod List
================================================================
"Infinity turns out to be the opposite of what people say it is. It is not 'that which has nothing beyond itself' that is infinite, but 'that which always has something beyond itself'." -Aristotle


#20 -Icke-

-Icke-
  • Guest

Posted 15 March 2010 - 03:16 PM

The WeiDU-Readme(WeiDU Documentation) was very helpful :D

Erhm, unfortunately, that's not exactly up to date, this is... cause my linked one is the v213's readme, not the old v185 one like yours.

I liked the existing ToC so much! I will miss it :(
Thanks for the uptodate one. And thanks @ google for the old one.

The WeiDU-Readme(WeiDU Documentation) was very helpful :D
There I found answers to many questions I had which most tutorials do not go into.
It helped me restructering my files so I can (re)install it using weidu which helps a lot.

Yes, it is a modder's best friend, next to the IESDP (but get the most recent WeiDU document Jarno linked or the one included with WeiDU v213).

I am using tp2 scriptparts from the german mod Breagar of Ascalon. He is using the tp2 to insert a trigger into the docsdistrict of Athkatla which I could use (modified of course). I know where the code is and searching it in in Aurora could be painful because I don't know the mod.

Ok, well here's an example from the code. First you want to copy this file to mymod/lib or somewhere like that, so you can INCLUDE the code in your mod.
Attached File  fj_add_are_struct.tpa   29.41K   161 downloads
Then you can do stuff like this:
INCLUDE ~mymod/lib/fj_add_are_struct.tpa~ //Includes the area function code

COPY_EXISTING ar0500.are override //Bridge District
  PATCH_IF SOURCE_SIZE > 0x28f BEGIN //Makes sure the area has a valid size
    LPF fj_add_are_structure //LPF is short for LAUNCH_PATCH_FUNCTION
      INT_VAR
      fj_loc_x          = 2780 //X coordinate
      fj_loc_y          = 1955 //Y coordinate
      fj_dest_loc_x     = 2780 //Same as above unless the creature moves around
      fj_dest_loc_y     = 1955
      fj_animation      = 0x6110 //fighter female human
      fj_orientation    = 15     //South-southeast
      STR_VAR
      fj_structure_type = actor  //Tells it to add a creature (actor) to the area
      fj_name           = Aurora
      fj_cre_resref     = agaurora //Filename of the .cre
    END
    LPF fj_add_are_structure
      INT_VAR
      fj_type         = 2    //Travel region
      fj_box_left     = 3415
      fj_box_top      = 625
      fj_box_right    = 3450
      fj_box_bottom   = 700
      fj_cursor_index = 30   //Door cursor
      fj_vertex_0     = 3415 + (625 << 16) //X+Y of each vertex in the travel polygon
      fj_vertex_1     = 3450 + (650 << 16)
      fj_vertex_2     = 3450 + (700 << 16)
      fj_vertex_3     = 3415 + (676 << 16)
      STR_VAR
      fj_structure_type   = region
      fj_name             = Tran0540
      fj_destination_area = ag0540
      fj_destination_name = Exit0500
    END
    LPF fj_add_are_structure
      INT_VAR
      fj_loc_x       = 3490 //Adds a new entrance from another area
      fj_loc_y       = 655
      fj_orientation = 10   //Northeast
      STR_VAR
      fj_structure_type = entrance
      fj_name           = Exit0540
    END
  END
BUT_ONLY
These are 3 examples: adding an actor, a travel region (going to another area) and an entrance (coming from another area). But using similar syntax, it will do just about anything, possibly even the dishes. Well maybe not, but anything with adding something to an area, even an animation for a new door.

Newest problem:
At the momend I am thinking of how to erase actors from a map using tp2. I want to delete the assasins in candlekeep (ar6502 and ar6507) because I am planing on relocating them to an other area.
I don't know how to actually delete whole actors from an area so (at the moment) I am replacing their creaturefiles and names with the ones from the tutors in candlekeep. (using tp2 for this) Shank is easy but in ar6507 there are three more creatures and I am trying to figure out which one actually is Carbos using tp2 coding. (WHILE Loop + READ_ASCII the Creaturefiles and if it's a match rewrite it)
If you know an easier way (or how to delete whole actors savely) let me know ;)

You want to use a FOR loop instead of WHILE (more efficient) and no need to rewrite, since you can delete the actor from the area as long as you update all the offsets.
BACKUP ~mymod/backup~
AUTHOR ~whatever~

BEGIN ~Area Patching Example~

//This code allows your mod to be compatible with both Tutu and BGT
ACTION_IF FILE_EXISTS_IN_GAME ~fw0125.are~ BEGIN //If Tutu
  OUTER_SPRINT tutu_var ~_~
  OUTER_SPRINT ckpq ~fw2602~ //Candlekeep Priest's Quarters
END ELSE BEGIN //Otherwise (if BGT)
  OUTER_SPRINT tutu_var ~~
  OUTER_SPRINT ckpq ~ar6502~ //Candlekeep Priest's Quarters
END

COPY_EXISTING ~%ckpq%.are~ override //fw2602 in Tutu; ar6502 in BGT
  PATCH_IF SOURCE_SIZE > 0x28f BEGIN //Makes sure the area has a valid size
    READ_LONG 0x54 actor_offset
    READ_SHORT 0x58 actor_count
    FOR (i = 0; i < actor_count; i += 1) BEGIN //Cycle through actors
      READ_ASCII (i * 0x110 + actor_offset + 0x80) cre_file //Read the filename
      PATCH_IF (~%cre_file%~ STRING_EQUAL_CASE ~%tutu_var%shank~ = 1) BEGIN //If Shank found
        DELETE_BYTES (i * 0x110 + actor_offset) 0x110 //Delete him
        actor_count -= 1
        WRITE_SHORT 0x58 actor_count
        PATCH_FOR_EACH offset IN 0x5c 0x60 0x68 0x70 0x78 0x7c 0x84 0x88 0xa0 0xa8 0xb0 0xb8 0xbc 0xc0 0xc4 0xcc BEGIN
          READ_LONG offset old_value
          PATCH_IF old_value >= 0x110 BEGIN //If it's not a zeroed offset
            WRITE_LONG offset (old_value - 0x110) //Update offset to account for deleted actor
          END
        END
      END
    END
  END
BUT_ONLY
I tried to comment it so it's fairly clear what everything does. But the only thing you'd have to change to reuse it elsewhere (such as for Carbos) is the area name (or variable) and cre filename.

The code looks funny - I have to analyse it tomorrow. (I was sooo proud of mine^^)

// "deleting" CarbosI am using him elsewhere
// actually overriting the creaturefile because of the remaining offset
COPY_EXISTING ~AR6507.are~ ~override/AR6507.are~
	READ_SHORT ~0x0058~ ~#actors~		// count of actors
	READ_LONG ~0x0054~ ~actoroffset~	// offset to actors

	SET ~done~ = 0
	WHILE (~%#actors%~ > 0) AND (~%done%~ = 0) BEGIN
		READ_ASCII (~%actoroffset%~ + (~%#actors%~ - 1) * 0x110 + 0x0080) ~creaturefile~(<img src='http://www.shsforums.net/public/style_emoticons/<#EMO_DIR#>/cool.gif' class='bbc_emoticon' alt='8)' />
		WHILE !(~%creaturefile%~ STRING_COMPARE %BGCARBOS%) AND (~%done%~ = 0) BEGIN
			WRITE_ASCII (~%actoroffset%~ + (~%#actors%~ -1) * 0x110 + 0x0080) %MONKTU1%
			WRITE_BYTE (~%actoroffset%~ + (~%#actors%~ -1) * 0x110 + 0x0080 + 7) 00
			WRITE_ASCII (~%actoroffset%~ + (~%#actors%~ -1) * 0x110) %Tutor%
			WRITE_BYTE (~%actoroffset%~ + (~%#actors%~ -1) * 0x110 + 5) 00
			SET ~done~ = 1
		END
	END
Don't hit me for not using IFs (I used while instead) PATCH_IF stood behind every Patching example in my readme. That was very confusing.

by the way: I hate edit files with tp2 - replacing the whole thing would be much easier :P

It is very easy to do this sort of thing with DLTCEP (just load the area, click on the Actors tab and Delete Shank). But if you start overwriting a bunch of stuff, people will hate your mod because it won't be compatible with other mods. Now rewriting the tileset *might* be ok for such a small area, because the chance of another modder wanting to change it is fairly slim. But you never know. It is almost as easy (maybe easier) to make a BAM for your new door and add it with the function above if you really want to be compatible.

Yep, that's because I am going through this.

Again: Thanks a lot for all the help.
good night