Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Shelf | Store

Privacy Policy


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need some help with this script....
Author Message
Tanshaydar Offline
From Beyond

Posts: 3,091
Joined: Mar 2009
Reputation: 66
Post: #11
RE: Need some help with this script....
AddDebugMessage(string& asString, bool abCheckForDuplicates);
For this and more: http://wiki.frictionalgames.com/hpl2/amn..._functions

Simply, add a:
AddDebugMessage("Debug Message: Area Collided! Now ScaryDude must be activated!", false);
or something like this in your CollidePlayerWithMonsterDoor function, and when starting the map, check the "Show Debug Messages" in debug menu.

06-18-2011 09:37 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Doctorcheese Offline
Senior Member

Posts: 274
Joined: Jan 2011
Reputation: 0
Post: #12
RE: Need some help with this script....
(06-18-2011 09:37 PM)Tanshaydar Wrote:  AddDebugMessage(string& asString, bool abCheckForDuplicates);
For this and more: http://wiki.frictionalgames.com/hpl2/amn..._functions

Simply, add a:
AddDebugMessage("Debug Message: Area Collided! Now ScaryDude must be activated!", false);
or something like this in your CollidePlayerWithMonsterDoor function, and when starting the map, check the "Show Debug Messages" in debug menu.

Like this?

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "MonsterDoor", "CollidePlayerWithMonsterDoor", true, 1);
}
void CollidePlayerWithMonsterDoor (string &in asParent, string &in asChild, int alState)
AddDebugMessage("Debug Message: Area Collided! Now ScaryDude must be activated!", false);
{
SetEntityActive("Scarydude", true);
ShowEnemyPlayerPosition("Scarydude");    
FadeRadialBlurTo(1.0f, 1.0f);
PlaySoundAtEntity("MonsterDoor", "react_scare.snt", "Player", 0.0f, true);
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

It's not working if I do that, maybe the area doesn't collide after all... If that is the case, how could I make it collide with the player?

(Damn this is turning into a big thread for one simple script Big Grin)

''Sick, twisted child... You'll burn for this!''
06-18-2011 10:08 PM
Find all posts by this user Quote this message in a reply
Doctorcheese Offline
Senior Member

Posts: 274
Joined: Jan 2011
Reputation: 0
Post: #13
RE: Need some help with this script....
Ok so I made a new script, I'm trying to replicate the scene where you encounter a grunt at the
Spoiler below!
stair in the prison from Amnesia

I had a look at their script file and here's how I changed it a bit:
(The area is now called ScriptArea_1 and the grunt(placeholder) is called servant_grunt_1.)

////////////////////////////
// Run first time starting map
void OnStart()
{
//GRUNT WHEN PASSING THE SCRIPT AREA
void CollideAreaScriptArea_1(string &in asParent, string &in asChild, int alState)
{
    SetEntityActive("servant_grunt_1", true);
    
    AddTimer("scare", 1.0f, "TimerPlayerReact");
    AddTimer("breath", 3.0f, "TimerPlayerReact");
    AddTimer("breathl", 5.0f, "TimerPlayerReact");
    
    ShowEnemyPlayerPosition("servant_grunt_1");
}

Any errors here? If there are no errors it must be the Area that is not colliding, in that case how do I make it collide with the player?

''Sick, twisted child... You'll burn for this!''
(This post was last modified: 06-19-2011 06:35 AM by Doctorcheese.)
06-19-2011 06:34 AM
Find all posts by this user Quote this message in a reply
rojkish Offline
Junior Member

Posts: 45
Joined: Jun 2011
Reputation: 0
Post: #14
RE: Need some help with this script....
void OnStart()
{
AddEntityCollideCallback("Player","MonsterDoor","CollidePlayerWithMonsterDoor");
}

At this ^ you missed both bool abDeleteOnCollide & int alStates, making it correctly would be;

"AddEntityCollideCallback("Player","MonsterDoor","CollidePlayerWithMonsterDoor", true, 1);"

You've also missed float afFadeTime on the playsoundatentity, making it correctly would be;

"PlaySoundAtEntity("MonsterDoor", "react_scare", "Player", 0.0, false);"

Other than that there is nothing wrong with the script overall and it should work. In case it doesn't I'll just redo it all for you.

Spoiler below!

void OnStart()
{
AddEntityCollideCallback("Player", "MonsterDoor", "CollidePlayerWithMonsterDoor", true, 1);
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}



void CollidePlayerWithMonsterDoor(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Scarydude", true);
FadeRadialBlurto(1.0f, 1.0f);
PlaySoundAtEntity("MonsterDoor", "react_scare", "Player", 0.0, false);
ShowEnemyPlayerPosition("Scarydude");
}


(This post was last modified: 06-19-2011 02:59 PM by rojkish.)
06-19-2011 02:16 PM
Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,091
Joined: Mar 2009
Reputation: 66
Post: #15
RE: Need some help with this script....
Debug Message doesn't work because you put it in wrong place. Try to put it after '{'

06-19-2011 02:40 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Doctorcheese Offline
Senior Member

Posts: 274
Joined: Jan 2011
Reputation: 0
Post: #16
RE: Need some help with this script....
Ok so now it's like this:
void OnStart()
{
AddEntityCollideCallback("Player", "MonsterDoor", "CollidePlayerWithMonsterDoor", true, 1);
}
void CollidePlayerWithMonsterDoor(string &in asParent, string &in asChild, int alState)
{
AddDebugMessage("Debug Message: Area Collided! Now ScaryDude must be activated!", false);
}
SetEntityActive("Scarydude", true);
FadeRadialBlurto(1.0f, 1.0f);
PlaySoundAtEntity("MonsterDoor", "react_scare", "Player", 0.0, false);
ShowEnemyPlayerPosition("Scarydude");
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

Anything wrong? What I think might be wrong is the debug messages place in the script, I think I put it in the wrong place since it's not working at all.

''Sick, twisted child... You'll burn for this!''
06-19-2011 03:13 PM
Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,091
Joined: Mar 2009
Reputation: 66
Post: #17
RE: Need some help with this script....
void OnStart()
{
      AddEntityCollideCallback("Player", "MonsterDoor", "CollidePlayerWithMonsterDoor", true, 1);
}
void CollidePlayerWithMonsterDoor(string &in asParent, string &in asChild, int alState)
{
     AddDebugMessage("Debug Message: Area Collided! Now ScaryDude must be activated!", false);
     SetEntityActive("Scarydude", true);
     FadeRadialBlurto(1.0f, 1.0f);
     PlaySoundAtEntity("MonsterDoor", "react_scare", "Player", 0.0, false);
     ShowEnemyPlayerPosition("Scarydude");
}

////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

06-19-2011 04:01 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Doctorcheese Offline
Senior Member

Posts: 274
Joined: Jan 2011
Reputation: 0
Post: #18
RE: Need some help with this script....
Well it didn't show me any debug messages this time, (used Tanshaydars script) I guess it doesn't collide with the player (the area)
How can I make it collide?

''Sick, twisted child... You'll burn for this!''
(This post was last modified: 06-19-2011 04:38 PM by Doctorcheese.)
06-19-2011 04:37 PM
Find all posts by this user Quote this message in a reply
Tanshaydar Offline
From Beyond

Posts: 3,091
Joined: Mar 2009
Reputation: 66
Post: #19
RE: Need some help with this script....
Are you sure "show debug messages" is checked in debug menu? (F1)

06-19-2011 06:16 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Doctorcheese Offline
Senior Member

Posts: 274
Joined: Jan 2011
Reputation: 0
Post: #20
RE: Need some help with this script....
(06-19-2011 06:16 PM)Tanshaydar Wrote:  Are you sure "show debug messages" is checked in debug menu? (F1)

Mmhm, it's checked all right.

But you can close the thread though, I remade the scene so I'll script it some other time Tongue There might be something wrong in my settings that prevent the scripts from working or something like that...

''Sick, twisted child... You'll burn for this!''
06-19-2011 08:08 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)