Frictional Games Forum (read-only)
Script Problems - 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 Problems (/thread-20613.html)

Pages: 1 2 3 4 5 6 7 8 9


RE: Script Problems - Coolfromdah00d - 03-06-2013

(03-06-2013, 06:24 PM)darksky Wrote: you have to put SetEntityCallbackFunc in a function

like
Code:
void OnStart(){
   SetEntityCallbackFunc("GuestRoomKey", "jump");
}

void OnStart (){
SetEntityCallbackFunc("GuestRoomKey", "jump");
}

{
AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "21_screams.snt", "corpse01", 0, false);
}

void OnEnter()
{

}

void OnLeave()
{

}


This is the whole file. I just cant get it to work. I've searched for the error on the page but I cant find it. I dont get what the problem is


RE: Script Problems - darksky - 03-06-2013

addUseItemcallback is not within a function ,too
try this

Code:
void OnStart (){
   SetEntityCallbackFunc("GuestRoomKey", "jump");
   AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "21_screams.snt", "corpse01", 0, false);
}

void OnEnter()
{

}

void OnLeave()
{

}

you should invest more time in your programming in general.
you could start by reading this guide
http://wiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/script_language_reference_and_guide


RE: Script Problems - Coolfromdah00d - 03-07-2013

(03-06-2013, 08:41 PM)darksky Wrote: addUseItemcallback is not within a function ,too
try this

Code:
void OnStart (){
   SetEntityCallbackFunc("GuestRoomKey", "jump");
   AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "21_screams.snt", "corpse01", 0, false);
}

void OnEnter()
{

}

void OnLeave()
{

}

you should invest more time in your programming in general.
you could start by reading this guide
http://wiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/script_language_reference_and_guide

thanks!

I feel like an idiot now but how do I make him disappear after he appeared?


RE: Script Problems - 7heDubz - 03-07-2013

(03-07-2013, 06:00 PM)Coolfromdah00d Wrote:
(03-06-2013, 08:41 PM)darksky Wrote: addUseItemcallback is not within a function ,too
try this

Code:
void OnStart (){
   SetEntityCallbackFunc("GuestRoomKey", "jump");
   AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "21_screams.snt", "corpse01", 0, false);
}

void OnEnter()
{

}

void OnLeave()
{

}

you should invest more time in your programming in general.
you could start by reading this guide
http://wiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/script_language_reference_and_guide

thanks!

I feel like an idiot now but how do I make him disappear after he appeared?
SetEntityActive("corpse01", true);

but have it be

SetEntityActive("corpse01", false);


RE: Script Problems - Coolfromdah00d - 03-07-2013

(03-07-2013, 06:37 PM)WIWWM Wrote:
(03-07-2013, 06:00 PM)Coolfromdah00d Wrote:
(03-06-2013, 08:41 PM)darksky Wrote: addUseItemcallback is not within a function ,too
try this

Code:
void OnStart (){
   SetEntityCallbackFunc("GuestRoomKey", "jump");
   AddUseItemCallback("", "GuestRoomKey", "door01", "UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door01", false, true);
PlaySoundAtEntity("", "Unlock_door", "door01", 0, false);
RemoveItem("GuestRoomKey");
}


void jump(string &in asEntity, string &in type)
{
SetEntityActive("corpse01", true);
PlaySoundAtEntity("", "21_screams.snt", "corpse01", 0, false);
}

void OnEnter()
{

}

void OnLeave()
{

}

you should invest more time in your programming in general.
you could start by reading this guide
http://wiki.frictionalgames.com/hpl2/amnesia/script_language_reference_and_guide/script_language_reference_and_guide

thanks!

I feel like an idiot now but how do I make him disappear after he appeared?
SetEntityActive("corpse01", true);

but have it be

SetEntityActive("corpse01", false);

alright


RE: Script Problems - 7heDubz - 03-07-2013

Not trying to be mean, but i would try to solve problems on your own before coming to the community.
It will help your problem solving skills.


RE: Script Problems - Coolfromdah00d - 03-08-2013

(03-07-2013, 06:53 PM)WIWWM Wrote: Not trying to be mean, but i would try to solve problems on your own before coming to the community.
It will help your problem solving skills.

So you think that I was like "hm, this doesent work, I know! I'l ask soeone else to do it for me!!!!"

(03-08-2013, 06:11 PM)Coolfromdah00d Wrote:
(03-07-2013, 06:53 PM)WIWWM Wrote: Not trying to be mean, but i would try to solve problems on your own before coming to the community.
It will help your problem solving skills.

So you think that I was like "hm, this doesent work, I know! I'l ask soeone else to do it for me!!!!"

*someone and *I'll


RE: Script Problems - ExpectedIdentifier - 03-08-2013

(03-07-2013, 06:53 PM)WIWWM Wrote: Not trying to be mean, but i would try to solve problems on your own before coming to the community.
It will help your problem solving skills.

He's right. I started working with the HPL2 suite nearly 2 years ago and I never asked for help once - EVERYTHING you need to know can be found out on the Frictional Games Wiki page or the forum and if not there, you can check the original game maps. And if it's something new, just experiment until it works, asking in the forum should be a last resort in my opinion Big Grin


RE: Script Problems - Coolfromdah00d - 03-08-2013

(03-08-2013, 06:37 PM)sonataarctica Wrote:
(03-07-2013, 06:53 PM)WIWWM Wrote: Not trying to be mean, but i would try to solve problems on your own before coming to the community.
It will help your problem solving skills.

He's right. I started working with the HPL2 suite nearly 2 years ago and I never asked for help once - EVERYTHING you need to know can be found out on the Frictional Games Wiki page or the forum and if not there, you can check the original game maps. And if it's something new, just experiment until it works, asking in the forum should be a last resort in my opinion Big Grin

I AM only asking on the forum when I really cant figure it out....


RE: Script Problems - ExpectedIdentifier - 03-08-2013

(03-08-2013, 06:59 PM)Coolfromdah00d Wrote:
(03-08-2013, 06:37 PM)sonataarctica Wrote:
(03-07-2013, 06:53 PM)WIWWM Wrote: Not trying to be mean, but i would try to solve problems on your own before coming to the community.
It will help your problem solving skills.

He's right. I started working with the HPL2 suite nearly 2 years ago and I never asked for help once - EVERYTHING you need to know can be found out on the Frictional Games Wiki page or the forum and if not there, you can check the original game maps. And if it's something new, just experiment until it works, asking in the forum should be a last resort in my opinion Big Grin

I AM only asking on the forum when I really cant figure it out....

You're asking about very basic things, you need to learn the basics of scripting before you jump straight into making a custom story or you're going to keep running into problems.