Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: activate hotspot by clicking on another object  (Read 1001 times)

0 Members and 1 Guest are viewing this topic.

aleada21

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 3
  • Добро пожаловать в рай.
    • View Profile
activate hotspot by clicking on another object
« on: April 13, 2025, 05:59:48 PM »

Hi everyone, I hope this place will help with the answer, maybe my question will seem silly. I'm trying to do a quest and I need to do this mechanics: When you click on one of the objects, should activate a point in the same scene, to move to another. I tried to do through if else, for some reason comes out an error, I attach the code below. I hope for your help! I apologize for possible mistakes, my main language is Russian, I write through a translator.

Additionally, is it possible to implement something like a gallery? I see it as a sprite where each frame is a separate photo, when you click on the buttons the frame changes. And also, is it possible to disable fade when switching to another scene? I saw this parameter in ChangeScene, but maybe it is possible to do it globally?

Translated with DeepL.com (free version)

Code: [Select]
#include "scripts\base.inc"

// here comes the stuff which initializes the scene
global meow;



////////////////////////////////////////////////////////////////////////////////
// scene state
global Statespal1;
{
    if(meow == 1) {
        Scene.GetNode("meow").Active = true;
    }
    else {
        Scene.GetNode("meow").Active = false;
    }
}
// default values
if(Statespal1==null)
{
  Statespal1.Visited = false;
  // add scene states here
}



////////////////////////////////////////////////////////////////////////////////
// setup scene according to state variables



////////////////////////////////////////////////////////////////////////////////
if(!Statespal1.Visited)
{
  Statespal1.Visited = true;

  // this is our first visit in this scene...
}


Click script:

Code: [Select]
#include "scripts\base.inc"


on "LeftClick"
{
    meow = 1;
    Scene.GetNode("meow").Active = true;
    Game.Msg("CatActivate!");
}
« Last Edit: April 13, 2025, 06:02:28 PM by aleada21 »
Logged

aleada21

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 3
  • Добро пожаловать в рай.
    • View Profile
Re: activate hotspot by clicking on another object
« Reply #1 on: April 13, 2025, 08:45:55 PM »

did it
Code: [Select]
var miu = Scene.GetNode("meow");
miu.Active = false;
It seems to work, but maybe there are other options?
Logged

Mot

  • Occasional poster
  • **
  • Karma: 3
  • Offline Offline
  • Posts: 58
    • View Profile
Re: activate hotspot by clicking on another object
« Reply #2 on: April 15, 2025, 04:47:44 AM »

Hi aleada21 :)

Quote from: aleada21
It seems to work, but maybe there are other options?

What you did seems about right.

Quote from: aleada21
is it possible to disable fade when switching to another scene? I saw this parameter in ChangeScene, but maybe it is possible to do it globally?

You could create your own ChangeScene method (ie. a custom method), one that has the parameters FadeOut and FadeIn set to false. For example:

Code: WME Script
  1. {
  2.   this.ChangeScene(Filename, false, false);
  3. }

You can read more about the whole process in this section of the documentation:
Custom methods and objects.

Quote from: aleada21
is it possible to implement something like a gallery? I see it as a sprite where each frame is a separate photo, when you click on the buttons the frame changes

I'd say that the answer is yes. You can arrange images in a certain way and then trigger a change by clicking on a button. If you check out the wme demo project (also known as wme_demo.wpr), specifically the folder named interface, you will find examples of changes triggered by clicking on buttons.
« Last Edit: April 15, 2025, 05:15:48 AM by Mot »
Logged

aleada21

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 3
  • Добро пожаловать в рай.
    • View Profile
Re: activate hotspot by clicking on another object
« Reply #3 on: April 15, 2025, 10:53:10 AM »

Thank you!!!
Logged
 

Page created in 0.035 seconds with 19 queries.