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
Need some help with this script....
Doctorcheese Offline
Senior Member

Posts: 272
Threads: 28
Joined: Jan 2011
Reputation: 0
#1
Need some help with this script....

So here it is. I'm trying to make it so that when you enter an area called MonsterDoor a suitor called Scarydude starts bashing a door down to get to the player. There will also be a blurring of the screen and the player making a scared sound. Here's the script:

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

void CollidePlayerWithMonsterDoor(string &in asParent, string &in asChild, int alState)
{
ShowEnemyPlayerPosition(''Scarydude'');
FadeRadialBlurto(1.0f, 1.0f);
PlaySoundAtEntity(''MonsterDoor'', ''react_scare6.ogg'', ''Player'', true);
SetEntityActive("Scarydude", true);
}

////////////////////////////
// Run first time starting map
void OnStart()
{

}

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

}

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

}

Is there something wrong here?

Also a side question, anyone know why my game became extremely laggy when I deleted my map's .cache file?

Thanks for any help in advance.

''Sick, twisted child... You'll burn for this!''
06-18-2011, 06:27 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#2
RE: Need some help with this script....

You have two void OnStart() { }. Is the script working at all? Are there errors?
(This post was last modified: 06-18-2011, 06:39 PM by Roenlond.)
06-18-2011, 06:39 PM
Find
xtron Offline
Senior Member

Posts: 402
Threads: 37
Joined: May 2011
Reputation: 2
#3
RE: Need some help with this script....

(06-18-2011, 06:39 PM)Roenlond Wrote: You have two void OnStart() { }. Is the script working at all? Are there errors?

Two void OnStart() ?

Only one is required.

[Image: 44917299.jpg]Dubstep <3
06-18-2011, 06:41 PM
Find
Doctorcheese Offline
Senior Member

Posts: 272
Threads: 28
Joined: Jan 2011
Reputation: 0
#4
RE: Need some help with this script....

Oh snap.. missed that, I'll try editing so there's only one.
Ok so that didn't work. Here's how my entire .hps file for this map looks like;

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player","MonsterDoor","CollidePlayerWithMonsterDoor");
}

void CollidePlayerWithMonsterDoor (string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ScaryDude", true);
ShowEnemyPlayerPosition(''ScaryDude'');    
FadeRadialBlurto(float 1, float 1);
PlaySoundAtEntity(''MonsterDoor'', ''react_scare6.ogg'', ''Player'', true);
}

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

}

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

}

Any errors? The script isn't working at all, nothing happens when I pass the script area. Also might it be the .ogg sound file in the script? Can it playe .ogg's or do they have to be .SNT?

''Sick, twisted child... You'll burn for this!''
(This post was last modified: 06-18-2011, 06:49 PM by Doctorcheese.)
06-18-2011, 06:45 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#5
RE: Need some help with this script....

PlaySoundAtEntity needs .snt, yes, but the rest should work anyhow.

Try this

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "MonsterDoor", "CollidePlayerWithMonsterDoor", true, 1);
}

void CollidePlayerWithMonsterDoor (string &in asParent, string &in asChild, int alState)
{
SetEntityActive("ScaryDude", true);
ShowEnemyPlayerPosition(''ScaryDude'');    
FadeRadialBlurTo(1.0f, 1.0f);
PlaySoundAtEntity(''MonsterDoor'', ''react_scare6.ogg'', ''Player'', 0.0f, true);
}

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

}

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

}

If that's not working, double-check that you have matching names in your code and map.
06-18-2011, 07:04 PM
Find
Doctorcheese Offline
Senior Member

Posts: 272
Threads: 28
Joined: Jan 2011
Reputation: 0
#6
RE: Need some help with this script....

I've checked the names and they're all identical. I don't know what the problem could be! Undecided

Here's a picture of the map with the area and the suitor both selected just in case you'd need to take a look at it:

http://imageshack.us/photo/my-images/705/amnesia.png/

Btw, his ''Active'' box should be left unchecked if I want the script to spawn him, right?
Cause it's unchecked now.

''Sick, twisted child... You'll burn for this!''
06-18-2011, 07:20 PM
Find
Linus Ågren Offline
Senior Member

Posts: 309
Threads: 58
Joined: Jan 2011
Reputation: 5
#7
RE: Need some help with this script....

This Line: PlaySoundAtEntity(''MonsterDoor'', ''react_scare6.ogg'', ''Player'', 0.0f, true);
And this line: ShowEnemyPlayerPosition(''ScaryDude'');

I think the problem is that you use TWO ' instead of an actual ". Change the ' ' to " like this:
PlaySoundAtEntity("MonsterDoor", "react_scare6.ogg", "Player", 0.0f, true);
ShowEnemyPlayerPosition("ScaryDude");

Creator of The Dark Treasure.
06-18-2011, 08:01 PM
Website Find
Doctorcheese Offline
Senior Member

Posts: 272
Threads: 28
Joined: Jan 2011
Reputation: 0
#8
RE: Need some help with this script....

////////////////////////////
// Run first time starting map
void OnStart()
{
AddEntityCollideCallback("Player", "MonsterDoor", "CollidePlayerWithMonsterDoor", true, 1);
}

void CollidePlayerWithMonsterDoor (string &in asParent, string &in asChild, int alState)
{
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()
{

}

So there's my script now, the names are all identical, the '' are correct now, only one OnStart. And it still won't work Q_Q Dam scripting, yo scary.

Anything that isn't correct in that script? By all logic it's supposed to now spawn the suitor and do the other things...

''Sick, twisted child... You'll burn for this!''
06-18-2011, 09:16 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#9
RE: Need some help with this script....

You can use debug messages to check if player actually collides with the area.

06-18-2011, 09:18 PM
Website Find
Doctorcheese Offline
Senior Member

Posts: 272
Threads: 28
Joined: Jan 2011
Reputation: 0
#10
RE: Need some help with this script....

(06-18-2011, 09:18 PM)Tanshaydar Wrote: You can use debug messages to check if player actually collides with the area.

I'm not too familiar with debug messages, how do I know if I don't collide with it?

Also might it be something I've left unchecked in the Area tab of the Script's Area? I havn't checked any of the options except ''PlayerLookAtCallbackAutoRemove''. Should the others be checked too?

''Sick, twisted child... You'll burn for this!''
06-18-2011, 09:31 PM
Find




Users browsing this thread: 2 Guest(s)