YolkfolkThe Dizzy Fansite 0 logged in0 playing
Community discussion

Coding Help

Started by deflector on 25 January 2023 • 4,497 views

64 posts
#90714

Hi guys! My first result of coding the fan game is almost done. I'll share it with you in closest future I hope. I still have a few questions:

1. Code for falling drops (hurt).. as I understand it is different from AIUpdateTrain.

2. Code for the game ending.

3. Where get music and fx? Maybe some templates I can use?

4. What game codes am I able to see (except the Mushroom pie)?

Thanks for help in advice.

👍 0
#90715

Hi.

I'm unable to help with the first two, but maybe with the latter.

[quote data-userid="92426" data-postid="90714"]

3. Where get music and fx? Maybe some templates I can use?

[/quote]

There are music and sound files available in the 'game' folder that comes with the engine.

But if you're after SFX from the original games, there's a large collection of .wav files on our site here.

There are some .ogg files for both music and sounds buried deep in the site's server somewhere I'll try and dig out when I get the chance.

[quote data-userid="92426" data-postid="90714"]

4. What game codes am I able to see (except the Mushroom pie)?

[/quote]

There are several early DizzyAGE games you can unpack and look at the scripts in them.

Basically anything by Jamie Douglas or Colin Page.

Hope this helps in some way. :smile:  

👍 1
#90717

@deflector Hi - happy to Message you the password for Ko Tapu Dizzy so that you can unpack that too if you like...if you then describe any parts of that game that you're interested in I may be able to point you to relavent pieces of code. 

I also happen to know that you can unpack the DizzyAge version of Crystal Kingdom..I know that code quite well too :blush: :lol:  

👍 2
#90719

For simple drops where the 'hurt object' doesn't change shape then the basic 'apple drop' code works well and I've added full details below. For more complicated acid drops where the drop changes shape before it drops and splashes as it hits the ground, then as well as 007's suggestion, you can unpack my 'Almost Spellbound Dizzy' and search for 'acid' in the game.gs file.

Apple Drops
To make objects such as apples drop down, disappear and then reappear at the starting point after a pause
is quite involved, but all you need to do is add the generic function (AppleDrop) to the Game.gs file.
This is coded in such a way that it will automatically pick up any dynamic object you set as a falling apple
on the map and you just need to activate each one with a simple line in the UpdateRoom function
for each room with a falling apple or apples.

It's also important to set the 'delay' rate for each apple on the map as the 'delay' line in the function
determines the pause before the apple starts to drop again. A good starting point is '50', but you can
change that to whatever suits your purposes. That way you can have apples falling at different times
in the same room.

Most important of all is to make sure the 'y' positions you set for where the apple starts
and where it finishes are divisible by the 'drop speed' or it won't work. Using y+=2 means
that if the top 'y' position is an odd number ie, 1325 then the bottom 'y' position must be an
odd number (divisible by 2). Likewise if the top position is an even number, set the lower
'y' position to an even number.

Cosmetically, it is also quite good to have the 'layer' of the apple lower then the place where
it starts and ends. That way it seems to disappear into the ground and if it starts behind a
clump of leaves on a tree will fall from behind the leaves.

////////////////////////////
The moving apple should be dynamic and start at status = 1, so that it starts to move as soon
as you enter the room. Set the 'delay' of the moving object to determine the time that the object
pauses at the end of it's run. You can also add hurt and death characteristics to both of the objects
..or even 'jump' so that it bumps Dizzy.
To add new apples, place them on the map then add a new room update with the correct numbers.
/////////////////////////////////
Just copy this function, the id, dtop and dbot will be determined by the room update

func AppleDrop (id,dtop,dbot)
{
idx = ObjFind(id);
if (ObjGet(idx, O_STATUS) == 0)
{
if (!IsUpdate(ObjGet(idx, O_DELAY)))
return;
ObjSet (idx, O_DISABLE, 0);
ObjSet (idx, O_STATUS, 1);
}

if (ObjGet (idx, O_STATUS) == 1)
{
y=ObjGet (idx, O_Y);
y+=2;
ObjSet (idx, O_Y,y);
ObjPresent(idx);

if (y==dbot)
{
ObjSet (idx, O_STATUS, 0);
ObjSet (idx, O_DISABLE, 1);
ObjSet (idx, O_Y, dtop);
}
}
}

////////////////////////////////////////
func UpdateRoom_2_1()
{
AppleDrop(1000,152,242);
}

For this example, the falling apple is in room 2_1, the ID is 1000, the starting y position is 152 and the
finishing y position is 242 (matching numbers remember).

👍 1
#90725

Next issue: on the start screen I've got the name of one room instead of "PRESS ANY KEY TO CONTINUE". Where it can be changed?

👍 0
#90726

Hello. You need to rename a spare room on the map and change these numbers in the gamedef file:

#def PLAYER_MAINMENUX

#def PLAYER_MAINMENUY

to co-ordinates inside that room.

👍 1
#90735

First of all thnks for your response and help.. I 've got the next task: when you take the exact item - change inventory max value (like set the weight value of the item from 1 slot to 3).. I've got some mess with these Inventory commands.

👍 0
#90736

@deflector Sorry, I don't understand what you mean. Do you want to increase the number of items Dizzy can carry?

👍 0
#90737

@noggin-the-nog yes, to set temporarily capacity of item bag from 3 to 1.. is it possible?

👍 0
#90738

I think the best solution would be first to define a new game variable. The def file is where those are kept. For example:

#def      100       G_HANDSFULL

 

We'll code it so that when we GameSet(G_HANDSFULL,1) that means we can only carry 1 item. When we GameSet(G_HANDSFULL,0) we can carry 3 items or however many you've set in the gamedef file.

Go to the inventory file and change the first function, InventoryCount()

 

https://postimg.cc/GH22pz6h

 

Now go through the file and wherever you see MAXINVENTORY, edit the function like the one above. Add the two lines at the top, and replace MAXINVENTORY with 'max'

I haven't tested this code, but it should work fine. All we're doing is changing the limit on the inventory. 

 

EDIT: Had to post the code as an image because the 'less than' sign in the code confuses the HTML

👍 1
#90739

@noggin-the-nog great! it works.. let's make it more complicated: if an exact item is present in the inventory then G_HANDSFULL, 1 and vice versa. How and where it can be written?

👍 0
#90740

You can always play around with the pickup object function in the action.gs file for specific items by adding something like the following at the start of the function:

if (InventoryHasItem(500) && InventoryCount(==1))
{Message1 (4,3, "\"I can't carry anything else\""); MessagePop(); return;}

or if carrying items when you try to pick it up, add some comment in about the item being too heavy to carry anything else in the DoPickupObject function and drop it, so that you have to drop the other items before you pick it up:

if (idx == ObjFind(500) && InventoryCount(>0)) {Message1 (4,3, "\"I can't carry this and other items at the same time\""); MessagePop(); DropObject(idx); return;}

Not forgetting that I'm not a proper programmer and this is just my odd methods of dealing with stuff {yolkfolk}:cheers:  

👍 1
#90741

[quote data-userid="92426" data-postid="90739"]

@noggin-the-nog great! it works.. let’s make it more complicated: if an exact item is present in the inventory then G_HANDSFULL, 1 and vice versa. How and where it can be written?

[/quote]

That's actually simpler than what I had in mind, which was based on my game Don't Panic Dizzy where you play as different characters with different sized inventories.

But yes, you need to use PickupObject and DropObject to make your changes. You don't need to edit the action file, you can just write functions like these. So if the heavy object has id = 500:

func PickupObject_500()
{
Write some code here

idx = ObjFind(500);
DoPickupObject(idx);
}

func DropObject_500()
{
Write some more code here

idx = ObjFind(500);
DoDropObject(idx);
}

S

👍 0
#90742

@noggin-the-nog I solved this problem in the way you wrote earlier, the edited action.gs works quite well. But I'll notice this version as well. Thanks! 

p.s. Where in the forum should I post the game for testing?

👍 1
#90743

[quote data-userid="92426" data-postid="90742"]

p.s. Where in the forum should I post the game for testing?

[/quote]

You can post it the Fan Games section. :smile:  

That's what samurai did when he needed his game testing.

👍 2
#90744

And the help and feedback I got was 100% invaluable. Still working on the extended edition (probably around 20 to 30 new rooms... quite cavey mazey)...I'll be kindly leaning on testers again late Summer hopefully.

@deflector I'll very happily take time out to test your new game though! 

👍 1
#90866

What soft do you use for writing script files? Recommend please the program where I can use gs9 commands from the pop-up window (and maybe use the color difference in command lines).Thanks!

👍 0
#90879
@deflector I just use notepad {eggs3}:haha:
👍 1
#90889

So.. the next task is: reducing the time spent underwater before drowning.. where to find?

👍 0
#90890

def.gs

#def   AIR_LEVEL             100

👍 1