YolkfolkThe Dizzy Fansite 0 logged in0 playing
Community discussion

I Give up,...please help

Started by Apep on 4 March 2008 • 8,539 views

15 posts
#54148

I'm trying to make a static brush dissapear after using an Item on it,...in this case the static brush is a door with the ID 102 and the item is a key
I'm using a hidden dynamic as an activator.

This is the line of code that's causing me nightmares :

BrushSet(BrushFind(102),B_DRAW,0);

I can tell you that everything works as intended apart from one minor detail,....the door was origonally "Material block" and when I use the key on the activator, the door does in fact dissapear from view...but only in image, the material is left behind.
So in effect the door is turned into an invisible block.

It was my understanding that DRAW,0 was status none. DRAW,1 is image only, DRAW,3 is material only and DRAW,4 is Image and material.

I tried adding an extra line identical to the above using "B_MATERIAL,0" instead of "B_DRAW"
That just resulted in an error.....anyone know what I'm doing wrong?

[EDIT]
Actually I figured it out...I forgot to add this at the end of the script

GameCommand(CMD_REFRESH);

Was gonna delete this post to avoid spamming the board since I no longer need it, but I guess only moderators can do that /shrug

👍 0
#59798
A small correction:

for static brushes, the B_DRAW property has the following values:
0=don't draw anything
1=draw on image only (view)
2=draw on materialmap only
3=draw both on image and material map

for dynamic brushes the coresponding property is O_DRAW
and it only makes sense with 0=don't draw and 1=draw
since dyamic brushes (objects) can't write in the material map.
👍 0
#59800

Yeah, your right, thanks for the correction.

In regards to my above problems,...although I did actually figure it out there is still something that you could help me with.

Collectible items(coins/diamonds/etc)
I know these don't need to have special ID's assigned unless they have certain circumstances, such as being disabled untill a certain action is performed by the player(eg player uses a crowbar on a wooden crate,...coin appears on top of the crate)
That I can do, that's easily coded.

What I'm having trouble with is hiding coins behind pickable items(leaves, wooden railings etc)
Tried it with just a standard coin to see what would happen,....Dizzy picked up the coin without first picking up the item hiding it.
So I figure I obviously need to disable the coin untill said item is picked up.
Changing the enable/disable status of the coin is easy enough

ObjSet(ObjFind(103),O_DISABLE,0);

but I don't know how to trigger that when the item hiding it is picked up.

👍 0
#59801
The way i get coins behind items is rather easy.

I set all objects that you can pick up to layer 3
then i set all coins to layer 2

this can be done very quickly using the find & set options in the editor {yolkfolk}:delight:
👍 0
#59802
When two objects overlap, the player will pick the first one, but not in a visual order. It is the internal order, based on their indexes.

If the coin was placed first when editing the map, and the other item was placed second, Dizzy will pick the coin first.
This can sometimes be weird, especially if you stay closer to an item, but you are still close enough to pick another one.
But this is not such a big issue, and if necessary it can be adjusted with more advanced changes of the default template.

So make sure the coin is added in the map after the item (can use ctrl+c, delete and ctrl+v) and, as PTeal said, use different layers to get the desired visual order.


Another approach is to have the coin disabled and on the PickupObject_ID callback for the item in case, to enable it, but only it's the first time you pick the item (can set the O_STATUS to 1 to remember that).
👍 0
#59803
apart from RRD and special cases, i almost never assign layers to either coins or items. i simply put the object infront of the coin. i never give coins ID numbers. it seems to work quite well. as both are 'pickable' objects, it seems to first pick the one that's at the front of the layer, which is an item.

if it wasn't pickable, then yes there would be a problem with that, but i've done 6 games now, and never had a problem with it. *shrugs*
👍 0
#59805
I got it working now,

Thanks guys {yolkfolk}:thumb:

That had me tearing my hair out for hours, but once you explained how it was done, I can't believe how easy it was.

Just in case anyone happens to be intrested, I unnoficially have a new game under construction...doesn't have a name yet, cos I'm not sure what all is going to be in it. Just kind of making it up as I go along.
Got the first 5 rooms finished and so far I'm quite pleased with the results.

I'm not gonna post any screenies or any official announcements or anything untill it gets a bit bigger and nearer completion. So far it's been an awesome learning experience and I reckon it's just as much fun, if not more fun than actually playing Dizzy so I'm going to see this one through.
👍 0
#59807
Well, if you come up with a title and a screenshot, I can enter you in the competition.
Maybe it will motivate others to enter too.
👍 0
#59809
Well I've come up with a name, and a storyline which I'll post in the fan games forums later, as for competition entry....can you let me think about that for a few days? I'd like to enter but I don't know if I'm gonna be done in time, I'm running into a few brick walls with my scripts(That's what I get for trying things I haven't done before I guess)

At the same time though I'm trying out new stuff so I can make my game more complex, I don't want it to be too easy or to be an unfinished product like "Adventure of Dizzy(part 1 and 2)" seemed to be. No offence to the programmer of course...he was probably learning like I am.


Anyway,...enough off topic babbling,...back to DizzyAGE help:

First off, I am getting better at scripting....less errors and I'm finding it easier to find errors when I do make them but there seems to be at least one of the basics that I've overlooked.

I can use the "ActionObject" function to display messages and other things when I hit the action button on "action" class objects but what if I want to add a message for just simply colliding with an item?
say for example I run accross Denzil,..and I want Denzil to open up a dialouge which requires no action from Dizzy other than simply approaching Denzil.

How would I implement that? also Would it matter if Denzil was static or dynamic?
👍 0
#59814

you can use a collision to trigger a message, firstly you need to have the object (it has to be a dynamic object) properties set with collider set to 'call handler'

then use the following bit of code. you can of course change what the code does.

func CollideObject_1000_1()
{
	Message0(5,4,"PUT YOURnMESSAGE HERE");
	MessagePop();
}

the 1000 is the object ID, and the 1 specifies when you first collide with the object. you can also use 0 to change it to when you exit the object, rather than first collide with it.

be careful about putting collision objects right next to each other, as the engine sometimes won't action one of them if you have 2 or more right next to each other.

👍 0
#59903
Okay,...I got that one taken care of thanks again for the help.

I've run into another problem.
This time it's with a booby trap,....when I set off the trap it works perfectly except for one minor detail. When Diz respawns he falls into the trap again.

Trap is triggered by an invisible collider,....wondered if there was a way to set the respawn co-ordinates after triggering the trap?


Another small issue as well, moving an object from one room to another by changing the X,Y values, the object doesn't show up in the next room,..I'm obviously missing something but what?
👍 0
#59904
Hi !

You can use e.g. O_USER properties of the invisible collider (or store it in the room numeric properties - ctrl+r in the map editor and then in the script RoomGet(rx,ry,index), index is 0..7, rx and ry you can get from GameGet(G_ROOMX - actual room co-ordinate, counted from player position) and GameGet(G_ROOMY)) to save respawn co-ordinates and after falling into the trap set Dizzy's position PlayerSet(P_XSAFE, x) and (P_YSAFE, y) from this storage in the following way:

Use Death propety of the invisible collider to recognize trap (if you are using O_USER properties of the collider set death property to its idx and then you can reach (via ObjFind(death)) its user properties where you have co-ordinates stored) and in the PlayerDeathMessage(death) test this property and set safe position (from O_USER or room properties) before death message is shown. Then respawn position will be where you want to and you can use various traps, death messages and respawn positions. I've tried both methods now and they work well.

And when moving object into another room you must call ObjPresent(ObjFind(idx)) in the UpdateRoom_x_y() handler of every room where the object is or will be. When the object is only in one room there is no need to call ObjPresent.
👍 0
#59905

The latest DizzyAGE (v2.1.1) has support for respawning after a death.
The easyest way for your trap puzzle (if you only have one such trap) is like this:

- Add a DEATH_TRAP define with some death value you choose, in gamedef.gs
- Add in PlayerDeathMessage(death) a test for this value, to have a nice death message
- Add a callback function RespawnPlayer_DEATH (replace death with your value)

In the respawn callback call the default RespawnPlayer function, to take care of the usual stuff (that reset some stuff and moves the player to the previous safe position, which in your cas is not so safe...) and then move the player yourself in the desired position, like before the trap.

If you must consider the way you came into the trap (from left or from right), you can use some additional property to rememer that (either with two collider trigers or testing player coordinates when entered the room with the trap.

[quote data-userid="141" data-postid="59904"]

And when moving object into another room you must call ObjPresent(ObjFind(idx)) in the UpdateRoom_x_y() handler of every room where the object is or will be. When the object is only in one room there is no need to call ObjPresent.

[/quote]

That is not accurate.

You should call the ObjPresent only when you move a dynamic object from another room into the current one. That's because the engine displays only dynamic objects from the current room (for speed), so you have to instruct it that you brought a new one. That's how it's done when you drop down an object from the inventory.

And it's ObjPresent(idx) with idx being the index of the object, or ObjPresent(ObjFind(id)) with id being the value of the object's O_ID property.

If you have a more global case, like some air bubbles objects that can travel in any room where the player is, then you can always present them, on their update function, that will be called from the update of the current room.

And make sure you don't move or resize static objects outside their original room - this is not possible.

Alex

👍 0
#59907
Hi Alex !

Yes, I've meant the same about the ObjPresent(), but wrong language explanation, not native speaker {yolkfolk}:scratch: , in DizzyAge book is this problem written clearly. I'll try better next.
👍 0