Frictional Games Forum (read-only)
How do I do [X] questions here - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods (https://www.frictionalgames.com/forum/forum-35.html)
+--- Thread: How do I do [X] questions here (/thread-6665.html)



How do I do [X] questions here - Montonago - 02-20-2011

I have a few things I want to try, but I'm not sure how I would script them:

I would like to have a crank or wheel activate some sort of event, for example, have wood_crank_1 unlock castle_door_2 when it reaches it's maximum rotation. Allowing the player into the room to retrieve an item to unstuck another wheel that moves an obstacle in front of a lever to open a secret door, etc. I don't know how to make the wheels/cranks do things when they reach the maximum/minimum rotation, and I don't know how to do the secret door event like in the Old Archives.

I would also like to create a lighting effect like they used in Harry Potter: The Sorcerer's Stone, where when the player is near a light it will self-ignite, and when they get x amount away from the light source, it extinguishes. I'm assuming this has to do with areas, but I'm not sure how that would be set up. Any help would be appreciated. Thanks! Smile

Also, feel free to post any "How do I do [x]" questions here to save thread space. Wink


RE: A few probably simple problems - LSunday - 02-20-2011

I'm going to save the world another "how do I do X?" thread and ask here (especially because i'm not even sure it's possible). Is there a way to make a plane active/inactive, or if not, to move it? I'm trying to create a water effect where the water appears in an area you've been in safely. I looked at the way it was done in the archive cellar, and they teleported the player into an area where it was flooded- unfortunately, that wouldn't really work for the sequence i'm putting together. Any guidlines on how to do it?

And, in other news... I've been trying to get a series of timers to work, but they keep giving me a variety of error messages based on what I change. Here's a sample of one of them (they're all almost identical):

AddTimer("Collapse1", 2.0f, "Collapse_1");
Collapse_1(Collapse1);
{
SetEntityActive("dungeon_small01_5", true);
SetEntityActive("dungeonrubble1", true);
}

The above is inside a working entity collide, if that changes anything. The error message is: "Collapse1 is not declared." However, if i put the 'string &in' back into the parenthesis, i get "expected '('" at the same position. I realize I'm probably being really stupid, but I can't find what should go in that spot.

And please no link to the wiki, because that's where I copypasta'd most of this coding from.


RE: A few probably simple problems - Ongka - 02-20-2011

Quote:void justanexample(string &in asParent, string &in asChild, int alState)
{
AddTimer("Collapse1", 2.0f, "Collapse_1");
}
void Collapse_1(Collapse1); never put a semicolon behind a void function.
{
SetEntityActive("dungeon_small01_5", true);
SetEntityActive("dungeonrubble1", true);
}

The correct code:
Code:
void OnStart()
{
AddTimer("Collapse1", 2.0f, "Collapse_1"); //you can put this into other functions aswell
}

void Collapse_1(string &in asTimer)
{
SetEntityActive("dungeon_small01_5", true);
SetEntityActive("dungeonrubble1", true);
}



RE: A few probably simple problems - LSunday - 02-21-2011

Now I keep getting an "expected '('" error, which is what i was originally trying to fix when i started deleting/adding stuff from the code. The area it's giving to me as the 'problem' is the void Collapse_1(string &in asTimer) area, but I don't know what's missing/extra there.

From what I can tell, what you gave me was what I originally had before I started screwing with it, and I can't figure out what's wrong with it.


RE: A few probably simple problems - Selyp - 02-21-2011

Edit: nevermind I was thinking something different, I'm not sure of the problem. :-(


RE: A few probably simple problems - LSunday - 02-21-2011

This is the full code, if anyone can find a problem with it;

void OnStart()
{
AddEntityCollideCallback("Player", "Ceiling_collapse", "Collide_Area", true, 1);
}

void Collide_Area(string &in asParent , string &in asChild , int alState)
{
StartScreenShake(3, 9.0f, 1.0f, 3.0f);
SetEntityActive("dungeon_entrance_flood", true);
AddTimer("Collapse1", 2.0f, "Collapse_1");
AddTimer("Collapse2", 2.8f, "Collapse_2");
AddTimer("Collapse3", 3.4f, "Collapse_3");
AddTimer("Collapse4", 1.4f, "Collapse_4");
AddTimer("Collapse5", 4.6f, "Collapse_5");
AddTimer("Collapse6", 5.2f, "Collapse_6");
AddTimer("Collapse7", 5.9f, "Collapse_7");
AddTimer("Collapse8", 6.5f, "Collapse_8");
AddTimer("Collapse9", 7.0f, "Collapse_9");
AddTimer("Collapse10", 7.8f, "Collapse_10");
AddTimer("Collapse11", 8.7f, "Collapse_11");
void Collapse_1(string &in asTimer)
{
SetEntityActive("dungeon_small01_5", true);
SetEntityActive("dungeonrubble1", true);
}
void Collapse_2(string &in asTimer)
{
SetEntityActive("dungeonrubble2", true);
SetEntityActive("rock_large01_push_8", true);
}
void Collapse_3(string &in asTimer)
{
SetEntityActive("dungeonrubble3", true);
SetEntityActive("dungeonrubble4", true);
}
void Collapse_4(string &in asTimer)
{
SetEntityActive("dungeonrubble5", true);
SetEntityActive("dungeonrubble6", true);
}
void Collapse_5(string &in asTimer)
{
SetEntityActive("dungeonrubble7", true);
SetEntityActive("dungeonrubble8", true);
}
void Collapse_6(string &in asTimer)
{
SetEntityActive("dungeonrubble9", true);
SetEntityActive("dungeonrubble11", true);
}
void Collapse_7(string &in asTimer)
{
SetEntityActive("dungeonrubble12", true);
SetEntityActive("dungeonrubble13", true);
}
void Collapse_8(string &in asTimer)
{
SetEntityActive("dungeonrubble14", true);
SetEntityActive("dungeonrubble15", true);
}
void Collapse_9(string &in asTimer)
{
SetEntityActive("dungeonrubble16", true);
SetEntityActive("dungeonrubble17", true);
}
void Collapse_10(string &in asTimer)
{
SetEntityActive("dungeonrubble18", true);
SetEntityActive("dungeonrubble19", true);
}
void Collapse_11(string &in asTimer)
{
SetEntityActive("dungeonrubble20", true);
SetEntityActive("dungeonrubble10", true);
}
}

I know the CollidePlayer with Area thing works, because I tested that before adding in all the timers to drop the pieces at different intervals.


RE: A few probably simple problems - Zirg - 02-21-2011

There's no } after AddTimer("Collapse11", 8.7f, "Collapse_11");
Instead, it's all the way down.


RE: How do I do [X] questions here - LSunday - 02-21-2011

Ahhh! Now it works!


RE: How do I do [X] questions here - Montonago - 02-21-2011

I'm trying to get a lever to unlock a door, and I've tried several things but none of them seem to work... Anyone know how to do this?


RE: How do I do [X] questions here - Ongka - 02-21-2011

http://www.frictionalgames.com/forum/thread-5117.html

And look up "Make a lever functional".