⌂ YolkfolkThe Dizzy Fansite
Community discussion

DizzyAGE General Coding Queries

Started by delta on 9 February 2008 • 258,915 views

721 posts
#59954

done it! thanks! :smile:

gahhh it's just taken me about 2 hours to code that bit of the game. quite insanely complicated....

ah well. done now. :smile:

oooo i just had a thought... i think that's all the complicated coding done now. :smile:

except that the game crashes if you try to restart from the game menu.... :confused:

👍 0
#60068

right, i'm porting DMD to v2.1 of DizzyAGE, and am trying to get the game to load the map from a menu option (there will be the option of choosing which map you play with). it changes the map fine, however it simply displays it over the top of the old one, like it has 2 maps loaded. is there a way to 'unload' the previous map?

also i'm getting very strange errors when i close the game or try to restart it from the menu once i've changed maps. something to do with the objects or roomnames or other things

the most common one is this:

https://i63.photobucket.com/albums/h129/temptationfeeder/error.jpg

👍 0
#60069
I'll check the map load procedure.
What you want to do, should work, but it wasn't tested before.
Please send me the data of your game (with the two maps, loaded from the menu) so I can be sure it will work for you.
👍 0
#60070
ok i'll do that now, providing my internet stays connected long enough to do so.
👍 0
#60081
I think I fixed the problem with loading new maps.
The old map was not cleared before loading the new one.
It should work in v2.2. I plan a beta soon.
👍 0
#60414
here is a bit of advice for anyone wanting to be able to change maps in their game.

there will come a point that you have to tackle the save/load game aspect. it helps enormously if you have the variable used saved in the Game defs, as the game defs are the first ones to be saved/loaded. you will therefore find that if you have it saved in the Player defs (don't ask), you will have to change it throughout your code.

after changing files.gs so that it recognises which map you are trying to save/load, you will probably find that it will only successfully save (and load) games if they are in one map. the other maps saved games won't save or load properly. you may find yourself hunting for a while trying to find out which part of the load/save code it is failing on, so i will point you in the direction of the LoadStaticBrushes and SaveStaticBrushes functions at the bottom of Game.gs, which also look at the map file.

if you haven't changed it here so that it recognises which map you are trying to save/load, the game will fail to load the other map.

bah.
👍 0
#60418
Thanks for spotting the issue.
I made a special thread about it, so you can provide more help there, if someone needs it.
👍 0
#60420
alex, v2.2 doesn't seem to like my 'fade' function. i'll have a play with it to see if i can get it to work, but it used to work in RRD until i changed it to v2.2

EDIT:: it's ok, i found the reason. i was still using the old way of finding a tile in the Drawfade functions...
👍 0
#60422
yes, I had the same problem, but the reason is not to use TileFind and use direct id access.
👍 0
#61019

right, i'm using PlayerPlayAnim(), and it's playing the animation fine, but when it stops playing it, dizzy freezes, and i can't do anything with him. :sad:

help! i've tried PlayerEnterScripted to break him out of it, but it doesn't work. (i'm using completely custom movement in The Lord of Darkness) {yolkfolk}:scratch:

👍 0
#61029
PlayerPlayAnim() is a latent function. It waits between animation frames.
So it must be called from a latent function too (not from updates or movement functions).

It's used in PlayerPlayDead function, so it works for it's purpose.

It also sets the player in STATUS_SCRIPTED mode.
Try calling PlayerEnterIdle() after it.
👍 0
#61032
no, calling PlayerEnterIdle still doesn't work. it's like it gets to the PlayerPlayAnim() point, plays the frames, then freezes and doesn't go any further in the code.

so how would i get the game to play an animation once in the movement, before going back to Idle?
👍 0
#61036

  {yolkfolk}:yahoo: YESSSSS!!!!!!!!

  :smile: one of the best feelings is when you code something, and you're really not sure whether it will work or not. but you try it, and it works FIRST TIME!!!

it's especially gratifying if it's something quite complex that DizzyAGE was never supposed to be able to support.

in this case, it's being able to pick up any item when you're not stood in front of it, merely at the side of it. i've done it before (the standing stone in MSD), but that used an invisible mat that you were stood in front of. this time i've managed it while dizzy is stood in thin air. the items don't need anything else near them, and i've managed to get it to work seamlessly {yolkfolk}:delight:

if any of the coders have a spare few mins and are curious, try it for yourself. it aint easy to figure out how to do it! (i'd already figured out how to drop items by the side of him. it was easier to work out how to drop the items, but harder to code, as you have to take potential Block materials into account.)

woooo i'm so chuffed atm! and listening to Black Sabbaths Paranoid when i worked it out just made it even better! {yolkfolk}:music:

👍 0
#61069
just been playing and testing different features and i was doing so well but can't quiet get this very simple task..
Didn't want to ask as i was doing so well.. did the tricky stuff.

trying to get Dizzy to re-spawn out of danger.. unfortunately he keeps coming back in the same place.

i guessed i need to change some of the settings in the 'player' folder but every time i change something i just get errors messages when he dies..am i looking in the right direction?
👍 0
#61070
You can set a specific cause of death value, when you kill the player in that danger area:

Define a DEATH_DANGER1 (or similar) to a specific value, in gamedef.gs
When player dies there, set this in the player's P_DEATH property.

In game.gs you can add a coresponding death message in the PlayerDeathMessage function.

Then you write a PlayerRespawn_DEATH callback (replace DEATH with your death value number). There, you can reposition the player in a safe position, depending on where he entered in the death zone, etc.

Check more recent games (v2.2) for such examples. I don't remember if I have an example in the docs.
Someone who used this technique in his game, please post the name of the game, for Meph to check.
👍 0
#61071
[quote data-userid="17" data-postid="61070"]

You can set a specific cause of death value, when you kill the player in that danger area:

Define a DEATH_DANGER1 (or similar) to a specific value, in gamedef.gs
When player dies there, set this in the player’s P_DEATH property.

In game.gs you can add a coresponding death message in the PlayerDeathMessage function.

Then you write a PlayerRespawn_DEATH callback (replace DEATH with your death value number). There, you can reposition the player in a safe position, depending on where he entered in the death zone, etc.

Check more recent games (v2.2) for such examples. I don’t remember if I have an example in the docs.
Someone who used this technique in his game, please post the name of the game, for Meph to check.

[/quote]

Yes, I used them in my game. you need to set your defines in gamedef.gs

the message calls are near the top in my game.gs

just search for this function "func PlayerDeathMessage( death )"

Oh! I also edited the player.gs for the respawning

so search for this function "func PlayerRespawn()"

I know Jamie used it as well in RRD, as that's how I found out how to do it!
👍 0
#61544

WOOOOOOOOOOOOO i've finally managed to make my Lord of Darkness character animate when turning around! {yolkfolk}:yahoo:

that may not sound like much of an achievement, but it's a top-down view, and getting the game to animate the character when turning from facing one way to facing the other, rather than just 'flipping' the character, has been an absolute nightmare.

i tried for bloody ages last time and couldn't do it. today it's taken me the last 4 hours to do it! FOUR HOURS! :surprise:

oh boy am i glad that is now done! all the animation is now done, so the game has taken a big step forward, and it means that the demo version is still on schedule. :smile:

i'm off for some lunch now!

👍 0
#61801

alex, i've come across a small problem.

i'm hiding tiles behind each other, then moving them infront using

ObjSet(idx,O_LAYER,1);

in the code, so that the tile i want at the top is now on layer 1, above everything on layer 0.

that works fine if you just want to view the tile on screen, as it then shows it. however the issue that i have is that i need the game to then 'see' the tile that is showing on top, using

PlayerTouchObjectInRoom(idx)

the problem is that even after moving a tile 'up' a level to level 1, the game still 'chooses' the tile below it (using PlayerTouchObjectInRoom(idx) ), as in the 'stack' of tiles, the tile on top is still the tile on level 0.

i didn't notice this in the dungeons section of TLoD, however in the Archives section i'm using it for something slightly different, and it's causing a major problem.

to see what i mean, do a puzzle (or shake the bush with the key in) in TLOD demo, and then try to view the (now visible) item. you'll find that he tells you it's the tile UNDERNEATH the item, until you pick the item up and put it back down again, at which point that item becomes the tile at the top of the 'pile'.

any thoughts? how would i move a tile 'to front' or 'to back' using the code, as i can by right clicking on it in the map editor?

thanks.

p.s. i also tried leaving it on top, but disabling it, however that bit of code still 'sees' the tile, even tho it's disabled, and it tells you that you're looking at an item which actually isn't visible at that point....

👍 0
#61814

it's ok, i've worked out how to do it.

when he 'looks' at an tile, the game was cycling through the 'stack' of tiles he was in front of, and returning the first one it found, whether that was on level 1 or 0 or whereever.

so what i did was encase that cycle within another cycle, so that it is looking first for tiles on level 2, and if it doesn't find one, then looks on level 1, then on level 0.

works perfectly! :teethy:

👍 0
#61818
Yep, that's the correct way to do it.
👍 0