Frictional Games Forum (read-only)

Full Version: Scripts Recollection
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12
Well if you don't even want to try programming you can alway play with game maker, rpg maker or little big planet i guess...But for amnesia the only time you dont need to script for a level is when you have someone who does it for you or you just want to make a good looking level that is empty...
What I'm saying is that if Frictional Games wants people to make custom content, they shouldn't make it so only professionals can do it. Now there's an idea. Tongue
Oh, and BTW, I'm gonna keep on trying with a level called "Escape". I've made two maps, and now I'm stuck on getting an enemy to spot a player when the walk through an area. Already did the code from the first page, all I'm trying to do now is figure out how to connect the grunt and the area.
(01-22-2011, 05:42 AM)Ianlis Wrote: [ -> ]What I'm saying is that if Frictional Games wants people to make custom content, they shouldn't make it so only professionals can do it. Now there's an idea. Tongue

I'm a 17 year old dude on middle school who also does this.
It has nothing to do with being professional and what not.

The only thing you need is motivation to keep learning, nothing more.
Scripting has nothing to do with being professional. Anyone can learn, and if you're not willing to do this, than don't even bother. It doesn't get much simpler than this while still providing you a fair amount of flexibility.
You got to learn the basics at least. Even when you want to copy/paste scripts of others. I you don't know how and where to place the correct commands you'll end up frustrated because of errors which you don't understand. And really learning the basics is possible for everyone since there are video tutorials. What else do you want then some guy telling you what to type Tongue

About scripts;
I would like to know how to switch between levels without a level door. And how to do it with a passing-out effect?

By the way a script I love myself is when entering an area, the lights go on/off. This is the script for a lamp to go off:
______________________________________________________________________
void CollideLightsOut(string &in asParent, string &in asChild, int alState)
{
SetLampLit("entity name", true, true);
}

void OnStart()
{
AddEntityCollideCallback("Player", "AreaLightsOut", "CollideLightsOut", true, 1);
}
Code:
void OnStart()
{
    AddEntityCollideCallback("Player", "teleport_1", "Teleport", false, 1);
}

void Teleport(string &in asParent, string &in asChild, int alState)
{    
    FadeOut(3.0f);
    ChangeMap("map2.map", "PlayerStartArea_1", "", "");
}

Couldn't find the passing out function though.
Thanks for the level switching code, but I'm still looking for the passing out effect. I would like to use it when falling down and in the next level you wake up and get back on your feet. I'd like the script for that Smile
void OnStart()
{
AddEntityCollideCallback("Player", "script_area", "change_map", false, 1);
}


void change_map(string &in asParent , string &in asChild , int alState)
{
ChangeMap("map.map", "PlayerStartArea_1", "", "");
}

I think everything's obvious. If not, then ask and I'll help ^^
Make a locked door and a key to unlock it by Frontcannon
[spoiler]
[code]
void OnStart()
{
AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

I can't get this to work, Iam kind of new to scripting so all help is appriciated.

Iam changing mansion_1 to manison_3 and R01_Key1 to tomb_key1. But then when I start the game and load my story it says FATAL ERROR. What am I doing wrong?
(I have tried removing both false and true, at different times.)
(02-22-2011, 10:27 AM)kozek Wrote: [ -> ]Make a locked door and a key to unlock it by Frontcannon
[spoiler]
[code]
void OnStart()
{
AddUseItemCallback("", "R01_Key1", "mansion_1", "KeyOnDoor", true);
}

void KeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "mansion_1", 0.0f, true);
}

I can't get this to work, Iam kind of new to scripting so all help is appriciated.

Iam changing mansion_1 to manison_3 and R01_Key1 to tomb_key1. But then when I start the game and load my story it says FATAL ERROR. What am I doing wrong?
(I have tried removing both false and true, at different times.)

Code seems fine. I suspect your problem is to do with the names of your key/door. For the key, you need a "custom subitem name" in the "Entity Tab", this is the name you use for the AddUseItemCallBack. The name of the entity you use the key on (in your case, "mansion_1", needs to be the name of the actual object (ie. first field on the first tab).

Make sure you have that. If you still can't get it to work, when you get a fatal error, it will tell you the row and column numbers so you can easily identify where the problem is in your script file. Smile
Pages: 1 2 3 4 5 6 7 8 9 10 11 12