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 - kampfkaese

#1
Quote from: Khris on Tue 29/07/2014 18:56:43
I must have been really tired when I posted this. NPCs don't trigger Region events, and that's the reason the cat won't walk. If they did though, you would have to use "walks onto" as opposed to "while standing on".
What you have to do instead is use timers; you check for the region at the cat's feet, then send him to the next region and set the timer again. This will prevent the command from getting called repeatedly:
Code: ags
function room_RepExec() {
  Region *r = Region.GetAtRoomXY(Kater.x, Kater.y);
  if (Kater.Room == player.Room) {
    if (IsTimerExpired(1)) {
      if (r.ID == 1) {
        Kater.Walk(...); // send to next region
        SetTimer(1, 200);  // prevent the above command from running again immediately
      }
      ...
    }
  }
}

You can start this by placing Kater on a region and calling SetTimer(1, 1) in after fadein.

Regarding scripting: neither AGS nor the manual is supposed to teach you how to program. I understand that it can be quite a challenge to use AGS as someone who has never programmed before, but you are creating adventure games, not paper airplanes.

Thank you!

(and cassie and the one with the Book! too)

Edit:
"Juhuuuuu" xD It Worked!

Code: ags

function fclose_Interact()
{
  Region *Feedi = Region.GetAtRoomXY(Kater.x, Kater.y);
    if (Feedi.ID == 1) 
    {
    cEgo.Walk(400, 386, eBlock); 
    fclose.Visible=false; 
    fopen.Visible=true;
    Kater.Walk(485, 248, eBlock); 
    Kater.ChangeView(7);
    Kater.Move(331, 164,  eBlock, eAnywhere);
    Kater.ChangeView(9);
    Kater.Move(316, 216,  eBlock, eAnywhere);
    Kater.ChangeView(8);
    }
    else
    {
    cEgo.Walk(400, 386, eBlock);  
    fclose.Visible=false;
    fopen.Visible=true;
    }
}

#2
Hey, thanks!

Maybe I'll find something in German Forums, i never really searched for it.

Anyway, no matter how difficult it is to understand with the wiki and so on, big thanks to the community. On Other Forums i would be warned for my multiple Questions and would not be allowed to make a Thread for Different Questions like here.
#3
Thank you for that Waypoint thing! That sounds perfect.

The thing  about variable declaration.... ok i searched the manual another time since i posted this post. I think there should be a complete scripting Workshop, not just 2 Pages with 4 examples -.- I never found something that explains the script language from first Hello World - over - variables - to - Arrays, just single Pages which are not linked. Then there is the Language Barrier.

It would really help me if somebody would now a complete Step - by - step tutorial for the Programming language... With the most common fields of use...
Some Kind of working game complete with Roomchanges, different Detection methods, Inventory etc from the first step, to a Working 2- Room Game with openable Cabinets with hidden objects, Transparent Characters, eblock, eAnywhere, Variables, If switches, working Speech etc...

I did not find any... I have a code referrence, which dosnt Explain anything but has everything listed:

Scripting Reference, where i did not find something detailled about Variables, but the two pages about Object and Character Properties

And the Manual which explains first steps (Placing objects changing rooms etc) and Many different Points with no direct Relation to another



It Would be handy if Somebody would have a complete step by step tutorial about scripting...

Does any?

Sorry my english is not THAT.. good :D

Thanks
#4
Quote from: Khris on Tue 29/07/2014 02:47:02
You're supposed to use Regions for stuff like that; the "stands on hotspot" event is only included for backwards compatibility and will trigger every game frame / 40 times per second, just like "while player stands on region". Which means the .Walk command is also called 40 times per second, which makes the character get stuck because they constantly start their walk over again.

I Tried using Region now but no difference. When the Cat walks onto the region nothing happens when i use "While Standing on, do..."

Code: ags

function region1_Standing()
{
cEgo.Walk(219, 244);
cEgo.Walk(500, 244);

}


The cat should walk on the Table from the left vorner to the right, and back

Another Problem:

The Check for a Variable Set to 1 wont function either..
Now the declared Variable wont lead to an error message but The If Check Doesn't Work.

Code: ags

function fclose_Interact()
{
  if (Feed==1) // Ignored by AGS or was not transferred from Global Script to Room Script or RAM or What else :D
    {
    cEgo.Walk(400, 386, eBlock);
    fclose.Visible=false;
    fopen.Visible=true;
    Kater.Walk(485, 248, eBlock);
    Kater.ChangeView(7);
    Kater.Move(331, 164,  eBlock, eAnywhere);
    Kater.ChangeView(9);
    Kater.Move(316, 216,  eBlock, eAnywhere);
    Kater.ChangeView(8);
    }
    else
    {
    cEgo.Walk(400, 386, eBlock);  
    fclose.Visible=false;
    fopen.Visible=true;
    }
}
#5
Quote from: slasher on Tue 29/07/2014 13:17:51
One way:

You could make an int variable (Feed) in the global pane and set it to 0.

Feed would then be recognized in every room.

Once you make Feed=1 you can then use
Code: ags

{ 
 if (Feed==1) // if Feed value has been changed to 1
{
 // Do this if Feed=1 
}
}


Even have else if and else statements if required.

If you are going to have Feed=2, Feed=3 etc then an Int is what you want else a boolean would do as false or true.

afaik a variable must be declared before you can use it ie above where it is to be used.

Thanks! i did not know where to declare it.

Found it!
#6
Another Problem:

I want to let the cat jump out of the window when the Player feedet the cat. For that reason i used an if question if int Feed=1, when Player interacts with the closed Windows Animation Object. But the Game doesnt Recognize "Feed" even if i set "Feed=0" in Global script at the beginning.

Code in Room2.asc

Code: ags

function fclose_Interact()
{
if (Feed==1)                 // Check 
{
  Display ("Walkto, Sprunganimation, etc.");
}
else{
fclose.Visible=false;
fopen.Visible=true;
}
}


Code in Globalscript.asc:

Code: ags

function Kater_UseInv()
{
  if ( (player.ActiveInventory==inventory [7]) || (player.ActiveInventory==inventory [4]) )
    {     
    if (Kater.Room==2)
      {
       if ((player.HasInventory(Napfivoll)) && (player.HasInventory(essenfertig)) )
          {    
            cEgo.Walk(555, 356,  eBlock);
            object[9].Visible=true;
            object[10].Visible=true;
            int Feed=1;                     // Declaration
            cEgo.Walk(505, 380);
            Kater.Walk(603, 325,  eBlock);
            Kater.ChangeView(6);
            Kater.Animate(0, 6);
            Kater.Animate(0, 6);
            Kater.ChangeView(3);
            Kater.Walk(466, 384,  eBlock);
            Kater.ChangeView(4);
            Kater.Walk(444, 244,  eBlock,  eAnywhere);
            Kater.ChangeView(3);
            Kater.Walk(320, 247);
            
          }  
       else
          {
          Display("Die Katze braucht Wassser -und- Nahrung.");
          }
      }
    else
      {
      Display("Ich füttere die Katze besser in der Küche.");
      }
   
    }
  else
  {
    Display("Das möchte er nicht..");
  }
}


The code and the Animation is not yet ready its just some Brainwork, to get it sorted.. I make it better when eveything is working and at the right place :)
#7
Thank You!! Now everything works fine... It was really very easy..


Next Problem:

How would you let a character move permanently, without blocking the Script or using a seperate Animation? I Tried to let the Cat walk onto A Hotspot which sends the Cat to another Hotspot, which sends it back just via "cCat.walk()" and "Stands on Hotspot", but nothing happens when the cats arrived at Hotspot 1..
#8
Hello!

Because i have many Problems which i sometimes cannot solve for myself, i wanted to start one Thread for some different Questions.

My first Question is that i want to call an object from my Room2 in the Globalscript.. This is not possible because Globalscript cannot recognise my Room Specific Objects...

Here is my Sourcecode:

Code: AGS
function Kater_UseInv()
{
  if ( (player.ActiveInventory==inventory [7]) || (player.ActiveInventory==inventory [4]) ) 
    {     
    if (Kater.Room==2)
      {
       if ((player.HasInventory(Napfivoll)) && (player.HasInventory(essenfertig)) )
          {    
            cEgo.Walk(555, 356,  eBlock);
            wassernapf.visible=true; // <- Here is the Problem! What to do with it?!
            volleschale.visible=true; // <- Here is the Problem! What to do with it?!
            cEgo.Walk(505, 380);
            Kater.Walk(603, 325,  eBlock); 
            
          }  
       else
          {
          Display("Die Katze braucht Wassser -und- Nahrung.");
          }
      }
    else
      {
      Display("Geh Küche");
      }
   
    }
  else
  {
    Display("Das möchte er nicht..");
  }
}


The Errormessage is:

Quote
GlobalScript.asc(265): Error (line 265): Undefined token 'wassernapf'
#9
Quote from: Khris on Sun 27/07/2014 15:32:04
Just for reference: when you look at the Character section of the manual (and many others), you'll get a list that first contains all functions in alphabetical order, then all properties, also in alphabetical order.

Functions are commands, always with () at the end, where one usually passes one or more parameters, unless it's something like Character.StopMoving().

Properties give information about the game state, many of them can also be changed by assigning them new values. This is the first place to look when you want information about some script entity; the properties list starts with .ActiveInventory and further down, there's .Room, which is exactly what you have been looking for.
Oh yes!!

I read all the Titles Twice because thats my favorite Source for Code help, but missed it twice ^^ Thanks alot..
#10
First: Thank you for the command!

@Ghost:
Thank you & I'm Sorry! Your're right! ;)

Its was just very difficult to find the right Answers in English because Google gives not that Good answers, belonging to AGS and my English is not that good!

Thanks if you allow me to do this further, in a seperate Thread in case i really dont find anything for some time.


#11
Hello!

I searched the Character Funktions for a specific function, but had no success.. How do i Get the Room Number where a specific Player is in?

I need it to check if "Cat" is in the Kitchen, so that when this is true, the Player and the Cat walk to a hidden Catfood and Drinking spot and make it visible, followed by a feeding animation.
#12
Thank you!!! I tested it seperately and it worked perfect...
The Animation itself is not yet perfet, i'm new at animating at all.
First i just want to have the complete scene functioning. I have to learn much and tryed AGS Several times before but i learned much in PHP over the Year so AGS looks now very nice to me and even Animating wont bother me this Time :D

When i complete the Scene with the cat and everything works fine, i maybe add a next scene and make the old ones better and better if i got time..

Thank you!
#13
Hello!

I want my Cat Character jump on a Table. I made some jump Animation which i either want to use as a Animated object and Teleport the Cat onto The Walkable Area on the Desk, or i would add the Animation to the cats Animation/Views but have to Move The cat between two Walkable Areas without connection.

Can somebody tell me a solution for that Problem?
#14
No thats another Problem. I want that the player walks in front of the cat when the User klicks on "Talk to cat"
#15
Hello!

I use Verbcoin Template with 640x480 Resolution. I Have the following Problem: The Inventory is 640x480 but the Game recognises this as 320x240, i guess. When i drag item 1 to item 3 the inventory closes, before i reach it. Please look at the screen

Screen:
Klick

Where do i have to Modify this?


EDIT: Got it Myself i Think! Its in the Global Script in the Beginning
Thank you!
#16
Another Problem:

How can i make my Character moving to another? i Tried this with "character.x" but it wont work..

Quote

function Kater_Talk()
{
cEgo.Walk(Kater.x,  Kater.y);
cEgo.Say("... Naaa mein kleiner?");
cEgo.Say("...");
Kater.Say("*Miau*");
}


#17
Thanks as far! I did it with normal Kater.walk() command! Works fine..
Thank you
#18
Hello!

I'm a total Newbie to the Scripting Language used in AGS ans i wanted to realise a Cat following the Character when he leaves the room.

My first Try:

Quote
function room_LeaveLeft()
{
  while(Kater.x!=cEgo.x)
  {
  Kater.FollowCharacter(cEgo);
  }
 
   
cEgo.ChangeRoom(2, 490, 395);
}

I must say a have really no Idea how to make it right and where to search in the Syntax Library, could somebody translate it into the right language? :D
#19
Yay!!! It works!!!

Thank your very very much!!!
#20
I dont really understand!

I just used the verbcoin template and room 1 has same resolution. Nothing is upscaled, i drawed in paint in that resolution. It looks a bit streched because i stitched it a bit but room1 is 640&480 and works fine.

The coordinates 20, 20 work! How can i get the game to use 640&480 in the second room, too? I want to use every coordinates i mean...

Here is room1:
Screenshot 1
Screenshot 2
SMF spam blocked by CleanTalk