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
Script Help Weeping Angel enemies
lizardrock17 Offline
Junior Member

Posts: 20
Threads: 3
Joined: Jun 2013
Reputation: 0
#7
RE: Weeping Angel enemies

(06-19-2013, 03:08 PM)Adrianis Wrote: Kiandra's method is a good place to start - if you can get that working, you'll notice a few problems.

First and foremost is the detection for looking at something is based on where the center of your view is, not just what you can see. You could therefore get into the situation where the statue moves while you can actually see it. The solution to this problem is going to be pretty damn complex, to the point where it's going to take a lot of experimentation on your part to get it right. Honestly, if you're new to scripting, i'd leave this problem till you've got a little more experience using script areas & callbacks in other ways (ways that are better explained in tutorials & with more examples etc)

But hard problems are fun, so here's some advice I gave to the last guy asking about weeping angels (there's been quite a few)...

Quote: ... you can use the function SetEntityPlayerLookAtCallback to detect when the player is looking at an area.

- So you would need a series of script areas & deactivated statues
- Keep track of where the player is using AddEntityCollideCallback to
set the value of a string when they collide with one of the script areas
- Keep track of which statue is currently active
- Use SetEntityPlayerLookAtCallback to detect when the player is looking at an area away from where the current statue is
- Deactivate the current statue and activate another closer to where the player is
http://www.frictionalgames.com/forum/thread-21670.html

EDIT: I should probably add that the steps above would be important to get a 'dynamic' weeping angel style enemy, meaning it could follow you back & forth & all over the level indefinately. If you want to just include a weeping angel style enemy for a particular moment (i.e. just a scare event) you could cut the problem down significantly, which would also IMO make it significantly less interesting Tongue

I found those other threads and none of them really helped but thanx for the info about the detection. This would be so much easier if amnesia didnt have script areas and each monster had there own AI.

(06-19-2013, 05:54 AM)Kiandra Wrote:
(06-19-2013, 04:30 AM)lizardrock17 Wrote: Hello people; I am fairly new to scripting with Amnesia but I would like to create enemies like the Weeping Angels from Doctor Who (Weeping Angels are enemies that can't move when you see them but move when you don't even if your looking at them in the dark and just roam around if they cant find you like if your behind a door). I figured out what engine scripts to use but don't know how to use the script areas for this reason. I was thinking about putting script areas inside of script areas but i don't know if that would would work. I would appreciate some ideas/solutions on how to accomplish this task.

Weeping Angels were terrifying! Traggey might know how to do this (I believe he was working on a Dr Who CS a looooooong time ago). Also, if you need a TARDIS, check out this one!

There was a custom story a little while ago that did something similar with the Brute, but I think they were referencing Schrodinger's Cat. I'm not sure which custom story it was, but Cry definitely played it a while ago, so if you want to check his videos, find it, download the game, and check the script to figure out what they did, that would probably be the best way to go. I'm not going to do that for you because I'm just really tired and really busy :p

Anyways, the script should look something like this for yours:
PHP Code: (Select All)
void OnStart()
{
SetEntityPlayerLookAtCallback("angel_statue_1""WeepingAngel_1"true);
}

//"angel_statue_1" is the name of the statue in the level editor
//"WeepingAngel" is the name of your script that will be called when the player is looking/not looking
//true means the script won't be called again after the player looks at
//the angel once. I'm using this one because you're probably going to
//have to use multiple statues with angel_statue_1 being your first statue

void WeepingAngel_1(string &in asEntityint alState
{
if(
alState == 1//1 means looking
{
//Your angles don't do anything when you're looking at them, so leave this blank
}
else if(
alState == -1)//-1 means not looking
{
SetEntityActive("angel_statue_1"false); //this gets rid of the original one
SetEntityActive("angel_statue_2"true); //this puts in the new one
SetEntityPlayerLookAtCallback("angel_statue_2""WeepingAngel_2"true);
//This callback makes sure that angles keep showing up
}


You can find the majority of scripts on the Engine Scripts page of the wiki. Of course, they can be a little confusing sometimes, so don't be afraid to ask for help!

I'm not sure how you would ensure that the angels appear closer to the player (unless you're using a hallway) or how you would ensure that the angel actually causes harm to/kills the player. I'm not a strong scripter at all, so you might want verification on this Smile

Also, since you seem new to this (please don't hurt me for possibly being incorrect): you might want to download and use either Geany or Notepad++ instead of Notepad for scripting if you haven't already downloaded a decent program.

Once that's done, change the language to C++. In Notepad++, this can be done by going under the languages tab in the top menu bar. This will cause strings to appear grey, floats and integers to appear orange, side-notes to appear green, and bools to appear blue. This is helpful for when you get the annoying "Unexpected End of File" error because you'll see a colour that doesn't match up (usually).

Either way, good luck!

Thanx for this it has really helped. Still figuring a few kinks out.
(This post was last modified: 06-19-2013, 05:04 PM by lizardrock17.)
06-19-2013, 05:01 PM
Find


Messages In This Thread
Weeping Angel enemies - by lizardrock17 - 06-19-2013, 04:30 AM
RE: Weeping Angel enemies - by Tomato Cat - 06-19-2013, 05:22 AM
RE: Weeping Angel enemies - by lizardrock17 - 06-19-2013, 05:31 AM
RE: Weeping Angel enemies - by CarnivorousJelly - 06-19-2013, 05:54 AM
RE: Weeping Angel enemies - by DeAngelo - 06-19-2013, 10:36 AM
RE: Weeping Angel enemies - by Adrianis - 06-19-2013, 03:08 PM
RE: Weeping Angel enemies - by lizardrock17 - 06-19-2013, 05:01 PM
RE: Weeping Angel enemies - by Adrianis - 06-19-2013, 05:41 PM
RE: Weeping Angel enemies - by lizardrock17 - 06-19-2013, 05:57 PM
RE: Weeping Angel enemies - by OriginalUsername - 06-19-2013, 06:59 PM
RE: Weeping Angel enemies - by 7heDubz - 06-20-2013, 04:00 AM
RE: Weeping Angel enemies - by OriginalUsername - 06-20-2013, 06:54 AM
RE: Weeping Angel enemies - by 7heDubz - 06-20-2013, 07:18 AM
RE: Weeping Angel enemies - by OriginalUsername - 06-20-2013, 07:36 AM
RE: Weeping Angel enemies - by 7heDubz - 06-20-2013, 07:40 AM
RE: Weeping Angel enemies - by Adrianis - 06-20-2013, 12:57 PM
RE: Weeping Angel enemies - by lizardrock17 - 06-20-2013, 04:02 PM
RE: Weeping Angel enemies - by lizardrock17 - 06-20-2013, 07:14 PM
RE: Weeping Angel enemies - by lizardrock17 - 06-21-2013, 12:45 AM
RE: Weeping Angel enemies - by PutraenusAlivius - 06-21-2013, 03:42 AM
RE: Weeping Angel enemies - by lizardrock17 - 06-21-2013, 03:46 AM
RE: Weeping Angel enemies - by CarnivorousJelly - 06-21-2013, 05:17 AM
RE: Weeping Angel enemies - by PutraenusAlivius - 06-21-2013, 05:52 AM
RE: Weeping Angel enemies - by lizardrock17 - 06-21-2013, 02:59 PM
RE: Weeping Angel enemies - by Adrianis - 06-21-2013, 05:47 PM



Users browsing this thread: 2 Guest(s)