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
New to this, having some trouble
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#11
RE: New to this, having some trouble

Adding the OnLeave stuff made it crash. Also I assumed I didn't need an OnLeave section since my map only consists of one area and I read that OnLeave is for when I leave the area via a level door.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
02-27-2013, 11:41 AM
Find
No Author Offline
Posting Freak

Posts: 962
Threads: 10
Joined: Jun 2012
Reputation: 13
#12
RE: New to this, having some trouble

Can you post the error ?
It's much easier to understand.

[Image: the-cabin-in-the-woods-masked-people.jpg]
02-27-2013, 11:48 AM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#13
RE: New to this, having some trouble

(02-27-2013, 11:48 AM)No Author Wrote: Can you post the error ?
It's much easier to understand.

Sure, though I'm not sure if you mean the error from when I first tried to use the "setlightvisible" or the one from when you had me add the OnLeave bit.


main (39, 1): ERR :Identifier 'Void' is not a data type
main (32, 36: ERR :'True' is not declared
main (36, 36): ERR :'False' is not declared
main (39, 1): ERR :Identifier 'Void' is not a data type
main (40, 1): ERR :Not all paths return a value

The 2 ones about True and False started when I tried to to get the setlightvisible bit to work, the rest showed up when I added the OnLeave bit. For completion sake here is my script as it is at the moment I get the errors.
PHP Code: (Select All)
void OnStart() 

    
AddEntityCollideCallback("Player""PlayerCollide""MonsterFunction"true1); 
    
AddEntityCollideCallback("Player""PlayerCollide_Spotlight""SpotlightOn"true1);
    
AddEntityCollideCallback("Player""PlayerCollide_SpotlightOff""SpotlightOff"true1);    
    
AddEntityCollideCallback("Player""PlayerCollide_key1""WallChange1"true1); 
    
AddUseItemCallback("""Key_AlcDoor""AlcDoor""UsedKeyOnAlcDoor"true);    


void MonsterFunction(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("servant_grunt_1"true); 
    
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_1"2"");
    
}

void UsedKeyOnAlcDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked("AlcDoor"falsetrue);
    
PlaySoundAtEntity("""unlock_door.snt""AlcDoor"0.0ftrue);
    
RemoveItem("Key_AlcDoor");
}

void WallChange1(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("Key1disappear_*",false);
    
SetEntityActive("Key1appear_*",true);
}

void SpotlightOn(string &in asParentstring &in asChildint alState)
{
    
SetLightVisible("Spotlight_4"True); 
}
void SpotlightOff(string &in asParentstring &in asChildint alState)
{
    
SetLightVisible("Spotlight_4"False); 
}

Void OnLeave()
{
///Other scripts


A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
02-27-2013, 12:08 PM
Find
No Author Offline
Posting Freak

Posts: 962
Threads: 10
Joined: Jun 2012
Reputation: 13
#14
RE: New to this, having some trouble

(02-27-2013, 12:08 PM)DeAngelo Wrote:
(02-27-2013, 11:48 AM)No Author Wrote: Can you post the error ?
It's much easier to understand.

Sure, though I'm not sure if you mean the error from when I first tried to use the "setlightvisible" or the one from when you had me add the OnLeave bit.


main (39, 1): ERR :Identifier 'Void' is not a data type
main (32, 36: ERR :'True' is not declared
main (36, 36): ERR :'False' is not declared
main (39, 1): ERR :Identifier 'Void' is not a data type
main (40, 1): ERR :Not all paths return a value

The 2 ones about True and False started when I tried to to get the setlightvisible bit to work, the rest showed up when I added the OnLeave bit. For completion sake here is my script as it is at the moment I get the errors.
PHP Code: (Select All)
void OnStart() 

    
AddEntityCollideCallback("Player""PlayerCollide""MonsterFunction"true1); 
    
AddEntityCollideCallback("Player""PlayerCollide_Spotlight""SpotlightOn"true1);
    
AddEntityCollideCallback("Player""PlayerCollide_SpotlightOff""SpotlightOff"true1);    
    
AddEntityCollideCallback("Player""PlayerCollide_key1""WallChange1"true1); 
    
AddUseItemCallback("""Key_AlcDoor""AlcDoor""UsedKeyOnAlcDoor"true);    


void MonsterFunction(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("servant_grunt_1"true); 
    
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_1"2"");
    
}

void UsedKeyOnAlcDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked("AlcDoor"falsetrue);
    
PlaySoundAtEntity("""unlock_door.snt""AlcDoor"0.0ftrue);
    
RemoveItem("Key_AlcDoor");
}

void WallChange1(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("Key1disappear_*",false);
    
SetEntityActive("Key1appear_*",true);
}

void SpotlightOn(string &in asParentstring &in asChildint alState)
{
    
SetLightVisible("Spotlight_4"True); 
}
void SpotlightOff(string &in asParentstring &in asChildint alState)
{
    
SetLightVisible("Spotlight_4"False); 
}

Void OnLeave()
{
///Other scripts


First, don't fill anything on the void OnLeave if you don't want to add the script now.
Second, don't use caps on the first letter on the true and false. It should be :
PHP Code: (Select All)
void SpotlightOn(string &in asParentstring &in asChildint alState)
{
    
SetLightVisible("Spotlight_4"true); 
}
void SpotlightOff(string &in asParentstring &in asChildint alState)
{
    
SetLightVisible("Spotlight_4"false); 

Third, Void OnLeave should be void OnLeave.

[Image: the-cabin-in-the-woods-masked-people.jpg]
02-27-2013, 01:09 PM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#15
RE: New to this, having some trouble

OK, doing your modifications (I had no idea that capitalization mattered) I was able to get the level to run, but the light still won't deactivate. I'm starting to think it's an engine error and not a scripting error on my part.

HOWEVER, being the cunning SOB I am, I came up with a solution. I raised the spotlight above the ceiling, moved it back a bit, and changed the FOV and Aspect to compensate so it gave the same general ray of light it did before, and now that it's up out of player sight (You can't see the spotlight source obviously, but out of where the player could see if you could) I put a small box directly in front of it and set the box to static physics so it won't fall. Now when I want to "activate" the light, I just deactivate the box which in turn lets the light through.

One less thing I have to worry about Smile

Thanks guys, I'll post again once I'm ready to release it or if I have any more problems.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
(This post was last modified: 02-27-2013, 02:56 PM by DeAngelo.)
02-27-2013, 02:55 PM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#16
RE: New to this, having some trouble

Alright, Night 2 and 3 more issues have popped up. I tell ya, the building of the level itself was easy peasy compared to this scripting stuff. Too bad HPL doesn't have a simple drag'n'drop way of scripting things the way something like LittleBigPlanet does. Then again I bet doing it this way gives the scripter more freedom and control over what happens. But I digress.

Problem 1: This problem was actually bigger till I fixed most of it. What I want is for the player to open a desk door, see a spider, freak out, then the spider vanish. Had a slew of problems getting this to work but I figured it out. But as it is now he just sees the spider, which just sits there doing it's little squat dance for 3 seconds, then disappears. I'd like to figure out how to A: Make that little "OHSHITWHATDAFUQ?" effect where the camera gets weird and that booming noise like a coyote getting it's nads ripped off plays. and B: instead of just disappearing, I'd like to make the spider "poof" away into dust the way monsters do when you set them to Hallucination. I'm sure A can be done but if B can't that's cool. Here's that part of my script:
PHP Code: (Select All)
void SpideyGoPoof(string &in asEntityint alState)
{
    if(
alState == 1//Only if the player is look at the area
{
    
AddTimer("Poof"3.0"Gone");
}

void Gone(string &in asTimer)
{
    
SetEntityActive("Spider_1",false);


Problem 2: I have a little ladder set up going into a small storage area, but when I climb it in the game and get to the top, the game forces me to walk forward for a while (I'd say the length of 6 barrels or so) I've included a screenshot of the ladder and the ladder area. It's probably something small and I messed up. (note in the screen some of the floor is missing, I removed it so you could see both the top and bottom parts of the ladder.)

Problem 3: In the screenshot from problem 2, you can see a hatch. It's locked at first and I'm gonna have it say "I don't need to go up there" when you click on it (I haven't had any problems related to my lang file yet so I'm not gonna ask for help there) then once you have to go up there a message of "You released the latch" when the player clicks on the door. My problem is that once the door is unlocked, it swings downward and just swings back and forth there, making it impossible to go up the ladder unless you time it just right or stand there for a moment steadying the door with your hand. Is there a way to make it freeze at the 90 degree angle once it swings down?



Thanks. Other than those problems, this map is coming along swimmingly.


Attached Files
.jpg   Ladder.jpg (Size: 286.04 KB / Downloads: 146)

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
(This post was last modified: 02-28-2013, 09:29 AM by DeAngelo.)
02-28-2013, 09:27 AM
Find
No Author Offline
Posting Freak

Posts: 962
Threads: 10
Joined: Jun 2012
Reputation: 13
#17
RE: New to this, having some trouble

(02-28-2013, 09:27 AM)DeAngelo Wrote: Alright, Night 2 and 3 more issues have popped up. I tell ya, the building of the level itself was easy peasy compared to this scripting stuff. Too bad HPL doesn't have a simple drag'n'drop way of scripting things the way something like LittleBigPlanet does. Then again I bet doing it this way gives the scripter more freedom and control over what happens. But I digress.

Problem 1: This problem was actually bigger till I fixed most of it. What I want is for the player to open a desk door, see a spider, freak out, then the spider vanish. Had a slew of problems getting this to work but I figured it out. But as it is now he just sees the spider, which just sits there doing it's little squat dance for 3 seconds, then disappears. I'd like to figure out how to A: Make that little "OHSHITWHATDAFUQ?" effect where the camera gets weird and that booming noise like a coyote getting it's nads ripped off plays. and B: instead of just disappearing, I'd like to make the spider "poof" away into dust the way monsters do when you set them to Hallucination. I'm sure A can be done but if B can't that's cool. Here's that part of my script:
PHP Code: (Select All)
void SpideyGoPoof(string &in asEntityint alState)
{
    if(
alState == 1//Only if the player is look at the area
{
    
AddTimer("Poof"3.0"Gone");
}

void Gone(string &in asTimer)
{
    
SetEntityActive("Spider_1",false);


Problem 2: I have a little ladder set up going into a small storage area, but when I climb it in the game and get to the top, the game forces me to walk forward for a while (I'd say the length of 6 barrels or so) I've included a screenshot of the ladder and the ladder area. It's probably something small and I messed up. (note in the screen some of the floor is missing, I removed it so you could see both the top and bottom parts of the ladder.)

Problem 3: In the screenshot from problem 2, you can see a hatch. It's locked at first and I'm gonna have it say "I don't need to go up there" when you click on it (I haven't had any problems related to my lang file yet so I'm not gonna ask for help there) then once you have to go up there a message of "You released the latch" when the player clicks on the door. My problem is that once the door is unlocked, it swings downward and just swings back and forth there, making it impossible to go up the ladder unless you time it just right or stand there for a moment steadying the door with your hand. Is there a way to make it freeze at the 90 degree angle once it swings down?



Thanks. Other than those problems, this map is coming along swimmingly.

Problem 3 : The hatch CAN'T be placed like that. It's just gonna do... that. Rotate the hatch.

I'll be back with more solutions.

[Image: the-cabin-in-the-woods-masked-people.jpg]
02-28-2013, 11:23 AM
Find
Adrianis Offline
Senior Member

Posts: 620
Threads: 6
Joined: Feb 2012
Reputation: 27
#18
RE: New to this, having some trouble

Ok...

Firstly the light thing, for future reference. From what I can tell it sounds like the same prob I had a while ago - I couldn't turn lights on because I had de-activated them initially in the map editor. Is this what you had done as well? If so, what you can do is set it to active again in the editor, then in OnStart/OnEnter you set the light visible to false, then true when you want it to turn on.

1 - GiveSanityDamage(float afAmount, bool abUseEffect);
That function has some screen stuff built in, the sudden narrowing effect that happens during scary events in TDD. There are also a whole bunch of effects under the 'Screen Effects' section of the engine script wiki page

3 - You might be able to use SetPropStaticPhysics(string& asName, bool abX); to make the hatch hang, but if it needs to swing open you might have to do some tweeking to get the timing right

No idea about 2, sorry Smile

02-28-2013, 11:28 AM
Find
DeAngelo Offline
Senior Member

Posts: 263
Threads: 26
Joined: Feb 2013
Reputation: 11
#19
RE: New to this, having some trouble

(02-28-2013, 11:23 AM)No Author Wrote: Problem 3 : The hatch CAN'T be placed like that. It's just gonna do... that. Rotate the hatch.

I'll be back with more solutions.

I realized about 2 minutes ago that my hatch was swinging open even though it was locked. Now I know why. I've rotated it.


(02-28-2013, 11:28 AM)Adrianis Wrote: Ok...

Firstly the light thing, for future reference. From what I can tell it sounds like the same prob I had a while ago - I couldn't turn lights on because I had de-activated them initially in the map editor. Is this what you had done as well? If so, what you can do is set it to active again in the editor, then in OnStart/OnEnter you set the light visible to false, then true when you want it to turn on.

1 - GiveSanityDamage(float afAmount, bool abUseEffect);
That function has some screen stuff built in, the sudden narrowing effect that happens during scary events in TDD. There are also a whole bunch of effects under the 'Screen Effects' section of the engine script wiki page

3 - You might be able to use SetPropStaticPhysics(string& asName, bool abX); to make the hatch hang, but if it needs to swing open you might have to do some tweeking to get the timing right

No idea about 2, sorry Smile

It doesn't seem to matter what I set the light to, they just can't seem to be changed while playing. My solution fixed it for now though so it's all good.




OK, I have a new issue. I knew when I opened my damn mouth about not having issues with my lang file I'd start having one right away. I'm trying to get a message to appear when I click on a locked door. I followed the tutorial on the wiki to the letter but the door still doesn't pop up any message. My door is named AlcDoor and in the Entity tab I have DoorLocked in the PlayerInteractCallback box, and the auto remove box checked. Here are my lang and script files.

PHP Code: (Select All)
void OnStart() 

    
AddEntityCollideCallback("Player""PlayerCollide""MonsterFunction"true1); 
    
AddEntityCollideCallback("Player""PlayerCollide_Spotlight""SpotlightOn"true1);
    
AddEntityCollideCallback("Player""PlayerCollide_SpotlightOff""SpotlightOff"true1);     
    
AddUseItemCallback("""Key_AlcDoor""AlcDoor""UsedKeyOnAlcDoor"true);    
    
SetEntityCallbackFunc("Cellar_Door_Key""OnPickupCellarKey");


void MonsterFunction(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("servant_grunt_1"true); 
    
AddEnemyPatrolNode("servant_grunt_1""PathNodeArea_1"2"");
}

void UsedKeyOnAlcDoor(string &in asItemstring &in asEntity)
{
    
SetSwingDoorLocked("AlcDoor"falsetrue);
    
PlaySoundAtEntity("""unlock_door.snt""AlcDoor"0.0ftrue);
    
RemoveItem("Key_AlcDoor");
}
void OnPickupCellarKey(string &in asEntitystring &in type)
{
    
SetEntityActive("CellarKeyDis_*",false);
    
SetEntityActive("CellarKeyApp_*",true);
}
void SpideyGoPoof(string &in asEntityint alState)
{
    if(
alState == 1//Only if the player is look at the area
{
    
AddTimer("Poof"3.0"Gone");
}

void Gone(string &in asTimer)
{
    
SetEntityActive("Spider_1",false);
}
void SpotlightOn(string &in asParentstring &in asChildint alState)
{
    
SetLightVisible("Spotlight_4"true); 
}
void SpotlightOff(string &in asParentstring &in asChildint alState)
{
    
SetLightVisible("Spotlight_4"false);
}

void DoorLocked(string &in asEntity)
{
if(
GetSwingDoorLocked("AlcDoor") == true)
{
SetMessage("Messages""AlLocked"0);
}
}

void OnLeave()
{



<LANGUAGE>
<CATEGORY Name="Inventory">
<Entry Name="ItemName_Key_AlcDoor">Wine Room Key</Entry>
<Entry Name="ItemDesc_Key_AlcDoor">Now I can get into that room. I can almost taste the wine.</Entry>
<Entry Name="ItemName_CellarDoorKey">Cellar Door Key</Entry>
<Entry Name="ItemDesc_CellarDoorKey">I need to get out of here.</Entry>

</CATEGORY>
<CATEGORY Name="Journal">
<Entry Name="Note_TakeThis1_Name">Take This</Entry>
<Entry Name="Note_TakeThis1_Text">If you're planning on going into the cellar any time soon, take these. It can get dark in there.[br]Your Landlord</Entry>
</CATEGORY>
<CATEGORY Name=“Messages”>
<Entry Name =“AlLocked”>Locked. There must be a key nearby.</Entry>
<Entry Name =“NoNotThisStuff”>I'm not interested in this stuff. I was told there were some rare vintage wines down here. Part of why I bought the place.</Entry>

</CATEGORY>
</LANGUAGE>



Edit: Moved the ladder around a bunch and kept trying it and finally found a sweet spot where it doesn't mess up.

A Late Night Drink http://www.moddb.com/mods/a-late-night-drink
Check out my LP channel, CatBearGaming, I take all Custom Story requests!
(This post was last modified: 02-28-2013, 11:52 AM by DeAngelo.)
02-28-2013, 11:41 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#20
RE: New to this, having some trouble

Ahh. You used the mark “”. It should have been "".
PHP Code: (Select All)
<LANGUAGE>

    <
CATEGORY Name="Inventory"
             <
Entry Name="ItemName_Key_AlcDoor">Wine Room Key</Entry>
        <
Entry Name="ItemDesc_Key_AlcDoor">Now I can get into that roomI can almost taste the wine.</Entry>
        <
Entry Name="ItemName_CellarDoorKey">Cellar Door Key</Entry>
        <
Entry Name="ItemDesc_CellarDoorKey">I need to get out of here.</Entry>    
</
CATEGORY>
    <
CATEGORY Name="Journal">
        <
Entry Name="Note_TakeThis1_Name">Take This</Entry>
        <
Entry Name="Note_TakeThis1_Text">If you're planning on going 
into the cellar any time soon, take these. It can get dark in 
there.[br]Your Landlord</Entry>
    </CATEGORY>
    <CATEGORY Name="Messages">
        <Entry Name ="AlLocked">Locked. There must be a key nearby.</Entry>
        <Entry Name ="NoNotThisStuff">I'
m not interested in this stuffI was told there were some rare vintage wines down herePart of why I 
bought the place
.</Entry>

</
CATEGORY

</
LANGUAGE

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 02-28-2013, 12:01 PM by PutraenusAlivius.)
02-28-2013, 11:54 AM
Find




Users browsing this thread: 1 Guest(s)