YolkfolkThe Dizzy Fansite 1 logged in0 playing
Community discussion

Coding Help

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

64 posts
#90893

1. How can I change Dizzy's tiles (costume) for temporary use? (like red nose mode in KoTapu)..

PlayerSet(P_TILE.. works only for idle and walk state but no up, jump and rest..

2. How to set a safe respawn point? (not to respawn in the dangerous zone)

Thanks in advance!

👍 0
#90894

@deflector To change Dizzy's appearance you use P_COSTUME and P_EMOTION. P_COSTUME changes all Dizzy's tiles, P_EMOTION just the idle tile. 

The game should respawn Dizzy somewhere safe by default but you can set a custom respawn by setting the O_DEATH variable on an object. Let's say we set it to 5. You write a function PlayerRespawn_5() which is called when you're killed by that object.

Also, do you know about the DizzyAGE book? You can download it from https://www.yolkfolk.com/dizzyage/download.html 

It has basic advice on how to use DizzyAGE. The Engine Reference and Template Reference are very useful.

👍 1
#90895
@noggin-the-nog I've read it and I should read it one more time) But I can't figure out how to connect P_COSTUME with new tiles (even from other game's code, and no useful info in the book about this) :confused:
👍 0
#90896

Update the Handler.gs file on the func HandlerPlayerUpdate section. Normally, the scuba is checked on the set costume coding so that if Dizzy is wearing the scuba that tile is used rather than the standard tiles. You can amend this to reflect the new set of tiles , such as using the status of  a hidden dynamic object to amend the costume, ie:

if (ObjGet(ObjFind(1000), O_STATUS) == 2) costume+=300 (or whatever starting tile number of the different set of tiles are - you may have to add ten to the file numbers to get the engine to opt for the right file, ie could be 310.

Change the status when you pick up or drop whatever item you are showing on the new set of tiles.

I'd recommend making a copy of the original Handler. gs file, so that you can replace it and start again if you totally screw up the coding.

I would offer you check out some of my games where this happens, such as Daisy's quest (wearing different coloured glasses), but typically, I think I password protected the pak file and have forgotten the password to unpack it. Sorry.

👍 1
#90897
@grandad That's it! Many thanks. I could search for it for ages. I still have a problem: when Dizzy died (drowned in the water) it respawns in the same place (not safe). Can you help to solve this?
👍 0
#90898

go back a page or two on this thread and find 'respawning on dry land', which is a follow on from Jamie's superb coding earlier (it was post 251 on page 26 of the 'general coding queries' thread, but with all the site changes it isn't on that page anymore).

There's a comment on it working fine on my almost spellbound dizzy, but essentially you check the playerrespawn function in the player file to set up the variables waterx and watery, set them as #def G_WATERX 105 and #def G_WATERY 106 in the gamedef file, then amend the ''set last safe point before player enters water' in the handler file (usually in handlerplayerupdate after the check clouds bit)

Try unpacking 'Daisy goes solo (2018) for the best version of this, as it also includes the player safe functions for respawning in water when you're wearing the scuba, and the waterx function respawns at the last place you were on solid ground before entering the water (even if you jumped off a cliff)... if I haven't password protected it (sorry if I have, I never keep track of old games).

 

👍 1
#90925

Hi! How to check if the object (an item) is present in a strict room (not only current)? or maybe count of items in a strict room.. thanks!

👍 0
#90926

Not sure what you mean deflector. Are you trying to establish where an item is? how many items are in any specific room? Can you be a bit more specific. {yolkfolk}:scratch:  

👍 0
#90928

@grandad The game situation: you need to take off an item from the room and close the door to this room after (irreversible action). But you should avoid this item being left in the room (in my case it's not about the current room). So that is the idea to check the room like described before but it could be the wrong thought.

Can I check the item's coordinates xy?

👍 0
#90930

Solved by getting the coordinates of the item) sorry for the newbie questions.

👍 0
#90931

I think I get it. You want to close off a room permanently, but not until an item has been removed from that room. If so, then it's not a big deal. You can't use the 'close room' coding as it's non-latent (can't have an 'if' statement in it).

If you have action or collide functions to enter and exit the room then just check whether the specific item is in your inventory when you leave and if so, set the enter function to either block entry or just disable it.

If the item has the id 500 the check  is:

if (InventoryHasItem(500))

Which means you can set the status of the room exit function to permanently shut if you have item 500 in your inventory.

Best of luck {yolkfolk}:yahoo:  

 

Just seen your new posting; never apologise for newbie questions, it's how we learn. 

👍 1
#90960

Hi! So the task is to connect the scuba and flippers in one item after reaching them. Previously they are defined separately in gamedef file. What and where do I need to write after the connection to set the new diving properties to a new item?

👍 0
#90961

@deflector 

@oo7samurai managed to do exactly that on Ko Tapu.

If you managed to unpack his game, you could try looking at that.

👍 1
#90962

@khaosadz @oo7samurai Yes, I've been watching it already. But can't figure out how and where to add a flippers ability to the new item (scuba kit).

UPD: solved! just miss func PlayerCanSwim() in player.gs file. thanks

👍 1
#90964

Sorry @deflector I've been a bit lacks in my posting on here lately; I'm afraid life has been getting a bit in the way of things. 

Looks like you've sorted it though - nice! But do post back if there is anything that you think I've done in mine that you'd like to work into yours (I've got to be honest - I did that much copy and pasteing from other people's code, I'd probably have to learn it all over again :lol: ).

I will get round to playing Borderland to the end...and finishing Illusion Island...and A Nice Cup Of Tea and Dizzy Quest - all of which I've started but haven't seen the endings of yet. 

Darn you life getting in the way! (oh - and probably spending too much time on the Extended Edition of Ko Tapu of course :teethy: )

Belated Happy Easter everyone!

👍 2
#90989
@grandad Have a problem.. Is it possible to get back all items from the bag (after InventoryClear command) by picking one item like a bag with your all items?
👍 0
#90992

@deflector I'm not sure if there is a way to do this, but I wouldn't think so unless you knew exactly what items were in your inventory at the time, as it would appear that the engine would just 'unmark' them as being in the 'Inventory directory'.

If you have a specific reason for making the player drop their bag, but want to be able to pick it up again, it might be more feasible by making a special function that when the inventory 'bag' is dropped then deletes the inventory items one at a time and resetting the x and y axes to a specific place (like a cupboard, or top of a mountain perhaps) where they could be picked up from; not forgetting to enable them again as when an item is lost from the inventory it is set as disabled.

Sorry if this isn't very helpful.

 

👍 1
#90995
@grandad Yes, I have the same idea but no realization. The problem is to define existing bag items to reset their position. It could be the wrong use of InventoryGet command and I have some mess with slots numbering. Could you help me to code this example?
👍 0
#90996

@deflector Not sure if we're talking about the same thing but if you are talking about moving all inventory items to the same place then the function would be on the lines of:

func dumpstuff()
{
if (InventoryHasItem(100))
{
idx = ObjFind(100);
InventorySub(idx);
ObjSet(idx, O_X, 4444);
ObjSet(idx, O_Y, 6666);
ObjPresent(idx);
}

and repeat for all items that may be in the inventory - which to be honest seems a huge function depending on what items are possibly in the inventory at that point.

What might be an easier solution would be to have a 'notice' saying 'no items allowed' just before a collider in the direction they are travelling to that has the command:

idx = InventoryCount(); if (idx!=0) (px = PlayerGet(P_X); px-=4; PlayerSet(P_X, px); then a message saying no items allowed.

Just a thought. 

👍 1
#90999

@grandad So the best solution I've found is to use game defines for each inv slot. The problem was in slot numbering, they are 0-2 (not 1-3 as I thought). 

func DumpStuff()
{
GameSet (G_BAGITEM1, InventoryGet(0));
GameSet (G_BAGITEM2, InventoryGet(1));
GameSet (G_BAGITEM3, InventoryGet(2));
InventoryClear();
}

and after:

InventoryAdd(GameGet(G_BAGITEM1));
InventoryAdd(GameGet(G_BAGITEM2));
InventoryAdd(GameGet(G_BAGITEM3));

Thanks for your help and idea :smile:  

👍 0