Frictional Games Forum
help script - Printable Version

+- Frictional Games Forum (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: help script (/thread-24212.html)



help script - MrJackrabbit - 12-24-2013

so heyllo,
so im messing around with script function stuff and im trying to find a way to add something to this script.

this is what i have so far:

void OnStart()
{
SetEntityCallbackFunc("key_1", "OnPickup");
}

void OnPickup(string &in asEntity, string &in type)
{
SetEntityActive("servant_brute_1", true);
ShowEnemyPlayerPosition("servant_brute_1");
}



this spawns an enemy hallucination once you pick up the key and everything works so far. i took out all the other parts of the scrip because this is the only important thing but ive tried it and it works fine.

i was wondering if anyone could tell me how to have the player look at the brute when he picks up the key.
thank yall!


RE: help script - DnALANGE - 12-24-2013

PHP Code:
void OnStart()
 {
 
SetEntityPlayerInteractCallback("key_1""OnPickup"false);
 }

 
void OnPickup(string &in asEntitystring &in type)
 {
 
SetEntityActive("servant_brute_1"true);//Setting the enemy ACTIVE.
 
ShowEnemyPlayerPosition("servant_brute_1");// this will make the enemy attack you where ever you are.
 
StartPlayerLookAt("servant_brute_1"10.0f10.5f"");//The 10 is the speed to look at something, 1 is very slow, so this is very fast.
 




RE: help script - MrJackrabbit - 12-24-2013

(12-24-2013, 10:07 PM)DnALANGE Wrote:
PHP Code:
void OnStart()
 {
 
SetEntityPlayerInteractCallback("key_1""OnPickup"false);
 }

 
void OnPickup(string &in asEntitystring &in type)
 {
 
SetEntityActive("servant_brute_1"true);//Setting the enemy ACTIVE.
 
ShowEnemyPlayerPosition("servant_brute_1");// this will make the enemy attack you where ever you are.
 
StartPlayerLookAt("servant_brute_1"10.0f10.5f"");//The 10 is the speed to look at something, 1 is very slow, so this is very fast.
 

thank you so much! this helps alot!

(12-24-2013, 10:11 PM)MrJackrabbit Wrote:
(12-24-2013, 10:07 PM)DnALANGE Wrote:
PHP Code:
void OnStart()
 {
 
SetEntityPlayerInteractCallback("key_1""OnPickup"false);
 }

 
void OnPickup(string &in asEntitystring &in type)
 {
 
SetEntityActive("servant_brute_1"true);//Setting the enemy ACTIVE.
 
ShowEnemyPlayerPosition("servant_brute_1");// this will make the enemy attack you where ever you are.
 
StartPlayerLookAt("servant_brute_1"10.0f10.5f"");//The 10 is the speed to look at something, 1 is very slow, so this is very fast.
 

thank you so much! this helps alot!

how do i stop looking at it? it worked but after it dissapears the player continues to look where it used to be. where do i put in "StopPLayerLookAt()"? i put that in the void OnPickup but that event and the startPlayerLookAt event occurs at the same time so they cancel each other out.


RE: help script - DnALANGE - 12-24-2013

void OnStart()
{
SetEntityPlayerInteractCallback("key_1", "OnPickup", false);
}

void OnPickup(string &in asEntity, string &in type)
{

AddTimer("", 5.0f, "STOPLOOK"); // Put this timer as long as you want
SetEntityActive("servant_brute_1", true);//Setting the enemy ACTIVE.
ShowEnemyPlayerPosition("servant_brute_1");// this will make the enemy attack you where ever you are.
StartPlayerLookAt("servant_brute_1", 10.0f, 10.5f, "");//The 10 is the speed to look at something, 1 is very slow, so this is very fast.

}

void STOPLOOK(string &in asTimer)
{
StopPlayerLookAt();
}


Edit;
Try to understand the engine\scripts.
VERY importend, or at lesast try to ask waht does what and how.
you just ask the script and then what? do you know what what does?
Just wondering..
Here is somehting you may want to add to your favorites;
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions


RE: help script - MrJackrabbit - 12-24-2013

(12-24-2013, 10:24 PM)DnALANGE Wrote: void OnStart()
{
SetEntityPlayerInteractCallback("key_1", "OnPickup", false);
}

void OnPickup(string &in asEntity, string &in type)
{

AddTimer("", 5.0f, "STOPLOOK"); // Put this timer as long as you want
SetEntityActive("servant_brute_1", true);//Setting the enemy ACTIVE.
ShowEnemyPlayerPosition("servant_brute_1");// this will make the enemy attack you where ever you are.
StartPlayerLookAt("servant_brute_1", 10.0f, 10.5f, "");//The 10 is the speed to look at something, 1 is very slow, so this is very fast.

}

void STOPLOOK(string &in asTimer)
{
StopPlayerLookAt();
}


Edit;
Try to understand the engine\scripts.
VERY importend, or at lesast try to ask waht does what and how.
you just ask the script and then what? do you know what what does?
Just wondering..
Here is somehting you may want to add to your favorites;
http://wiki.frictionalgames.com/hpl2/amnesia/script_functions
alrighty. thank you very much! im practicing with scripting and i just started this week so im begining to understand it


RE: help script - DnALANGE - 12-24-2013

That's totally fine MrRabbit*
Just be aware scripting is\can be hard, we all make mistakes.
But then try to understad what is wrogn is very importend.
While trying you learn yourself, and youre Always free to ask on the forum here.
Signing off now.
Good luck with your story.