⌂ YolkfolkThe Dizzy Fansite
Community discussion

Naming an item

Started by patchwar on 15 February 2007 • 10,959 views

17 posts
#53759

Hi there!

I love the site and I was so impressed with the Emerald Eye game (by user PTeal presumably) that I thought I'd have a crack at making a game myself. I'm only just starting with DizzyAge and I've had a look at the doc tutorials but I'm missing something very obvious I'm sure:

How do you assign a name to an item? The first tutorial describes placing a leaf brush object on the map which you can pick up when playing it, but it doesn't have a name.

Anyway, I'm basically rambling on and on to make this thread seem interesting when really all I need is for someone to tell me how I can give an item the name 'A leaf'. {yolkfolk}:scratch:

Thanks for any help you can give me!

👍 0
#56104
in the 'objects.ds' script file (found in the 'scripts' folder), you can assign a name to it. if you work through the tutorials and do exactly as they say, it'll tell you what code to put where, and what properties to use on the object.

just a little tip for the future that i wish i'd known about, use 'Brush' and 'B_Status, B_draw' etc where the object you want to manipulate is Static type, and use 'Obj' (object) and 'O_Status, O_Draw' etc where the object you want to manipulate is Dynamic type.

you probably won't use that just yet, but knowing that will save a lot of head scratching. it took me AGES to work out that i was mixing up brushes and objects and that i really shouldn't do that... :tongue:

if you still have problems with your leaf after having worked through the tutorial, let us know and someone will be happy to help you!
👍 0
#56106

[quote data-userid="24" data-postid="53759"]

Hi there!

I love the site and I was so impressed with the Emerald Eye game (by user PTeal presumably) that I thought I’d have a crack at making a game myself. I’m only just starting with DizzyAge and I’ve had a look at the doc tutorials but I’m missing something very obvious I’m sure:

How do you assign a name to an item? The first tutorial describes placing a leaf brush object on the map which you can pick up when playing it, but it doesn’t have a name.

Anyway, I’m basically rambling on and on to make this thread seem interesting when really all I need is for someone to tell me how I can give an item the name ‘A leaf’. {yolkfolk}:scratch:

Thanks for any help you can give me!

[/quote]

in objects.gs at the top of the file you will find the function called ObjectsSetNames in the default template it looks like this..

/////////////////////////////////////////////////////////////////////////////////
// Set objects names.
// All pickable objects (CLASS_ITEM) should have valid names.
/////////////////////////////////////////////////////////////////////////////////
func ObjectsSetNames()
{
ObjSetName( ObjFind(200), "BUCKET" );
}

To add an object create a new ObjSetName, in the function. Set the objects id in the ObjFind bit and the name in the quotes.

e.g. you want to set item number 105 to harp you would do the following

ObjSetName( ObjFind(105), "HARP" );
👍 0
#56107

just a little tip for the future that i wish i'd known about, use 'Brush' and 'B_Status, B_draw' etc where the object you want to manipulate is Static type, and use 'Obj' (object) and 'O_Status, O_Draw' etc where the object you want to manipulate is Dynamic type.

When i first started the brushes and objects used to confuse me too {yolkfolk}:crazy:

but always rememeber if you change a brush to refresh the game {dizzy}:dizwink:

GameCommand(CMD_REFRESH);
👍 0
#56108
Also, another nice thing to remember about static brushes is that you must save those brushes that you may change during the game, in the SaveGame and load them in the LoadGame functions from the files.gs file.
The dynamic objects and global variables are saved by default, but the static brushes are not, since they are so many and most of them are not changed.
So don't forget that, or your save-load game will disappoint players.
Check maual or available games for details.
👍 0
#56109

thank you peter for pointing that out! that was another thing that had me scratching my head.... :tongue:

and alex, i didn't realise you had to get the game to save the status of all the static brushes used....! thank you for telling me about that!

i'll have to look at doing that.....! ooo that'd have been a MAJOR bug in my game... :confused:

👍 0
#56119

All the static brushes that you need to change, not all the static brushes in the map - just to make it clear :smile:

Like if you have a cave blocked by some static brushes with blocking material, and at some point you will unblock the entrance and change the material property of the brush, or the draw property to avoid them writing in the material map. Then you must save these particular brushes, or when the saved game will loaded, they will remain as in their default state (that was blocked), even in that game the player managed to unblock them.

Same thing can goes for the rooms titles.
If you need to change a room title, during the game, for example "the blocked cave" into "the unblocked cave" :tongue: , you must handle this in the load game function. Usually you will have to check if the cave is unblocked then set the propper name of the room.

And the same with an item's name, if the case. For example, "a full bottle", and "an empty bottle". When load game, check it's status or it's tile, or how you decide if it's empty or full, and set the proper object name.

👍 0
#56120
thanks alex! yeah i realised you meant just the brushes that can be changed!

i didn't even know you could change the room name!

i did try to change the name of an item once, but i couldn't do it, i was probably using the wrong code! haha! i did work around it tho.

thank you!

EDIT: just a thought, if an item is hidden to start with, do you have to get the game to save the status of that? i'm guessing you would, as you have to with the brushes...
👍 0
#56132

no, the dynamic objects (so the items) are saved by the game by default.
And so are the global variables and player's variables.
You can check the Save (or Load) functions in files.gs

The properties are saved as integers into the file.
It does as follows:

// save game data
for(i=0;i<G_MAX;i++)
{
if(!gs_filewriteint(GameGet(i), f)) goto fileerror;
}

// save objects data
for(o=0;o<ObjCount();o++)
{
for(i=0;i<O_MAX;i++)
{
if(!gs_filewriteint(ObjGet(o,i), f)) goto fileerror;
}
}

// save player data
for(i=0;i<P_MAX;i++)
{
if(!gs_filewriteint(PlayerGet(i), f)) goto fileerror;
}

Oh, and another thing you can see at the end of the Load function
is that it plays the "location" music. If you use to change the music, depending on the location (room or so), when you load the game, and the location gets changed to where the player was, this will call GetLocationMusic() function to find what music it should play.
Since by default it's only one tune, no need to do anything about it.
See GetLocationMusic() content in "mushroom pie" for more tunes.

Of course you may change this behaviour, like you can set a global variable to remember the current playing music, etc.

👍 0
#56138
well at least i won't have to list all the items...!

i did find the position in files.ds where the brushes have to be listed, i'll be doing them as soon as it's all finished... cause i have a habit of adding little extra puzzles and stuff as i'm going along! :tongue: even though the puzzles part of it is finished now....!

it also solves one other thing i was wondering, whether it saved all the dynamic brushes or just the actual items...

thats good, that significantly cuts down on the brushes i'll have to list :smile:
👍 0
#56153

Thanks all of you for your answers and helpful tips. I guess I should have had more patience and gone through a few more tutorials.

Sadly - or wonderfully depending on how you look at it - I won't be pursuing my Dizzy game at least for a few months, thanks to my son being born a few days ago, but I really appreciate the quick response. Cheers. {yolkfolk}:cheers:

👍 0
#56155
congratulations for your son :smile:
👍 0
#56165
right, i have problems.

i've put all the brush IDs into the place on the save and load file bit in the files.ds file.

i've only put in the brushes (static objects) that get changed in the course of the game.

i've NOT put in any other brushes, or any item that is dynamic (i.e. items, other dynamic objects that may change).

this is the code that i changed:

savebrushes = {long list of brushes here }; // edit this list with brushes ids
for(i=0;i<sizeof(savebrushes);i++)
if(!LoadBrush(f,savebrushes)) goto fileerror;


the problem is that it says 'file error' when it saves it, and when i load it, it loads the screen i saved it on, doesn't hide some brushes, hides some dynamic objects that shouldn't be hidden at all, and says 'file error'.

grrrr. any help would be appreciated...
👍 0
#56166
hah i found the problem.

i'd accidently included one dynamic object, due to how i've been labeling them on a list i have. doh!

i've removed it, and the save games work! wooo!
👍 0
#56167
ok now i have a different problem,

i've packed it, and created a pak file. but when i try to run it with the dizzy.exe program, it comes up with a load of errors, eventually saying

'this game was made with a different version of dizzyAGE (v1.1)

you are now using dizzyAGE v1.31'


but the version i've got is v1.31....

i adapted it from one of the tutorials, could that be the problem?
👍 0
#56170
Since your game works unpacked, it sure is a problem with the packing. It all looks like the pak file does not include what it should. Try to unpack it in another folder and see if it matches your original Data folder. See if you included the Data folder in the pak too, or not - probably this is the cause.

You can have a look at the Dizzy And The Other Side unpacked and check if you have similar folders structure.

If still cant't get it, send me the data and I'll try packing myself and see if it works.
👍 0
#56171
XD i got it to work.

i didn't have the pak file named 'dizzy'....

doh.
👍 0