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 SOLVED Collide function doesn't wanna work
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#1
SOLVED Collide function doesn't wanna work

For some reason, my collide function isn't functioning properly. It's made by string variables to check if the correct things are pressed and so on.

void ButtonPress(string &in asEntity)
{
    //Check which button that is currently being pressed
    if(asEntity == "button_simple_1")
    {
        SetLocalVarString("Brother", "CurrentTeleportCutscene");
        
        //Don't want the other buttons to be clicked at this point
        for(int i=0;i<5;i++) SetEntityInteractionDisabled("button_simple_" + i, true);
    }

void CollideChangeMap(string &in asParent, string &in asChild, int alState)
{
    string sMapChange = GetLocalVarString("CurrentTeleportCutscene");
    
    if(sMapChange == "Brother"){
        ChangeMap("nomapyet.map", "TeleEnter_1", "", "");
    }
}

void OnStart()
{
     AddEntityCollideCallback("Player", "AreaChangeMap", "CollideChangeMap", true, 1);
}

I have checked the name of the area and it is correct. Still doesn't wanna work. Just making sure here, is there anything wrong in the script?

Derp.
(This post was last modified: 04-06-2014, 01:03 PM by Neelke.)
04-06-2014, 12:35 PM
Find
RaideX Offline
Member

Posts: 212
Threads: 33
Joined: May 2013
Reputation: 7
#2
RE: Collide function doesn't wanna work

Try changing "SetLocalVarString("Brother", "CurrentTeleportCutscene");" the other way around to "SetLocalVarString("CurrentTeleportCutscene", "Brother");" because the first input is the name of the string and the second is the value of the string.

That way (sMapChange == "Brother") returns true and the block of code can be executed.


That might be the issue. I'm not entirely sure though.

If you don't draw first, you don't get to draw at all... -The False Shepherd
(This post was last modified: 04-06-2014, 12:45 PM by RaideX.)
04-06-2014, 12:44 PM
Find
Lizard Offline
Member

Posts: 174
Threads: 23
Joined: Jul 2012
Reputation: 5
#3
RE: Collide function doesn't wanna work

(04-06-2014, 12:35 PM)Neelke Wrote: For some reason, my collide function isn't functioning properly. It's made by string variables to check if the correct things are pressed and so on.

void ButtonPress(string &in asEntity)
{
    //Check which button that is currently being pressed
    if(asEntity == "button_simple_1")
    {
        SetLocalVarString("Brother", "CurrentTeleportCutscene");
        
        //Don't want the other buttons to be clicked at this point
        for(int i=0;i<5;i++) SetEntityInteractionDisabled("button_simple_" + i, true);
    }

void CollideChangeMap(string &in asParent, string &in asChild, int alState)
{
    string sMapChange = GetLocalVarString("CurrentTeleportCutscene");
    
    if(sMapChange == "Brother"){
        ChangeMap("nomapyet.map", "TeleEnter_1", "", "");
    }
}

void OnStart()
{
     AddEntityCollideCallback("Player", "AreaChangeMap", "CollideChangeMap", true, 1);
}

I have checked the name of the area and it is correct. Still doesn't wanna work. Just making sure here, is there anything wrong in the script?

Your void ButtonPress isnt close correctly. You're missing a }

CURRENT PROJECT:
A Fathers Secret == Just started
(This post was last modified: 04-06-2014, 12:46 PM by Lizard.)
04-06-2014, 12:45 PM
Find
Neelke Offline
Senior Member

Posts: 668
Threads: 82
Joined: Apr 2013
Reputation: 26
#4
RE: Collide function doesn't wanna work

Raidex - That did it, it now changed map just as I wanted it to, thanks.

Lizard - For some reason that } wasn't copied over from my script, so yeah thanks for spending your time anyway Smile

Derp.
04-06-2014, 01:02 PM
Find




Users browsing this thread: 1 Guest(s)