Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - actaria

#61
Quote from: Khris on Sun 21/08/2022 14:13:41
The short answer to the original problem is to handle the objects separately. Don't nest the checks for the two items. Just write one, then the other.

To easily solve both issues, change the game in the following way:
- make the open fridge part of the background, but without the door
- place objects inside the fridge
- place closed door object on top (it will have a lower baseline by default so it'll automatically cover the other objects
- when the fridge is opened / closed, simply change the graphic of the door object. Due to the different positions this requires adding blank space to the closed door

Hello,

Thank you Khris this is clearly a better way, without using variables i really like  it and will try very soon with another room.

Thanks again and  i will show my next room using your method

EDIT:
Ok i understand now but anyways you gave me new ideas to try  :)
#62
Quote from: Rik_Vargard on Sat 20/08/2022 19:25:32
Quote from: actaria on Sat 20/08/2022 12:47:11
same translation problem i am sorry i should have pay more attention.

My main language is also french, so sometime I use the french word for a variable or objects etc. when it comes more easily to me.   ;-D

O yes i just saw under your nice avatar (is it Dracula ?) that you are from Belgium  :)
#63
This is how i finally made it works

I created a global variable

eat_chicken  type int  initial value 0

code in the room:

Code: ags

function fridge_close_Interact()
{
  fridge_close.Visible = false;
  fridge_open.Visible = true;
  if (eat_chicken == 0)
   {
  chicken.Visible = true;
   }
    if (player.HasInventory(ichicken))
   {
  chicken.Visible = false;
   }
     }




Thank you all for your help once again.
#64
Quote from: Rik_Vargard on Sat 20/08/2022 11:53:57
Isn't there an error in line 7 ?

cihicken.Visible = false;
Hello and thanks for the help.

Yes it's because i translate from French to English to make it easier and i made a mistake typing here.

QuoteAnd maybe also in line 5

I have no error but maybe that's why it isn't working.

Quote
if (eat_chicken)  ... if you want to check if the chicken has been eaten you'll need:

if (eat_chicken = true);

and for line 10 I would write:

if (!player.HasInventory(ichicken)) chicken.Visible = true;
Ok i will try that  :)
Quote
And also here, an error?

bool eat_chikken = false;

same translation problem i am sorry i should have pay more attention.

Thanks for your help i will try again  :)
#65
I didn"t managed to make it work yet, i tried lots of differents things with variable using at the beginning of my room script

Code: ags
int myCounter = 0;


I tried lots of differents codes but none of them is working as expected.
I also don't understand how i declare in the global script the fact that he chicken has been eaten.


I also tried with a bool but didnt work etiher  :)

at the beginning of the room script

Code: ags

bool eat_chicken = false;


room scipt:

Code: ags

function fridge_close_Interact()
{
fridge_close.Visible = false;
  fridge_open.Visible = true;
   if (eat_chicken)
   {
  chicken.Visible = false;
   }
    else{
       chicken.Visible = !player.HasInventory(ichicken);
   }
 }



Thanks for your help i am kind of lost.




#66
Hello Pax  Animo,

Thanks for the reply i am still leaning and i didn't know about that command for the global script, this is what i was looking for.

Good thing that you warned me the fact  that all objects with the same ID will be affected.

I will see what is the best solution between this and using a bool

Very nice ideas thanks again i should be fine with this  :)
#67
Hello,

I am still working on a kitchen with a fridge.
With the help of Morganw i solved my fridge pick up items problem.

The player open the fridge and pick a chicken.
Then the player pick the chicken from inventory and click on the character to eat it

i went on my player character clicked on events that leads me to global script.

Global Script code:

Code: ags

function cChar1_UseInv()
{
if(cChar1.ActiveInventory == ichicken)
cChar1.Say("This chicken is delicious");
cChar1.LoseInventory(ichicken);
}


It works well but the problem is that since the chicken isnt in my inventory anymore it reappear in the fridge because of the condtion of my
fridge code and of course i want it to be gone forever in my stomach  :)



I tried to put:
chicken.Visible = false; in the global script but it looks that i can not call an object from there.

Here is the kitchen room code:

Code: ags

function fridge_close_Interact()
{
  fridge_close.Visible = false;
  fridge_open.Visible = true;
  chicken.Visible = !player.HasInventory(ichicken);
   }



I tried to find solutions and what is the best way to do this but i didnt find anything working.
Since it's kind of specific i didn't find anything that matches the same question.

Any help would be appreciated thanks a lot in advance.
#68
Its perfectly working  now.

I didn't know that you can do it that way it's so much better than what i was doing.

Thanks a lot Morganw you saved me and now i will use this method

Have a great day
#69
I don't think so i will try again thanks a lot
#70
I tried your code but unfortunately the fridge is empty when i open it  :)



My objects item are set on visible false that way they are hide until i open the fridge door

This is what i got with my code it's working when i pick both item or chicken first but not when i pick the cheese 1st as you can see





Thank you.
#71
I need to use Else if so i don't need both condiions to make them Visible = false ?

Am i wrong ?  :)
#72
Hello and thank you for the quick reply,

Plus my explanation was really bad it works well when i pick both items but no when i pick only one of them.

I will look at your code now and try to understand, you are right  my indentation is really bad.

Thanks again i will tell you if i managed to do it soon  :) and if i understand
#73
Hello,

I am struggling again with the IF, i think i am doing better since i have no syntax errors but something
isn't working well.

I have a fridge (2 objects) open and close door.
Inside the fridge there is cheese and chicken
i can pick both they are going in inventory and dispapear from the fridge but only when i pick the cheese first.
When i pick the chicken first close the fridge door and reopen it the cheese and the chicken are still inside !

I can't see what i am doing wrong this is the first time i use multiple IF and it looks like i am doing something wrong

My code when you click on the closed fridge:

Code: ags

function fridge_close_Interact()
{
fridge_close.Visible = false;
fridge_open.Visible = true;
cheese.Visible = true;
chicken.Visible = true;

if (player.HasInventory(icheese))
  {
  
   if (player.HasInventory(ichicken))
{

cheese.Visible = false;
chicken.Visible = false;
}
  }

else {
  cheese.Visible = true;
chicken.Visible = true;
}
 }



Thank you very much for your precious help each time i am stuck
#74
Hello,

Since i am a lazy girl and beginner at coding i choosed Rik_Vargard solution using region

region [1].Enabled = false;

It works really well, thanks again everyone  :)



#75
Thank you Cassiebsg
now i have all the steps and i should be able to do it properly.

"Also what eri0o tried to say was that you don't need to type object[owolf].SetView(10) , do instead oloup.SetView(10)."
O yes i understand now, i didn"t know that !

thanks also to you Rik_Vargard this is another nice suggestion by desactivate the region

"Not sure why the animation also restarts when you leave the area although you only used the "walks onto" event...?"
Yes Khris this is exactly my though and maybe i am crazy but yesterday the animation was not restarting when i was leaving the region.
I might i've done something.

I will remake the region from start.
and another great idea with the if (!oloup.Animating)

As usual you've all been so helpful... i don"t know what to say i am impressed each time.

Thank you all so much with all these solutions i might be able to do exactly what i wanted.

I will show the result when it's done  :)
#76
Yes i am sorry this is because i translated my code from french "oloup" to english "wolf" i forgot about the "o".

Actually i have 2 animations:

1/Sitting and breathing

2/ going up, howl and sit back

I will do like you said with transitions with "prepare" and "retreat" see what i am able to do that way.

Thanks again for your help it's really appreciated.
#77
Thanks a lot for the answer.

I choosed NonBlocking so the character can still move while the wolf is animated.

Am i wrong ? maybe there is something i am not understanding the right way ?

#78
Hello,
I hope eveyone is enjoying Sunday.

I am actually stuck on a problem.
I made a wolf that animate when i "walk into a region" in front of him




The problem is that when i walk out of the region the animation is launching again and if i go back into the region it will restart the animation again.

I would like that the animation can not be started again until it has been fully played and reached the end of the loop.

My code is the classic one:

Code: ags

function region1_WalksOnto()
{
object[owolf].SetView(10);
object[owolf].Animate(0, 1, eOnce, eNoBlock);
}


Unfortunately i have no idea on how do to that.
Or maybe there's another way to do it ?

Any help would be appreciated, thanks a lot in advance. :)





#79
O yes i understand so it can fit the lengh of the text.

Very nice explanation so i think i only deleted the little arrows and that's why i only got the little red squares.

Plus the fact that i didn't know about the dropdown at the top of the properties window that is what gets me wrong and lost.

Thanks again both of you, you guys are really great.
#80
Damn i didn't even know about that dropdown at the top of the properties window.

You are right they are all there but not at the correct position no idea why.

As you can see i have some in the middle:



I have to put them all at the right places with the coordinates right ?

I don't know what is their original positions but i will try to find how it's supposed to look

Thanks again for your precious help

SMF spam blocked by CleanTalk