The Black Wyrm Lair Forums
The Black Wyrm's Lair Terms of Use Help Search Members Calendar

Welcome Guest ( Log In | Register )

> Creating secret containers, And how to reveal them
egm
post Feb 3 2006, 10:14 AM
Post #1


Eminence Grise Machiavelic
Group Icon

Mod Developer
Posts: 244
Joined: 12-November 04
From: Monthléry




This tutorial is meant to create secret container, detectable like traps, with the Search skill of the thief. Special thanks to Vlàsak for the tips wink.gif
In BGII, you just press the TAB key and all containers magically highlight, allowing you to loot every piece you want. If you want to make things harder, then this tuto is for ya!

You need some files in order to make your first try.

- An .ARE file, named ARTEST.ARE;
- a .bcs file, named ARTEST.BCS, as it's the area's script;
- another .bcs file, named TRSE01.BCS, where TRSE01 is a trap;

The ARE file==========
You need first to add a container to your map. Set any x/y value for the box dimension or position; name it CTSE01.
Then create a new region (with the type TRAP), with the same dimension and location. Call it TRSE01.
Add a new variable to your area, let's say "CTSE01", with a base value of 0.

The Area script=======
It must contain the following block:

QUOTE
IF
Global("ContainerStuff","ARTEST",0)
THEN
RESPONSE #100
ContainerEnable("CTSE01",0)
SetGlobal("CTSE01","ARTEST",1)
END


This block ensure that the container is unavailable the first time you enter the area.
In game, it's juste invisible, non-selectable.

The Trap script=======
It must contain the following block:

QUOTE
IF
Detected([ANYONE])
Global("CTSE01","ARTEST",1) //ensure that party got the XP only once and all the stuff is proceeded just once
THEN
RESPONSE #100
  RemoveTraps("TRSE01")
  ContainerEnable("CTSE01",1)
  DisplayStringHead("LastTrigger",XXXXX)//You have detected a secret container!
  AddexperienceParty(YYY)//where yyy is the amount of XP gained
  SetGlobal("CTSE01","ARTEST",2)
END


If you detect the trap, it's instantly removed, and the hidden container is just available.
The party gets some XP in the example. If you don't want that, just remove the AddexperienceParty(YYY)

You can set how difficult it is to detect the secret container by modifying the trap right in the ARE file.

You can repeat this operation for any container you want to make secret and harder to find (with name like CTSE02, 03 and so on).

Note==========
Detected() is just not triggered by using the spell Detect traps. I'm working to know how bypass that (perhaps with the SpellCast and Range triggers - I'm not quite sure if the Range trigger is available for Traps).
Go to the top of the page
 
Quote Post
 
Start new topic
Replies (1 - 19)
pro5
post Feb 22 2007, 04:01 AM
Post #2





Forum Member
Posts: 80
Joined: 18-August 06




QUOTE(egm @ Feb 3 2006, 10:14 AM) *
This block ensure that the container is unavailable the first time you enter the area.
In game, it's juste invisible, non-selectable.

Unfortunately, ContainerEnable() doesn't remove TAB highlighting of disabled container (they just cannot be selected), thus the whole "secret container" thing becomes pointless. sad.gif
Go to the top of the page
 
Quote Post
Galactygon
post Feb 25 2007, 03:53 AM
Post #3



Group Icon

Mod Developer
Posts: 1158
Joined: 22-July 04
From: Sweden




Fortunately, light map colours affect container highlighting, so it is possible to cover that area in black. That does not mean the highlight disappears - it simply becomes black rather than bright cyan. However, black blends easily with a dark background.

In that case, the player will manually have to detect the container rather than using thieving, and the container remains invisible unless you enable an animation to mimick detected containers.

-Galactygon

This post has been edited by Galactygon: Feb 25 2007, 09:18 PM


--------------------
Go to the top of the page
 
Quote Post
pro5
post Feb 25 2007, 08:29 AM
Post #4





Forum Member
Posts: 80
Joined: 18-August 06




I've painted container location with black in both light-map and search-map. No effect, it's still cyan when I use TAB?

This post has been edited by pro5: Feb 25 2007, 08:29 AM
Go to the top of the page
 
Quote Post
Galactygon
post Feb 25 2007, 06:22 PM
Post #5



Group Icon

Mod Developer
Posts: 1158
Joined: 22-July 04
From: Sweden




So then lightmapping only works with dropped items?

IPB Image

-Galactygon

This post has been edited by Galactygon: Feb 25 2007, 06:24 PM


--------------------
Go to the top of the page
 
Quote Post
devSin
post Feb 25 2007, 07:14 PM
Post #6





Forum Member
Posts: 53
Joined: 22-March 05




Are you talking about the LUM map or the search map (you first said search, now you say LUM)?

If you're talking about the LUM map, then no, the area background isn't affected.
Go to the top of the page
 
Quote Post
Galactygon
post Feb 25 2007, 09:17 PM
Post #7



Group Icon

Mod Developer
Posts: 1158
Joined: 22-July 04
From: Sweden




It is lightmapping, my mistake. I am used to making posts about search maps, so it is a reflex. smile.gif

-Galactygon

This post has been edited by Galactygon: Feb 25 2007, 09:18 PM


--------------------
Go to the top of the page
 
Quote Post
devSin
post Feb 25 2007, 11:08 PM
Post #8





Forum Member
Posts: 53
Joined: 22-March 05




I guess I'm not really surprised that ground items get the dynamic lighting. IIRC, the "highlighting" is actually a special frame in the ground icon BAM (how cheap); whereas the engine has special code to deal with highlighting trigger regions (including doors and containers), highlighting items is just done by switching to the highlight frame and gets the light adjustments. I don't think there's any way to trick the engine into concealing the hard-coded highlights (they even show up through the black mask, sigh).

The light maps shouldn't affect anything else beyond characters and ground icons (and animations, provided the appropriate flag is set).
Go to the top of the page
 
Quote Post
Sir-Kill
post Feb 25 2007, 11:41 PM
Post #9


consiglieri
Group Icon

Member of Graphics Dept.
Posts: 2343
Joined: 13-August 04
From: Michigan, U.S.A.




Damn
had hope but no


--------------------
Go to the top of the page
 
Quote Post
Galactygon
post Feb 25 2007, 11:44 PM
Post #10



Group Icon

Mod Developer
Posts: 1158
Joined: 22-July 04
From: Sweden




QUOTE

The light maps shouldn't affect anything else beyond characters and ground icons (and animations, provided the appropriate flag is set).


It's a shame, really; I was hoping it would work.

-Galactygon


--------------------
Go to the top of the page
 
Quote Post
Cuv
post Jun 4 2007, 08:29 PM
Post #11





Forum Member
Posts: 14
Joined: 29-April 05




I know it has been a while since this post was answered... but I have been thinking about the problem presented and sorta have a solution... or at least a workaround worthy of further exploration.

I created a container in an area and flagged it as a Pile. This way it only shows up as the ground icon of the object inside the container.

I then created an item and made a new BAM that looks like a chest. Assigned it to a book copy. You can see from the below picture that the chest is visible (just to demonstrate), but it does not show up as a marked container like the ones around it.



... but you can put your cursor over it and it will give you the 'grabby' hand icon.



Anyways, something to think about. I suppose you could either write a script to replace the item you want to hide when the time is right.. or put something else in the container with no ground icon. Or just create the item that looks like your container on the ground by either having some invis creature drop it at the appropriate time, or other ways.

Here's the item and bam if you want to give it a try. Might spark some creative ideas



Hope this helps.
Cuv




Attached File(s)
Attached File  invis1.jpg ( 108.66k ) Number of downloads: 40
Attached File  invis2.jpg ( 95.73k ) Number of downloads: 34
Attached File  chest.rar ( 1.86k ) Number of downloads: 17
 
Go to the top of the page
 
Quote Post
devSin
post Jun 4 2007, 08:40 PM
Post #12





Forum Member
Posts: 53
Joined: 22-March 05




I'd be worried about the game purging the pile (I can't remember the specifics of what it does and does not decide to periodically erase), but it does seem like a neat solution (you have to use a custom BAM that doesn't have the highlight frame).

I just use the pile type to get rid of containers I don't want anymore (easier than deleting them); I wouldn't have thought to do it this way.
Go to the top of the page
 
Quote Post
igi
post Jun 5 2007, 07:01 PM
Post #13


IESDP Guardian


Forum Member
Posts: 175
Joined: 22-July 04




I remember reading that you can simply delete the vertices relating to the outline of the container.

However, I don't remember where I read it, nor if it worked.


--------------------
Go to the top of the page
 
Quote Post
devSin
post Jun 5 2007, 08:20 PM
Post #14





Forum Member
Posts: 53
Joined: 22-March 05




But then you have to update the vertex index of every other structure in the ARE. No thanks. ;)

I think setting the bounding rect coords to 0 or -1 should work fine (you shouldn't even have to touch the vertices), but why bother when you can just change the type to pile (unless the container has items and you don't want to delete them, but then I'm not sure what you'd be trying to do)?
Go to the top of the page
 
Quote Post
Cuv
post Jun 6 2007, 05:34 PM
Post #15





Forum Member
Posts: 14
Joined: 29-April 05




From where exactly are those container types referenced in the .ARE? It must be an IDS, but I can't seem to find it. Anyone know the file name? I want to find out more about Pile, and why whatever shape or size container polygon I draw for it remains invisible. Could be a solution in there somewhere.

Cuv
Go to the top of the page
 
Quote Post
devSin
post Jun 6 2007, 05:50 PM
Post #16





Forum Member
Posts: 53
Joined: 22-March 05




Container types are hardcoded; there's not much difference beyond the search sound and icon, but piles are handled differently.

You'll never get a pile that respects any region polygons (a pile is simply a point on the ground where contents of the container may be placed). The engine creates fake piles for lots of stuff (most of which you'll never see).

You should be able to change the highlight frame of your container icon to mimic the normal highlighting effect (instead of the cyan border that normal item icons have, you could just use a cyan overlay).
Go to the top of the page
 
Quote Post
Cuv
post Jun 7 2007, 03:55 AM
Post #17





Forum Member
Posts: 14
Joined: 29-April 05




Ah, I was afraid of that. Thanks for the info DevSin smile.gif

I will keep thinking on the problem and see what else I can come up with... I might need a secret container myself at some point.

cheers,

cuv
Go to the top of the page
 
Quote Post
Cuv
post Jun 9 2007, 02:25 PM
Post #18





Forum Member
Posts: 14
Joined: 29-April 05




Another question for the programming type people (as I am not one of those):

Where might I locate the actual program coding for CGameContainer.cpp? Is it actually coded into the BGMain.exe or as a file elsewhere?

I found the hardcoding Offset in the BGMain.exe for the containers using a hex editor (but didnt change anything), just as you described... and now I am wondering if there is a way to patch in what I want smile.gif What I really want to do is to patch the coding for the map size restrictions and adding new animation slots (found those offsets too at roughly 0075:****)

D:\dev\baldur\CGameContainer.cpp

BAG CHEST DRAWER PILE TABLE SHELF ALTAR NONVISIBLE SPELLBOOK BODY BARREL CRATE FALSE

OFFSET 0070:F6C0 BGMain.exe

Cuv

Go to the top of the page
 
Quote Post
devSin
post Jun 9 2007, 04:45 PM
Post #19





Forum Member
Posts: 53
Joined: 22-March 05




It's part of the actual program code; the source file itself is not available. What you found is more likely the location of strings used for assertions than the location where container handling is done.

You can change some simple values in the compiled executable, but you won't be able to do anything worthwhile (and adding anything is out of the question).

This post has been edited by devSin: Jun 9 2007, 04:48 PM
Go to the top of the page
 
Quote Post
Cuv
post Jun 9 2007, 07:42 PM
Post #20





Forum Member
Posts: 14
Joined: 29-April 05




Thanks again DevSin smile.gif

I may poke around a bit more... and might even try adding or changing some things around. This is a third install of the ToB game... the stripped-down version that I use for testing out things. If it crashes or destroys it, no biggie.. will just re-install the TCCore.

Cuv

Will certainly keep you all informed if I can achieve any worthwhile changes or find out anything new about the engine.

This post has been edited by Cuv: Jun 9 2007, 07:43 PM
Go to the top of the page
 
Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:



- Lo-Fi Version Time is now: 31st October 2024 - 03:26 AM