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
First time doing a map, need basic help!
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#1
First time doing a map, need basic help!

Hello guys.

I bought Amnesia recently just to create maps and mess with my friends and i created a map in the map editor, although very small and basic (only 1 room with a spawnpoint, closet and door with crowbar break). For some reason my map crashes, this is the error.

[Image: OhA3s.png]


So, my map is put in the custom_stories folder and i made a new folder called Test. In the "Test" folder is a folder called map with my map and my .hps file which just says the following
////////////////////////////
// Run first time starting map
void OnStart()
{
//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
}

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

}

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

}
void OnStart()
{
AddUseItemCallback("", "crowbar_1", "door1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "Crowbar_Area", "CollideAreaBreakDoor", true, 1);
}


void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}


void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}


void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("door1", false, true);
AddPropImpulse("door1", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("door1", true);
SetSwingDoorClosed("door1", false, false);
SetMoveObjectState("door1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakOff", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakOff", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}


void OnEnter()
{
}


void OnLeave()
{
}

my scripts folder is empty and in the root folder i have a file called custom_story_settings.cfg
<Main
    Name="A random story"
    Author="Trollface"
    ImgFile=""

    StartMap="test.map"
    StartPos=""
/>

Can someone help me and tell me what to do to make this map load?
(This post was last modified: 02-19-2012, 12:24 AM by LulleBulle.)
02-19-2012, 12:17 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: First time doing a map, need basic help!

Do research on function overloading if you're going to be defining the same functions with the same signatures. Otherwise, remove the duplicates.

Tutorials: From Noob to Pro
02-19-2012, 12:37 AM
Website Find
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#3
RE: First time doing a map, need basic help!

(02-19-2012, 12:37 AM)Your Computer Wrote: Do research on function overloading if you're going to be defining the same functions with the same signatures. Otherwise, remove the duplicates.
But where are there same functions with same signatures? I do not intend to have that. Could you tell me how to rearrange my code to make it work?
02-19-2012, 12:40 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: First time doing a map, need basic help!

(02-19-2012, 12:40 AM)LulleBulle Wrote: But where are there same functions with same signatures? I do not intend to have that. Could you tell me how to rearrange my code to make it work?

Rearranging the code won't fix the errors shown in the image. You have to either define the functions differently or remove them entirely. The error message tells you where they are located: (line, column).

Tutorials: From Noob to Pro
02-19-2012, 12:50 AM
Website Find
LulleBulle Offline
Member

Posts: 101
Threads: 33
Joined: Feb 2012
Reputation: 0
#5
RE: First time doing a map, need basic help!

(02-19-2012, 12:50 AM)Your Computer Wrote:
(02-19-2012, 12:40 AM)LulleBulle Wrote: But where are there same functions with same signatures? I do not intend to have that. Could you tell me how to rearrange my code to make it work?

Rearranging the code won't fix the errors shown in the image. You have to either define the functions differently or remove them entirely. The error message tells you where they are located: (line, column).
I figured this out, because when i removed the entire .hps file i could load the map. I'll just give it another try, thank you. And also, i checked your tutorials, they are awesome!


02-19-2012, 01:17 AM
Find
Acies Offline
Posting Freak

Posts: 1,643
Threads: 60
Joined: Feb 2011
Reputation: 73
#6
RE: First time doing a map, need basic help!

As answered before, but to clarify:
You have named a certain function the same name 3 times. The numbers show which lines to look at:
27, 64 & 69.

[Image: mZiYnxe.png]


02-19-2012, 06:49 PM
Find
JenniferOrange Offline
Senior Member

Posts: 424
Threads: 43
Joined: Jun 2011
Reputation: 33
#7
RE: First time doing a map, need basic help!

You doubled void OnStart(), void OnEnter(), and void OnLeave(). They're only put once.

////////////////////////////
// Run first time starting map
void OnStart()
{
//Add the Lantern and 10 Tinderboxes when in Debug mode, always good to have light!
if(ScriptDebugOn())
{
GiveItemFromFile("lantern", "lantern.ent");

for(int i=0;i<10;i++) GiveItemFromFile("tinderbox_"+i, "tinderbox.ent");
}
AddUseItemCallback("", "crowbar_1", "door1", "UsedCrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "Crowbar_Area", "CollideAreaBreakDoor", true, 1);
}
}


void UsedCrowbarOnDoor(string &in asItem, string &in asEntity)
{
AddTimer("", 0.2, "TimerSwitchShovel");
RemoveItem("crowbar_1");
}


void TimerSwitchShovel(string &in asTimer)
{
PlaySoundAtEntity("","puzzle_place_jar.snt", "", 0, false);
SetEntityActive("crowbar_joint_1", true);
}


void CollideAreaBreakDoor(string &in asParent, string &in asChild, int alState)
{
AddPlayerSanity(25);
PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);
SetSwingDoorLocked("door1", false, true);
AddPropImpulse("door1", 0, 0, -50, "World");
SetSwingDoorDisableAutoClose("door1", true);
SetSwingDoorClosed("door1", false, false);
SetMoveObjectState("door1", 1);
PlaySoundAtEntity("","break_wood_metal", "AreaBreakOff", 0, false);
CreateParticleSystemAtEntity("", "ps_hit_wood", "AreaBreakOff", false);
SetEntityActive("crowbar_joint_1", false);
SetLocalVarInt("Door", 1);
}


void OnEnter()
{
}


void OnLeave()
{
}

I honestly don't know if I put that all back together right since I never use debug mode but it's worth a try.

Ba-da bing, ba-da boom.
02-20-2012, 04:38 AM
Find




Users browsing this thread: 1 Guest(s)