Frictional Games Forum (read-only)
SanityBoost script is giving me an error? - 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: SanityBoost script is giving me an error? (/thread-10880.html)

Pages: 1 2


SanityBoost script is giving me an error? - MissMarilynn - 10-20-2011

So here is the scripting:

SetEntityPlayerInteractCallback("office_key", "IsItLockedComplete", true);



void IsItLockedComplete(string &in entity, int alState)
{
CompleteQuest("open_door_quest", "open_door");
GiveSanityBoost(5, true);
}

the error says it is a problem with the GiveSanityBoost command? I think it has something to do with (string &in entity, int alState).


RE: SanityBoost script is giving me an error? - Your Computer - 10-20-2011

GiveSanityBoost() doesn't take any parameters. If you want to give the player a small sanity boost while having the screen effect, use GiveSanityBoostSmall().


RE: SanityBoost script is giving me an error? - MissMarilynn - 10-20-2011

(10-20-2011, 08:06 PM)Your Computer Wrote: GiveSanityBoost() doesn't take any parameters. If you want to give the player a small sanity boost while having the screen effect, use GiveSanityBoostSmall().
I put it in as:


SetEntityPlayerInteractCallback("office_key", "IsItLockedComplete", true);

void IsItLockedComplete(string &in entity, int alState)
{
CompleteQuest("open_door_quest", "open_door");
GiveSanityBoostSmall();
}

and it isn't completing the quest OR giving me a purple mist screen. What could be the issue?

Also I'm getting an error for the door bang scripting you help me with the other day. I used:

AddEntityCollideCallback("Player", "bangdoorarea", "ScaryDoor", false);


void ScaryDoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("bangdoor", -2, 0, 0, "World");
PlaySoundAtEntity("pound", "hit_wood", "", 0, false);
PlaySoundAtEntity("enemy", "L02_attack", "bangdoor", 0, false);
CreateParticleSystemAtEntity("ParticleSystem_9", "ps_hit_wood", "bangdoor", false);
}




RE: SanityBoost script is giving me an error? - Your Computer - 10-20-2011

(10-20-2011, 08:42 PM)MissMarilynn Wrote: I put it in as:

SetEntityPlayerInteractCallback("office_key", "IsItLockedComplete", true);

void IsItLockedComplete(string &in entity, int alState)
{
CompleteQuest("open_door_quest", "open_door");
GiveSanityBoostSmall();
}

and it isn't completing the quest OR giving me a purple mist screen. What could be the issue?

The callback syntax for SetEntityPlayerInteractCallback doesn't take an int, it only takes one parameter, a string; in other words, the game can't find IsItLockedComplete(string &in entity).

(10-20-2011, 08:42 PM)MissMarilynn Wrote: Also I'm getting an error for the door bang scripting you help me with the other day. I used:

AddEntityCollideCallback("Player", "bangdoorarea", "ScaryDoor", false);


void ScaryDoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("bangdoor", -2, 0, 0, "World");
PlaySoundAtEntity("pound", "hit_wood", "", 0, false);
PlaySoundAtEntity("enemy", "L02_attack", "bangdoor", 0, false);
CreateParticleSystemAtEntity("ParticleSystem_9", "ps_hit_wood", "bangdoor", false);
}

You forgot to specify the state that you want the collision to happen for in the AddEntityCollideCallback function.


RE: SanityBoost script is giving me an error? - MissMarilynn - 10-20-2011

(10-20-2011, 08:51 PM)Your Computer Wrote:
(10-20-2011, 08:42 PM)MissMarilynn Wrote: I put it in as:

SetEntityPlayerInteractCallback("office_key", "IsItLockedComplete", true);

void IsItLockedComplete(string &in entity, int alState)
{
CompleteQuest("open_door_quest", "open_door");
GiveSanityBoostSmall();
}

and it isn't completing the quest OR giving me a purple mist screen. What could be the issue?

The callback syntax for SetEntityPlayerInteractCallback doesn't take an int, it only takes one parameter, a string; in other words, the game can't find IsItLockedComplete(string &in entity).

(10-20-2011, 08:42 PM)MissMarilynn Wrote: Also I'm getting an error for the door bang scripting you help me with the other day. I used:

AddEntityCollideCallback("Player", "bangdoorarea", "ScaryDoor", false);


void ScaryDoor(string &in asParent, string &in asChild, int alState)
{
AddPropImpulse("bangdoor", -2, 0, 0, "World");
PlaySoundAtEntity("pound", "hit_wood", "", 0, false);
PlaySoundAtEntity("enemy", "L02_attack", "bangdoor", 0, false);
CreateParticleSystemAtEntity("ParticleSystem_9", "ps_hit_wood", "bangdoor", false);
}

You forgot to specify the state that you want the collision to happen for in the AddEntityCollideCallback function.
Okay thanks! And how do I fix the sanity problem then? Can you give me a scripting example?


RE: SanityBoost script is giving me an error? - Your Computer - 10-20-2011

(10-20-2011, 09:01 PM)MissMarilynn Wrote: And how do I fix the sanity problem then? Can you give me a scripting example?

In other words, replace this:

PHP Code:
void IsItLockedComplete(string &in entityint alState)
{
CompleteQuest("open_door_quest""open_door");
GiveSanityBoostSmall();


With:

PHP Code:
void IsItLockedComplete(string &in entity)
{
CompleteQuest("open_door_quest""open_door");
GiveSanityBoostSmall();




RE: SanityBoost script is giving me an error? - MissMarilynn - 10-20-2011

(10-20-2011, 09:04 PM)Your Computer Wrote:
(10-20-2011, 09:01 PM)MissMarilynn Wrote: And how do I fix the sanity problem then? Can you give me a scripting example?

In other words, replace this:

PHP Code:
void IsItLockedComplete(string &in entityint alState)
{
CompleteQuest("open_door_quest""open_door");
GiveSanityBoostSmall();


With:

PHP Code:
void IsItLockedComplete(string &in entity)
{
CompleteQuest("open_door_quest""open_door");
GiveSanityBoostSmall();

Great! and how can I get this to work as well:

void open(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("officedoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("officekey");
GiveSanityBoostSmall();
}

I want a sanity boost when I use the key on the office door?


RE: SanityBoost script is giving me an error? - Your Computer - 10-20-2011

(10-20-2011, 09:09 PM)MissMarilynn Wrote: Great! and how can I get this to work as well:

void open(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("officedoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("officekey");
GiveSanityBoostSmall();
}

I want a sanity boost when I use the key on the office door?

PHP Code:
AddUseItemCallback("open_office_door""officekey""officedoor""open"false); 



RE: SanityBoost script is giving me an error? - MissMarilynn - 10-20-2011

(10-20-2011, 09:17 PM)Your Computer Wrote:
(10-20-2011, 09:09 PM)MissMarilynn Wrote: Great! and how can I get this to work as well:

void open(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("officedoor", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("officekey");
GiveSanityBoostSmall();
}

I want a sanity boost when I use the key on the office door?

PHP Code:
AddUseItemCallback("open_office_door""officekey""officedoor""open"false); 
Now my scripting isn't working for the monster being set active by picking up a crowbar. I want him to head to the player right away. My scripting is:

SetEntityPlayerInteractCallback("crowbar_1", "MonsterSpawn", false);



void MonsterSpawn(string& asName, string& asCallback)
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
ShowEnemyPlayerPosition("crowbarscare");
SetEntityActive("crowbarscare", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 4, "");
(and then lots more pathnodes)
}

Crowbarscare is the monster.


RE: SanityBoost script is giving me an error? - Your Computer - 10-20-2011

(10-20-2011, 10:21 PM)MissMarilynn Wrote: Now my scripting isn't working for the monster being set active by picking up a crowbar. I want him to head to the player right away. My scripting is:

SetEntityPlayerInteractCallback("crowbar_1", "MonsterSpawn", false);



void MonsterSpawn(string& asName, string& asCallback)
{
PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);
PlaySoundAtEntity("", "react_scare", "Player", 0, false);
ShowEnemyPlayerPosition("crowbarscare");
SetEntityActive("crowbarscare", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 4, "");
(and then lots more pathnodes)
}

You made the same mistake as with IsItLockedComplete.

(10-20-2011, 10:21 PM)MissMarilynn Wrote: Crowbarscare is the monster.

So there are two monsters? Or is "servant_grunt_1" supposed to be "crowbarscare"?