Fixed

Started by Estaog, Thu 08/07/2004 09:21:49

Previous topic - Next topic

Estaog

So i was importing some walkable areas and i saved the game, loaded it and they were gone.It looks to me as the only way to save the areas is by clicking on another room.

Anyways this is the problem: I want to make a house with a roof, and when the player enters it he can see the hotspots etc.But what i cant figure out is how to make the roof fade out when he comes under it.For the hotsport i can easily use enable disable, and for when the character is under the in the house i can use a region.Is there a function to make an object fade out?

Thanks
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Gilbert

Hmmm are you sure the area mask you made was 256 colours and used only the first few colour slots for the areas?

For AGS V2.6SP1 or earlier, you can use a character for teh roof and use SetCharacterTransparency(). Or use RawDrawImageTransparent() if you're using newer version. I recommend the Character method though.

Estaog

But will it fade out or just go away?
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Mr Jake

if you settransparency you can differ the amount so it fades out

Gilbert

Depends on how you script it, if you use it in a while loop or something to adjust the transparency gradually it will fade out. (Of course, if only your game is on a colour depth of at least 16-bit).

Mr Jake

or you could make the roof an object and animate it

Estaog

  // script for region1: Player walks onto region
SetCharacterTransparency (0,10); 
SetCharacterTransparency (0,20); 
SetCharacterTransparency (0,30); 
SetCharacterTransparency (0,40); 
SetCharacterTransparency (0,50); 
SetCharacterTransparency (0,60); 
SetCharacterTransparency (0,70); 
SetCharacterTransparency (0,80); 
SetCharacterTransparency (0,90); 
SetCharacterTransparency (0,100); 

I used that script but it didnt fade out it just skipped to the last action.
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Gilbert

Because the function is not blocking. You have to use things like Wait() for it.
However, better, you cna use a while loop and simplify the code, eg:
int trans=0;
while (trans<=100) {
  SetCharacterTransparency (ROOF,10); 
  Wait(1);
  trans++;
}

also I don't suggesting using character character #0 for the roof, and it's always better to use the character's script name rather than the exact number.

Estaog

This script works better:
SetCharacterTransparency (0,10);
Wait(2); 
SetCharacterTransparency (0,20); 
Wait(2); 
SetCharacterTransparency (0,30);
Wait(2);   
SetCharacterTransparency (0,40);
Wait(2);   
SetCharacterTransparency (0,50);
Wait(2);   
SetCharacterTransparency (0,60);
Wait(2);   
SetCharacterTransparency (0,70);
Wait(2);   
SetCharacterTransparency (0,80); 
Wait(2); 
SetCharacterTransparency (0,90);
Wait(2);   
SetCharacterTransparency (0,100); 
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Snarky

You should take Gilbot's advice and use a loop and the script name. This will have the same effect as your code:

int trans=0;
while(trans<100)
{
   SetCharacterTransparency(ROOF,trans);
   trans+=10;
   Wait(2);
}

This will do the same thing, except more smoothly:

int trans=0;
while(trans<100)
{
   SetCharacterTransparency(ROOF,trans);
   trans+=5;
   Wait(1);
}


Estaog

Hmm, i cant understand the code but works fine.Just how do i make it fade in, change the 5 to a negatie number?
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Snarky

Loops are bits of code that are executed again and again as many times as you tell it to. The bit in between { and } is the loop, and the bit in while() controls whether run the code again (or at all). There's an explanation of how it works in the coding tutorial in the AGS manual.

You're right. To fade out you need to change +5 to a negative number (or change the += to a -=, which amounts to the same thing). You also need to make it start at 100% opaque and stop the loop when it reaches 0, like this:

int trans=100;
while(trans>0)
{
   SetCharacterTransparency(ROOF,trans);
   trans-=5;
   Wait(1);
}

Estaog

#12
if (chik1==0) {
  SetTimer (1,100);
if (IsTimerExpired(1)==1)
{  ChangeCharacterView (3,7);
chik1=1;   
}
  }
Changed it.But it didnt change the view.
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Mr Jake

#13
if (chik1==0) {
Ã,  SetTimer (1,1000);
Ã,  chik1=2;
}
if (chik1==2){
Ã,  if (IsTimerExpired (1) == 1){
Ã,  ChangeCharacterView (3,7);
Ã,  chik1=1;
Ã,  }
}


the way you had it would mean that the timer would never change, you also never had the IsTimerExpired correct.

Estaog

#14
Thanks, btw you missed a bracketÃ,  Ã, ::)

I changed it to this but the view still isnt getting changed.
if (chik1==0) {
  SetTimer (1,10);
  chik1=2;
}
if (chik1==2){
  if (IsTimerExpired (1) == 1){
  ChangeCharacterView (3,7);
  chik1=3;
  }
}
}

Btw this is sopposed to be part of my AI.
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Mr Jake

where is this script being placed?

Estaog

First time player enters screen.
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Mr Jake

ah ok
put this in first time player enters screen:

if (chik1==0) {
  SetTimer (1,1000);
}

and this is rep exe:
if (IsTimerExpired (1) == 1){
  if (chik1==0){
  ChangeCharacterView (3,7);
  chik1=1;
}
}

Estaog

Works fine now, it wasent checking for the timer, it checked only once.
Anyways this code works fine:
if (chik1==2){
  if (IsTimerExpired (1) == 1){
  ChangeCharacterView (3,7);
  Display ("One of your chicks has grown!");
  chik1=3;
  }
}
But leaves the character a bit visible, which is very annoying.I was thinking of using a SetCharacterTransparency() to 0 fter it finished the loop but i cant figure out where to put it.Help is apppritiated.
Think about the kittens man!

http://members.aol.com/johnk0/godkills.jpg

Mr Jake

I dont understand what you mean..... What you want to do

SMF spam blocked by CleanTalk