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
#1
New to this, having some trouble

I'm sure you guys hear this at least twice a day from new users and by now you probably have gotten sick of it, but I got a new PC a month ago and bought Amnesia. I played a bunch of custom stories (About 20 or so) and then got the idea of "Maybe I should try making my own"

It started as just a bit of messing around with no real intent to create an actual map, but it's evolved a lot. The physical map itself is pretty much done with the exception of adding items like keys and oil and tossing in a few decorations to make it less bland, then I gotta script it all together and make a few notes. I know nothing of scripting but I've been gradually learning (Woke my girlfriend up at 3 AM by cheering because I managed to get a monster to walk across a room)

I wanted to wait as long as possible before asking for help and I've solved many of my problems by researching and watching/reading tutorials. But now I've encountered some problems I couldn't find solutions to. 3 so far (Probably will be more later on)

Problem 1: (This is the major problem, the other 2 I can work around on my own if I can't find a solution)
My doors keep getting stuck. I've followed every door tutorial I could find, but to no avail. It seems like they're rubbing against the door frame. It seems to worsen the more I open/close the door, but other times it does it right away. I tried fixing this by changing the proportions of the door to be slightly smaller so that the door is sorta "floating" within the doorway but unless I leave BIG gaps on each side it still gets stuck, and doing that allows the player to look through the gaps and also the door just looks goofy floating there.

Problem 2: Spotlight won't deactivate. I dunno what's going on here as all my other entities that start deactivated stay that way while I'm testing the level, but when I place a spotlight and uncheck the "active" box, I can still see the light while testing the level. I'll attach screenshots to show what it looks like in the editor vs. in game.

Problem 3: Is there any way to briefly make the player invincible? I have a part where the players slides down an incline but when I test the level he repeatedly gets hurt during it leaving him almost dead when he gets to the bottom. I know I could just put some laudanum at the bottom but it still breaks the immersion to have him constantly getting hit by nothing during the slide. I've thought of making the incline less steep then just taking control of the player once they get to it and making them run at full speed down it to simulate sliding but 1: Doing so leaves the incline not steep enough to make sliding down it believable and 2: the running speed isn't really fast enough to make the sliding believable.

Sorry to smack everyone with a wall of text on my first post. Thanks in advance to anyone willing to help my dumb ass.

P.S. I didn't put this as one of my problems as it'll be quite a while before I have to worry about this, but I have some custom entities in my story. When someone else goes to play it will the map be able to read them from the custom story folder (right now I have them in the main game folder under Entities>Gameplay>folder name of each one) or would I have to tell the player to manually put those entities in his main entity folder too?


Attached Files
.jpg   InEditor.jpg (Size: 153.15 KB / Downloads: 114)
.jpg   InGame.jpg (Size: 177.47 KB / Downloads: 112)

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, 07:23 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#2
RE: New to this, having some trouble

Problem 1: Most doors should work fine if you leave Snap to Grid on (set to 0.25). I think the arched castle door is one of the weird ones that needs to be adjusted. Most likely, the door is coilliding with ther frame or something else which is causing it to be stuck. Also, I'd try to avoid resizing the doors because it looks pretty strange and could also cause further problems. What are the doors that you are having problems with?

Problem 2: I think that is just a glitch with the editor. If you want the spotlight to not show up, you can set it's colour to 0 0 0 (black). Or alternatively, in your script you can use the function SetLightVisible(string& asLightName, bool abVisible) which will make the light invisible.

Problem 3: You can create a script area at the bottom of the incline, and script it so that when the player collides with the area, they receive some health. For example:
PHP Code: (Select All)
void OnStart()
{
    
AddEntityCollideCallback("Player""Script Area name here!""GiveHealth"true1);
}

void GiveHealth(string &in asParentstring &in asChildint alState)
{
    
AddPlayerHealth(50.0f);  // or use SetPlayerHealth to set the players health to a specific value

(this script is not tested and could contain errors)

You could also just leave it the way it is, because it makes sense that the player would get hurt a bit from falling. Of course, it's your choice though.

Problem 4...(?): The game will be able to read them from your custom story folder. Make a folder called "entities" in your custom story folder, and place all your custom entities in there.

In Ruins [WIP]
(This post was last modified: 02-27-2013, 07:44 AM by NaxEla.)
02-27-2013, 07:40 AM
Find
DeAngelo Offline
Senior Member

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

The door I'm using is the regular metal door (Metal.ent) with the castlebase door frame (door_frame.dae) and the doorway wall from the castlebase (doorway.dae) and I keep 0.25 snap to grid on at all times unless I'm lining up a torch or something.

I had a thought, is there any way to make it so that my door won't "collide" with the door frame, without effecting their collisions of the player or other entities? Then as far as the door is concerned there is no doorframe and it can swing all it wants. I know the door itself has a "collide" checkbox but that effects everything colliding with it.

Alternatively maybe I can import the door frame into the model editor and create a new body that's a bit smaller than the door frame to give the door more leeway while still colliding with the player and objects.

For the spotlight, setting it to 0,0,0 worked fine but is there a script to change it back once the player gets to the point where it's supposed to appear? Something like this: (I know the script probably has a lot of errors but since I don't know if a script like this exists I'm just throwing together what I think it might look like)

PHP Code: (Select All)
void OnStart() 

    
AddEntityCollideCallback("Player""SpotlightArea""TurnOnSpotlight"true1);     


void TurnOnSpotlight(string &in asParentstring &in asChildint alState)
{
    
SetLightColor("Light1"0.7 0.7 0.55True);

As I said, I know nothing about the actual inner workings of scripts (yet, I'm trying to learn) I've just been able to jury-rig my scripts by copying sample scripts from tutorials and figuring out which bits to change to suit what I'm trying to do.


For the slide, I was thinking and I think I'll leave it as is and put a few wooden beams "collapsed" diagonally along the way and turn their collide off so the player goes through them and thinks they're hitting his head. Will take time to get the timing of the damage right but if I manage it'll probably look cool.

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, 08:19 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#4
RE: New to this, having some trouble

Try moving the door up +0.035 on the y-axis. I haven't actually tested whether it will work or not, but from what I can see in the level editor, the bottom of the door was inside in bottom of the frame.

For the light, you can use the FadeLightTo function:
FadeLightTo(string& asLightName, float afR, float afG, float afB, float afA, float afRadius, float afTime);

asLightName - internal name
afR - red value
afG - green value
afB - blue value
afA - alpha value
afRadius - radius of the light. -1 means keeping the radius
afTime - time in seconds until change is done

In Ruins [WIP]
02-27-2013, 08:51 AM
Find
DeAngelo Offline
Senior Member

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

The door fix worked great. Thank you. I just have to make sure I turn snaptogrid off whenever I'm gonna mess with the door so it doesn't jump back down.

As for the spotlight, I'm an idiot so I can't figure out where to put that "function" in my script. I tried it like this and the game crashed when I tired to load the level.

PHP Code: (Select All)
void OnStart() 

    
AddEntityCollideCallback("Player""PlayerCollide_Spotlight""SpotlightOn"true1);     


void  SpotlightOn(stringasLightNamefloat afRfloat afGfloat afBfloat afAfloat afRadiusfloat afTime);
{ [
b](This is Line 15 in my Notepad++)[/b]
    
FadeLightTo(Spotlight_40.70.70.551, -11); 


Dunno if this helps but the crash said that line 15 was the culprit and that it was an unrecognized token, I made a note up there of where my line 15 is.

I know you probably just looked at that and thought "How could he have got that so wrong? I didn't know dumb like that existed." Sorry about that.

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, 09:13 AM
Find
NaxEla Offline
Senior Member

Posts: 415
Threads: 5
Joined: Dec 2012
Reputation: 28
#6
RE: New to this, having some trouble

A couple things Smile

This line:
PHP Code: (Select All)
void  SpotlightOn(stringasLightNamefloat afRfloat afGfloat afBfloat afAfloat afRadiusfloat afTime); 
Should be changed to:
PHP Code: (Select All)
void SpotlightOn(string &in asParentstring &in asChildint alState

Also, you forgot to put quotes ("") around Spotlight_4:
PHP Code: (Select All)
FadeLightTo("Spotlight_4"0.70.70.551, -11); 

And don't worry about making dumb mistakes. It's alright, you're learning Smile

In Ruins [WIP]
02-27-2013, 09:36 AM
Find
DeAngelo Offline
Senior Member

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

Hmm. Got the game to load but when I walk through the script area nothing happens. I decided to try your other solution and it crashes telling me my true isn't declared and my false isn't declared. I did some research and declared seems to mean it needs quotes around it but putting quotes around them still crashed it. Here's my script as it is now.

PHP Code: (Select All)
void OnStart() 
{  
    
AddEntityCollideCallback("Player""PlayerCollide_Spotlight""SpotlightOn"true1);
    
AddEntityCollideCallback("Player""PlayerCollide_SpotlightOff""SpotlightOff"true1);        


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


I'm gonna move on for now since I still gotta put down my notes and items, add the notes to my lang file, decorate my level a bit more, and a few other little bits.

Thanks for your help though, Once I get to the point where I'm ready to make my credits, I'll put you for script help. Smile

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, 10:40 AM
Find
No Author Offline
Posting Freak

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

Is that your full script ?

I think you should add void OnLeave() to make it work.
Try this :
PHP Code: (Select All)
void OnStart() 
{  
AddEntityCollideCallback("Player""PlayerCollide_Spotlight""SpotlightOn"true1);
AddEntityCollideCallback("Player""PlayerCollide_SpotlightOff""SpotlightOff"true1);


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


[Image: the-cabin-in-the-woods-masked-people.jpg]
(This post was last modified: 02-27-2013, 11:26 AM by No Author.)
02-27-2013, 11:16 AM
Find
DeAngelo Offline
Senior Member

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

(02-27-2013, 11:16 AM)No Author Wrote: Is that your full script ?
No, I just took out stuff about other things like my doors and monsters to make it easier to look through. Here's my full script.
PHP Code: (Select All)
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 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);    


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:28 AM
Find
No Author Offline
Posting Freak

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

(02-27-2013, 11:28 AM)DeAngelo Wrote:
(02-27-2013, 11:16 AM)No Author Wrote: Is that your full script ?
No, I just took out stuff about other things like my doors and monsters to make it easier to look through. Here's my full script.
PHP Code: (Select All)
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 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);    


I think you need to add the void OnLeave(). Check my post before this one.

[Image: the-cabin-in-the-woods-masked-people.jpg]
02-27-2013, 11:33 AM
Find




Users browsing this thread: 1 Guest(s)