Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Global Object State?

Author
Message
EsteemDE
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 1st May 2006 18:54
Can some one give a good idea on how to do something like this? Many games have it but I can't really think of a method to pull it off. Like in Morrowind or other RPG games when you open a chest, leave, then go back to that area the chest is still open and the items are gone. Or if you killed some one, there body would still be laying on the floor with the items you took still missing.
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 1st May 2006 19:45
as long as 3d objects are not deleted or otherwise altered in game state they should remain as they were

EsteemDE
19
Years of Service
User Offline
Joined: 5th Aug 2005
Location:
Posted: 1st May 2006 20:00
Wouldnt the object reset when you leave a room (level) then re-enter the room (reload the level)?
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 1st May 2006 20:39
use a global variable.say your npc 'andy' dies then variable 'andy=10'

if andy=10
andy is dead here.
endif

that way he will stay dead.
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 1st May 2006 23:56
If its only concerning model states (appearance) then there's a harder simpler method...

Basically, assuming there was a chest in bedroom number 4 of a castle, you'd have the program load the model with a name something like;

LOAD OBJECT "Room4Chest1.X",1

You'd have two models in the same directory, one of the chest open, and one closed. In the beginning, the closed chest's file name would be Room4Chest1.X. Once the user opens the chest, you'd rename Room4Chest1.x (the closed chest) to Room4Chest1B.x,... or something like that, and then you'd rename the open chest file to Room4Chest1.X. This way, the program always loads Room4Chest1.X, which will be the correct model assuming you programmed it correctly to rename the files.

Im not sure which would be slower, as using a huge amount of variables (the list would probably be huge for things as small as chests that can be found everywhere in RPG-esk games), would lag a fair amount, but then again manipulating files can take up some speed if you do it too often.

Anyhoo, my two cents.
- RUC'

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 2nd May 2006 01:52
Quote: "Wouldnt the object reset when you leave a room (level) then re-enter the room (reload the level)? "


if youve coded it that way then yes it would.
dbp holds no preconceived concept of "levels", it would all depend on how youve coded it. if a level is loading/reloading each time then youd need to save state to some file system.

Login to post a reply

Server time is: 2024-11-27 20:33:54
Your offset time is: 2024-11-27 20:33:54