Frictional Games Forum (read-only)
[SCRIPT] Weeping Angel enemies - 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 - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: [SCRIPT] Weeping Angel enemies (/thread-21864.html)

Pages: 1 2 3


RE: Weeping Angel enemies - 7heDubz - 06-20-2013

(06-19-2013, 06:59 PM)Smoke Wrote: You'll have the chase music whenever you don't look at him though. Keep that in mind.

Changeable,

just use IFC


RE: Weeping Angel enemies - OriginalUsername - 06-20-2013

(06-20-2013, 04:00 AM)WIWWM Wrote:
(06-19-2013, 06:59 PM)Smoke Wrote: You'll have the chase music whenever you don't look at him though. Keep that in mind.

Changeable,

just use IFC

Yeah, but wont you delete all the chase music for all the monsters?


RE: Weeping Angel enemies - 7heDubz - 06-20-2013

(06-20-2013, 06:54 AM)Smoke Wrote:
(06-20-2013, 04:00 AM)WIWWM Wrote:
(06-19-2013, 06:59 PM)Smoke Wrote: You'll have the chase music whenever you don't look at him though. Keep that in mind.

Changeable,

just use IFC

Yeah, but wont you delete all the chase music for all the monsters?

wont I? no what do you mean?
in the config files there should be an option for what file to use for chase music. just leave it blank. if its an IFC being used it wouldn't be a problem.


RE: Weeping Angel enemies - OriginalUsername - 06-20-2013

I get that, but what happens when you place another enemy, like a brute? You wont hear any chase music when he chases you


RE: Weeping Angel enemies - 7heDubz - 06-20-2013

depends, unless your having the monster look for the player there's no problem. if you have the monster see the player's position (automatically making him chase the player), if you do that you could script in the music/terror meter.


RE: Weeping Angel enemies - Adrianis - 06-20-2013

Code:
void ShowEnemyPlayerPosition(string& "angel_statue_1);\\Makes angel follows player

This line is wrong in a few ways Smile
Firstly when you are 'calling' a function (i.e. trying to run the function from within your script), you need to not include the 'void' keyword
Second, strings are always surrounded by "" , you've got one at the start, but you haven't got one at the end
Third, when you are providing a string as a 'parameter' for a function (i.e. the stuff you put in the brackets), you need to not include 'string&', that keyword is included in the actual code for the function to define the type of 'parameter' that you need to include, but when actually using the function as you are here, all you need to do is provide the parameter itself
Fourth, the slash character's you have included are the wrong way round! You've used \\, but the comments are defined by //


Here's what the fixed line should look like

Code:
ShowEnemyPlayerPosition("angel_statue_1"); //Makes angel follows player


However there is a slightly more pressing issue - ShowEnemyPlayerPosition only works on entities that are set up to be enemies - so it can only work on a Grunt or a Brute, unless you set up a custom monster yourself. The angel statue that comes with the game is not set up as an enemy, so it can't chase the player, although you could just test this method using a grunt or brute, with the intention of changing that later

Quote:From what you guys told me I have compiled this: (I havent tried it yet because if i encounter any problems i dont want to spend hours on the internet trying to find out my script is wrong)

The absolute best and quickest way to learn how to write correct code is to write it, run it, find out that it's broken, then look for the solution. The error messages you will get are (usually) quite helpful in determining the problem. If you are waiting for people in the community to respond to every question it will slow you down a great deal. I guarantee you that all the problems you come across writing a line like the one above, other people have experienced as well, have created a thread about it and been given a solution, so the answers will be there if it goes wrong, and don't forget - you are never going to break the game with you're scripts, don't be afraid to experiment, it's the best way to learn


RE: Weeping Angel enemies - lizardrock17 - 06-20-2013

(06-20-2013, 12:57 PM)Adrianis Wrote:
Code:
void ShowEnemyPlayerPosition(string& "angel_statue_1);\\Makes angel follows player

This line is wrong in a few ways Smile
Firstly when you are 'calling' a function (i.e. trying to run the function from within your script), you need to not include the 'void' keyword
Second, strings are always surrounded by "" , you've got one at the start, but you haven't got one at the end
Third, when you are providing a string as a 'parameter' for a function (i.e. the stuff you put in the brackets), you need to not include 'string&', that keyword is included in the actual code for the function to define the type of 'parameter' that you need to include, but when actually using the function as you are here, all you need to do is provide the parameter itself
Fourth, the slash character's you have included are the wrong way round! You've used \\, but the comments are defined by //


Here's what the fixed line should look like

Code:
ShowEnemyPlayerPosition("angel_statue_1"); //Makes angel follows player


However there is a slightly more pressing issue - ShowEnemyPlayerPosition only works on entities that are set up to be enemies - so it can only work on a Grunt or a Brute, unless you set up a custom monster yourself. The angel statue that comes with the game is not set up as an enemy, so it can't chase the player, although you could just test this method using a grunt or brute, with the intention of changing that later

Quote:From what you guys told me I have compiled this: (I havent tried it yet because if i encounter any problems i dont want to spend hours on the internet trying to find out my script is wrong)

The absolute best and quickest way to learn how to write correct code is to write it, run it, find out that it's broken, then look for the solution. The error messages you will get are (usually) quite helpful in determining the problem. If you are waiting for people in the community to respond to every question it will slow you down a great deal. I guarantee you that all the problems you come across writing a line like the one above, other people have experienced as well, have created a thread about it and been given a solution, so the answers will be there if it goes wrong, and don't forget - you are never going to break the game with you're scripts, don't be afraid to experiment, it's the best way to learn

Thanx Adrianas that really helped


RE: Weeping Angel enemies - lizardrock17 - 06-20-2013

Quick question. Can a enemy move outside of a script area and keep actions specified by the script?


RE: Weeping Angel enemies - lizardrock17 - 06-21-2013

void OnStart()
{
SetEntityPlayerLookAtCallback("servant_grunt_1", "WeepingAngel_1", false);
}

void WeepingAngel_1(string &in asEntity, int alState)
{
if(alState == 1)
{
SetEnemyDisabled("servant_grunt_1", bool abDisabled);
}
else if(alState == -1)
{
SetNPCAwake("servant_grunt_1", bool abAwake, bool abEffects);
ShowEnemyPlayerPosition("servant_grunt_1");
}
}


So i have created this code so that the grunt acts like a weeping angel. But when i try to test this i get an error and the solution that comes with the error doesnt help. Can someone telll me what i did wrong.


RE: Weeping Angel enemies - PutraenusAlivius - 06-21-2013

Bool's only evaluates to true or false. So, you need to change the bool's to true or false.

Like this.
Spoiler below!

Code:
bool abCode
abCode - determines if you want to use the code or not.
ITS JUST AN EXAMPLE

Let's just say you want to use it.

If you want to use it = true
If you DONT want to use it = false

No quotation's needed.