Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Is this possible? (NEW question)
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#1
Is this possible? (NEW question)

So I was thinking of making a script that checks what music is being played. Now unfortently there is no script that checks it. Is it possible to do it in another way?

Derp.
(This post was last modified: 06-11-2014, 06:27 PM by Neelke.)
06-11-2014, 12:49 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#2
RE: Is this possible?

You can use a variable to determine which plays. Whenever you use PlayMusic, also tick a SetLocalVarInt to a value. When changing the music, you can change that value. Then you can check for which variable matches in order to check the music. Do you know how to set up such a script?

06-11-2014, 01:27 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#3
RE: Is this possible?

Perhaps, but I wanna be certain. Could you perhaps give me an example? Kind of pathetic asking like this, but as I said. I wanna be certain.

Derp.
06-11-2014, 04:18 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#4
RE: Is this possible?

I'm unsure how you plan on changing the music this freaquently, but let's see.

PHP Code: (Select All)
void OnStart()
{
    
PlayMusic(music 1 etc);
    
SetLocalVarInt("Music"1);
}

void SomeCallback()
{
    
PlayMusic(change to music 2);
    
SetLocalVarInt("Music"2); 
}

void CheckMusic()
{
    if(
GetLocalVarInt("Music") == 1) {
        
//Music track number 1.
    
}
    if(
GetLocalVarInt("Music") == 2) {
        
//Music track number 2.
    
}
    if(
GetLocalVarInt("Music") == 0) {
        
//No music.
    
}
}

void NoMusic()
{
    
StopMusic(whatever music);
    
SetLocalVarInt("Music"0);


This is a very basic example. I'm sure you'll figure out where to place these things. As I said, I'm unsure what you need this for so I can't really tell you exactly what to put, but it should be fairly similar.

06-11-2014, 05:24 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#5
RE: Is this possible? (NEW question)

Actually, another question. Is it possible to also check if an enemy is searching or hunting the player?

Derp.
(This post was last modified: 06-11-2014, 06:26 PM by Neelke.)
06-11-2014, 05:35 PM
Find
MsHannerBananer Offline
Member

Posts: 218
Threads: 34
Joined: Sep 2013
Reputation: 10
#6
RE: Is this possible? (NEW question)

(06-11-2014, 05:35 PM)Neelke Wrote: Actually, another question. Is it possible to also check if an enemy is searching or hunting the player?

Just set up local (or global, if you're doing it across maps) variables. If you set up a local variable when the monster is spawned (and is therefore looking for the player), and set that variable to a number of your choosing, you can do a similar thing to what you did with the music.

In the script you have for the monster spawning, just add:

PHP Code: (Select All)
SetLocalVarInt(stringasNameint alVal); 

Then you just have to set up a point where it checks for the variable (I'd do it by script box), and do the same check that Mudbill has kindly provided for the music. Big Grin

(This post was last modified: 06-11-2014, 10:10 PM by MsHannerBananer.)
06-11-2014, 10:10 PM
Find




Users browsing this thread: 1 Guest(s)