Quote from: RootBound on Fri 26/04/2024 12:00:36Just take that first "return" out
That first return is fine if you don't want anything to happen each time the dialog starts.
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: RootBound on Fri 26/04/2024 12:00:36Just take that first "return" out
function room_Load()
{
player.ManualScaling = true;
player.Scaling = 200;
}
// Dialog script file
@S // Dialog startup entry point
return
@1 // when first option is clicked, player says "Hi", then script runs from here
JC: HELLO
return
if (GetLocationType(mouse.x, mouse.y) != eLocationNothing)
Hotspot* h = Hotspot.GetAtScreenXY(mouse.x, mouse.y);
if (h != null && h.GetProperty("no_verbcoin")) { // boolean property, default value "false"
interface.Visible = false; // turn off verb coin if it's still visible
h.RunInteraction(eModeInteract);
return; // end handling here
}
Quote from: BowsetteGamer on Mon 22/04/2024 13:24:10AGS identifies that "Hello" and responds by saying "Hi, how was your day?"
Quoteand finally AGS gives an answer
if (prompt == "Hello") Display("Hi, how are you?");
else if (prompt == "I'm fine") Display("That's great.");
int slot = 1;
function Save() {
SaveGameSlot(slot);
slot = 3 - slot; // switch between #1 and #2 so slot is always the second to last savegame
}
function Undo() {
RestoreGameSlot(slot);
}
else if (button == eMouseLeftInv || button == eMouseRightInv)
{
InventoryItem* ii = inventory[game.inv_activated];
if (ii.GetProperty("interact")) ii.RunInteraction(eModeInteract);
else do_inventory_action(button, ii);
}
sorts[i+sorts[i].index].icone30
for (int j = i; j < 5; j++) { // 6 max spells
sorts[j].index = sorts[j + 1].index + 1; // add one and move up the list
}
int si = -1;
for (int i = 0; i < 6; i++) if (sorts[i].name == Sortswar.Items[Sortswar.SelectedIndex]) si = i;
// populate GUI using sorts[si] info
// room script file
enum KiteState {
eKiteCircling, eKiteSwoopingIn, eKiteSwoopingOut
};
KiteState kite_state = eKiteCircling;
int exposed_timer;
int circling_timer;
int kite_region; // 0 = right, 1 = top right, etc.
function room_Load()
{
cKite.z = -60;
kite_region = 0;
}
void caught_by_kite() {
Display("Caught by kite");
// QuitGame(0);
}
bool kite_is_outside_screen() {
ViewFrame* vf = Game.GetViewFrame(cKite.NormalView, cKite.Loop, cKite.Frame);
int hw = Game.SpriteWidth[vf.Graphic] / 2;
int h = Game.SpriteHeight[vf.Graphic];
if (cKite.x < -hw || cKite.x > Game.Camera.Width + hw) return true;
return cKite.y < 0 || cKite.y > Game.Camera.Height + h;
}
function room_RepExec() {
// is player in danger
bool danger_zone = Region.GetAtRoomXY(player.x, player.y) == region[5];
if (danger_zone && cEgo.IsCollidingWithChar(cKite)) caught_by_kite(); //death script
oDanger.Visible = danger_zone; // obj currently being used for testing
exposed_timer = (exposed_timer + 1) * danger_zone; // increase / reset timer
if (kite_state == eKiteCircling) {
// kite swoops for player, continuing straight if player moves
if (exposed_timer > 100) {
exposed_timer = 0;
kite_state = eKiteSwoopingIn;
float dx = IntToFloat(player.x - cKite.x);
float dy = IntToFloat(player.y - cKite.y);
float f = 2000.0 / Maths.Sqrt(dx * dx + dy * dy);
cKite.Walk(cKite.x + FloatToInt(f * dx), cKite.y + FloatToInt(f * dy), eNoBlock, eAnywhere);
}
else {
circling_timer++;
if (circling_timer >= 50 && !cKite.Moving) {
kite_region = (kite_region + 1) % 8;
float a = (IntToFloat(-kite_region)) * (Maths.Pi / 4.0);
cKite.x = Game.Camera.Width / 2 + FloatToInt(IntToFloat(Game.Camera.Width) * Maths.Cos(a), eRoundNearest);
cKite.y = Game.Camera.Height / 2 + FloatToInt(IntToFloat(Game.Camera.Height) * Maths.Sin(a), eRoundNearest) - cKite.z;
circling_timer = 0;
// visible top left
if (kite_region == 3 && !cKite.Moving) {
cKite.x = 300;
cKite.y = -100 - cKite.z;
cKite.Walk(-300, 200 - cKite.z, eNoBlock, eAnywhere);
} // visible bottom right
if (kite_region == 7 && !cKite.Moving) {
cKite.x = Game.Camera.Width - 300;
cKite.y = Game.Camera.Height + 100 - cKite.z;
cKite.Walk(Game.Camera.Width + 300, Game.Camera.Height - 200 - cKite.z, eNoBlock, eAnywhere);
}
}
}
}
// this makes the kite stop as soon as it has left the screen
if (kite_state == eKiteSwoopingIn && !kite_is_outside_screen()) kite_state = eKiteSwoopingOut;
if (kite_state == eKiteSwoopingOut && kite_is_outside_screen()) {
kite_state = eKiteCircling;
float a = Maths.ArcTan2(IntToFloat(cKite.y - Game.Camera.Height / 2), IntToFloat(cKite.x - Game.Camera.Width / 2));
kite_region = (FloatToInt(-a * 4.0 / Maths.Pi, eRoundNearest) + 8) % 8;
}
}
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 3.672 seconds with 15 queries.