Thank you Khris, that's really helpful for the project

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 MenuQuote from: Crimson Wizard on Thu 17/06/2021 23:34:17
Relevant parts of the script tutorial from the manual:
Variables: https://adventuregamestudio.github.io/ags-manual/ScriptingTutorialPart1.html#variables
More on conditions: https://adventuregamestudio.github.io/ags-manual/ScriptingTutorialPart2.html#multiple-conditions
Quote from: Cassiebsg on Thu 17/06/2021 22:53:34
Here you go, how to declare an IF: https://youtu.be/3LCiL1YCaWU?list=PL21DB402CB4DAEAEF
It's a bit old, but the basics are the same.
If you need the variables only for this room, you can declare them in the room script. If you need them globaly, you can declare them in Global script OR use the Global Variables (it's the Globe icon on the project tree). Once you declare variables here you can just start using them.
Quote from: arj0n on Thu 17/06/2021 20:30:56
You can create 4 bools and for each object when looking at it set the bool to true.
For the exit you can draw a region
When player stands on region:
- check with player.hasinventory if the player has taken the 2 object.
- check if all 4 bools are set to true.
If yes, exit screen, if not show response.
Quote from: Matti on Thu 17/06/2021 21:01:08
Using conditions and variables is very basic programming, that's why is has not been mentioned much
Quote from: Matti on Wed 16/06/2021 23:52:49
You have to make the walk command blocking, otherwise other things will happen simultaneously.Code: ags player.Walk(160, 135, eBlock);
If this doesn't help than the problem is related to the Tumbleweed template and I can't help you with that as I've never used it. But I don't understand why there would be a difference between walking to hotspots and walking to objects.
function BaggageTag_AnyClick()
{
// WALK TO
if (Verbs.UsedAction(eGA_WalkTo)) {
player.Walk(160, 135);
}
// TALK TO
else if (Verbs.UsedAction(eGA_TalkTo)) {
Verbs.Unhandled();
}
// LOOK AT
else if(Verbs.UsedAction(eGA_LookAt)) {
Verbs.Unhandled();
}
// OPEN
else if(Verbs.UsedAction(eGA_Open)) {
Verbs.Unhandled();
}
// CLOSE
else if(Verbs.UsedAction(eGA_Close)) {
Verbs.Unhandled();
}
// USE
else if(Verbs.UsedAction(eGA_Use)) {
Verbs.Unhandled();
}
// Push
else if(Verbs.UsedAction(eGA_Push)) {
Verbs.Unhandled();
}
// Pull
else if(Verbs.UsedAction(eGA_Pull)) {
Verbs.Unhandled();
}
// PICKUP
else if(Verbs.UsedAction(eGA_PickUp)) {
Verbs.Unhandled();
}
// GIVE TO (characters only)
else if(Verbs.UsedAction(eGA_GiveTo)) {
Verbs.Unhandled();
}
//USE INV
else if(Verbs.UsedAction(eGA_UseInv)) {
Verbs.Unhandled();
}
else Verbs.Unhandled();
}
function BaggageTag_AnyClick()
{
// WALK TO
if (Verbs.MovePlayer(160, 133)) {
player.FaceDirection(eDirectionRight);
}
// TALK TO
else if (Verbs.UsedAction(eGA_TalkTo)) {
Verbs.Unhandled();
}
// LOOK AT
else if(Verbs.UsedAction(eGA_LookAt)) {
player.Say("It's a passengers baggage tag. I can't read it without picking it up.");
}
// OPEN
else if(Verbs.UsedAction(eGA_Open)) {
Verbs.Unhandled();
}
// CLOSE
else if(Verbs.UsedAction(eGA_Close)) {
Verbs.Unhandled();
}
// USE
else if(Verbs.UsedAction(eGA_Use)) {
Verbs.Unhandled();
}
// Push
else if(Verbs.UsedAction(eGA_Push)) {
Verbs.Unhandled();
}
// Pull
else if(Verbs.UsedAction(eGA_Pull)) {
Verbs.Unhandled();
}
// PICKUP
else if(Verbs.UsedAction(eGA_PickUp)) {
Verbs.Unhandled();
}
// GIVE TO (characters only)
else if(Verbs.UsedAction(eGA_GiveTo)) {
Verbs.Unhandled();
}
//USE INV
else if(Verbs.UsedAction(eGA_UseInv)) {
Verbs.Unhandled();
}
else Verbs.Unhandled();
}
Quote from: Khris on Wed 16/06/2021 10:17:57
There's no built-in mechanism for this, however there's a really old module called MultiResponse:
https://www.adventuregamestudio.co.uk/forums/index.php?topic=27947.0
Quote from: Vincent on Wed 16/06/2021 10:15:55
You should check how many times the player has entered the region with an int, so on your 'Walks onto region' function you should write something simple like this:Code: ags int step = 0; function region0_WalksOnto() { if (step != 3) step ++; if (step == 1) player.say("I cant go that way."); else if (step == 2) player.say("Seriously, I cant go that way."); else player.say("I have told you already, I cant go that way"); }
Quote from: Khris on Tue 15/06/2021 11:49:58
Functions for room-specific things like objects and hotspots go into the room script, those for characters and inv items go into the global script.
However: you don't have to worry about that because when you create the event handler, AGS puts the function in the correct script for you. You just provide the contents.
You select the object/hotspot/character, open the events tab (lightning bolt icon) then click on the "any click on" event, then click the ellipses button [...]
AGS creates the function, links it to the event and opens the script for you. Now you insert the code.
Note that how to do this for a hotspot is explained in the manual's tutorial, and you're supposed to complete that before using anything more complex.
Quote from: Khris on Mon 14/06/2021 13:15:16
The Tumbleweed template comes with a Verbs.Unhandled() function.
Say you have a hotspot, a sign:Code: ags function cChar_AnyClick() { // WALK TO if (Verbs.UsedAction(eGA_WalkTo)) { Verbs.GoTo(); } // LOOK AT else if(Verbs.UsedAction(eGA_LookAt)) { player.Say("It's a sign."); } // all other actions else { Verbs.Unhandled(); // show default unhandled message depending on used verb } }
Note that the Tumbleweed template comes with its own manual which details the available functions.
It assumes familiarity with both programming and AGS basics though.
Quote from: Khris on Mon 14/06/2021 13:15:16
It assumes familiarity with both programming and AGS basics though.
Quote from: Matti on Mon 14/06/2021 11:10:27
Yes, you would have a function like this in Global Script:Code: ags function unhandled_event(int what, int type) { if (what == 1) // hotspots { if (type == 1) // Look at hotspot { } else if (type == 2) // Interact with hotspot { } ...
The help file does have a part about unhandled events in the Tumbleweed template, and it says: "The messages itself are defined outside of this function, initially in TemplateSettings.asc."
Quote from: Khris on Mon 14/06/2021 13:25:41
This:Code: ags player.Walk(270, 143, eDirectionLeft);
only works as expected by sheer coincidence. The third parameter of Character.Walk is the blocking parameter and supposed to be either eBlock or eNoBlock. (You want eBlock here.)
As soon as you type the comma after the 143, AGS should show an auto-complete window displaying the two available options. These enums are just ints internally, so this doesn't cause an error, but eBlock is 919 and eDirectionLeft is 6. The line does behave as if you had typed eBlock but again, this is just a happy accident.
As for the "while standing on region" event, the linked function is called 40 times per second. Only code that has to run every frame is supposed to go in there, not one-off stuff like walking back and making a comment.
Quote from: Matti on Mon 14/06/2021 01:36:40
I think what you're looking for is unhandled_event.
/* Character, Object, Hotspot full blown SAMPLE
function cChar_AnyClick() {
// WALK TO
if (Verbs.UsedAction(eGA_WalkTo)) {
Verbs.GoTo();
}
// TALK TO
else if (Verbs.UsedAction(eGA_TalkTo)) {
Verbs.Unhandled();
Player.Say("I can't talk to that.");
}
// LOOK AT
else if(Verbs.UsedAction(eGA_LookAt)) {
Verbs.Unhandled();
}
// OPEN
else if(Verbs.UsedAction(eGA_Open)) {
Verbs.Unhandled();
}
// CLOSE
else if(Verbs.UsedAction(eGA_Close)) {
Verbs.Unhandled();
}
// USE
else if(Verbs.UsedAction(eGA_Use)) {
Verbs.Unhandled();
}
// Push
else if(Verbs.UsedAction(eGA_Push)) {
Verbs.Unhandled();
}
// Pull
else if(Verbs.UsedAction(eGA_Pull)) {
Verbs.Unhandled();
}
// PICKUP
else if(Verbs.UsedAction(eGA_PickUp)) {
Verbs.Unhandled();
}
// GIVE TO (characters only)
else if(Verbs.UsedAction(eGA_GiveTo)) {
Verbs.Unhandled();
}
//USE INV
else if(Verbs.UsedAction(eGA_UseInv)) {
Verbs.Unhandled();
}
else Verbs.Unhandled();
}
*/
/* Inventory SAMPLE
// LOOK AT
else if(Verbs.UsedAction(eGA_LookAt)) {
Unhandled();
}
// USE
else if(Verbs.UsedAction(eGA_Use)) {
Unhandled();
}
// Push
else if(Verbs.UsedAction(eGA_Push)) {
Unhandled();
}
// Pull
else if(Verbs.UsedAction(eGA_Pull)) {
Unhandled();
}
//USE INV
else if(Verbs.UsedAction(eGA_UseInv)) {
Unhandled();
}
else Unhandled();
*/
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.059 seconds with 13 queries.