Facebook Twitter YouTube Frictional Games | Forum | Newsletter | Dev Blog | Dev Wiki | Support | Gametee


Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED]Strange script problem
Author Message
ide Offline
Junior Member

Posts: 20
Joined: Oct 2010
Reputation: 0
Post: #1
[SOLVED]Strange script problem

This is quite strange problem. I have simple interaction callback with door that activates a grunt. But for some reason the grunt is activated even when I interact with completely different door that doesn't have a callback.
basically what I did was:
I add this to the door I want to set the callback on:
[Image: b3626c6cc03450eccd20ec403daeadeb5g.jpg]

Then wrote the code bellow:
void doorgrunt(string &in entity){
SetEntityActive("1doorgrunt", true);
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_7", 5, "");
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_24", 0, "");
}
10-13-2010 02:22 PM
Find all posts by this user Quote this message in a reply
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 2
Post: #2
RE: Strange script problem

(10-13-2010 02:22 PM)ide Wrote:  
void doorgrunt(string &in entity){
SetEntityActive("1doorgrunt", true);
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_7", 5, "");
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_24", 0, "");
}

I think you have to write the name of the door with the Callback in (string &in entity) or it'll be called everytime you interact with something Big Grin


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
10-13-2010 02:26 PM
Find all posts by this user Quote this message in a reply
ide Offline
Junior Member

Posts: 20
Joined: Oct 2010
Reputation: 0
Post: #3
RE: Strange script problem

Now I get "Expected data type" error message when trying to quick reload. Are you sure that that's really how it should be done?
Current code:
void doorgrunt("mansion_11"){
SetEntityActive("1doorgrunt", true);
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_7", 5, "");
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_24", 0, "");

Edit:
Ok I tested it few times and noticed that actually interacting with door didn't cause the trigger. It was caused when I stepped through the door (also left one script area at the same time though it's not connected to the event in anyway so it shouldn't cause problems.)
10-13-2010 02:44 PM
Find all posts by this user Quote this message in a reply
Entih Offline
Junior Member

Posts: 47
Joined: Sep 2010
Reputation: 0
Post: #4
RE: Strange script problem

You had it right, the function should read:

void doorgrunt(string &in entity)

The game fills in the name of the entity into the variable entity when the game actually runs. I am not quite sure how it wouldn't be working though, unless you have multiple functions of the name 'doorgrunt'.

Interact callbacks should run the instant the player tries to manipulate the item.
10-13-2010 03:17 PM
Find all posts by this user Quote this message in a reply
Frontcannon Offline
Senior Member

Posts: 538
Joined: Jul 2010
Reputation: 2
Post: #5
RE: Strange script problem

(10-13-2010 02:44 PM)ide Wrote:  Ok I tested it few times and noticed that actually interacting with door didn't cause the trigger. It was caused when I stepped through the door (also left one script area at the same time though it's not connected to the event in anyway so it shouldn't cause problems.)

That's interesting!


╔═════════════════╗
☺ Smoke weed everyday ☺
╚═════════════════╝
10-13-2010 03:56 PM
Find all posts by this user Quote this message in a reply
ide Offline
Junior Member

Posts: 20
Joined: Oct 2010
Reputation: 0
Post: #6
RE: Strange script problem

This isn't the only "script without script" problem I get. Another is when player is supposed to hear sound and get an objective but instead he doesn't hear the sound(still gets the obj.). Though later the sound will play randomly(multiple times) even though player is no where near the actual trigger area.
10-13-2010 03:57 PM
Find all posts by this user Quote this message in a reply
Entih Offline
Junior Member

Posts: 47
Joined: Sep 2010
Reputation: 0
Post: #7
RE: Strange script problem

Very odd. I can't say I've ever heard of something like that! I would need to see the script to be able to say though, it may depend on how you have the script set up.
10-13-2010 04:02 PM
Find all posts by this user Quote this message in a reply
ide Offline
Junior Member

Posts: 20
Joined: Oct 2010
Reputation: 0
Post: #8
RE: Strange script problem

void OnStart()
{
AddUseItemCallback("", "roomkey_1", "mansion_1", "UnlockDoor", true);
AddUseItemCallback("", "storagekey", "mansion_7", "UnlockDoor", true);
AddUseItemCallback("", "key_torture_chamber_1", "mansion_6", "UnlockDoor", true);
AddEntityCollideCallback("Player", "StepsArea_1", "sounds1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "sounds3", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "sounds2", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_6", "sounds5", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_7", "sounds6", true, 1);
AddEntityCollideCallback("servant_grunt_1", "ScriptArea_4", "enemydisappear", true, 1);
SetEntityPlayerInteractCallback("mansion_11", "doorgrunt", true);
SetPlayerLampOil(20);
if(ScriptDebugOn())
{
GiveItemFromFile("", "lantern");
for(int i;i<10;i++)
GiveItemFromFile("","tinderbox");
}
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 1, false);
RemoveItem(asItem);
}
void sounds1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_steps_big", "ScriptArea_3", 0, false);
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}
void sounds2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_floor_17", false, false);
SetLampLit("candlestick_floor_16", false, false);
SetMessage("Hints", "blockhint", 5);
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "notice_long", "ScriptArea_2", 0, false);
SetSwingDoorClosed("mansion_3", true, true);
SetEntityPlayerInteractCallback("mansion_4", "doorspook", true);
}
void sounds3(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 0, "manhorror");
AddTimer("", 2, "gruntslash");
}
void kaappi(string &in entity){
PlaySoundAtEntity("","21_screams", "cabinet_simple_1",0,false);
GiveSanityDamage(10, true);
}
void sounds5(string &in asParent, string &in asChild, int alState){
PlaySoundAtEntity("","15_the_big_scream", "ScriptArea_2", 0, false);
AddQuest("startquest", "startquest");
}
void TurnLampOff(string &in asParent, string &in asChild, int alState){

}
void sounds6(string &in asParent, string &in asChild, int alState){
PlaySoundAtEntity("","scare_human_noices","ScriptArea_1",0,false);
}
void OfficeKeyPicked(){
CompleteQuest("startquest", "end_startquest");
}
void manhorror(string &in asTimer){
PlaySoundAtEntity("","15_man_hunted", "ScriptArea_2", 0, false);
}
void gruntslash(string &in asTimer){
PlaySoundAtEntity("","amb_idle", "ScriptArea_2", 0, false);
PlaySoundAtEntity("","attack_claw_hit", "ScriptArea_2", 0, false);
}
void enemydisappear(string & asEntity){
SetEntityActive("servant_grunt_1", false);
AddDebugMessage("enemy disapperared", false);
}
void doorspook(string &in entity){
PlaySoundAtEntity("", "scare_steps_big", "ScriptArea_9", 0, false);
}
void doorgrunt(string &in entity){
SetEntityActive("1doorgrunt", true);
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_7", 5, "");
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_24", 0, "");
}

In case you wanted to know the bugged sound is 15_the_big_scream
10-13-2010 04:05 PM
Find all posts by this user Quote this message in a reply
Entih Offline
Junior Member

Posts: 47
Joined: Sep 2010
Reputation: 0
Post: #9
RE: Strange script problem

I can't quite work out what could be wrong with it even looking right at it. I'll take a closer look when I get home from class, because now I'm curious.
10-13-2010 04:30 PM
Find all posts by this user Quote this message in a reply
SLi78 Offline
Junior Member

Posts: 23
Joined: Sep 2010
Reputation: 0
Post: #10
RE: Strange script problem

(10-13-2010 04:05 PM)ide Wrote:  
void OnStart()
{
AddUseItemCallback("", "roomkey_1", "mansion_1", "UnlockDoor", true);
AddUseItemCallback("", "storagekey", "mansion_7", "UnlockDoor", true);
AddUseItemCallback("", "key_torture_chamber_1", "mansion_6", "UnlockDoor", true);
AddEntityCollideCallback("Player", "StepsArea_1", "sounds1", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_4", "sounds3", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_1", "sounds2", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_6", "sounds5", true, 1);
AddEntityCollideCallback("Player", "ScriptArea_7", "sounds6", true, 1);
AddEntityCollideCallback("servant_grunt_1", "ScriptArea_4", "enemydisappear", true, 1);
SetEntityPlayerInteractCallback("mansion_11", "doorgrunt", true);
SetPlayerLampOil(20);
if(ScriptDebugOn())
{
GiveItemFromFile("", "lantern");
for(int i;i<10;i++)
GiveItemFromFile("","tinderbox");
}
}
void UnlockDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked(asEntity, false, true);
PlaySoundAtEntity("", "unlock_door", asEntity, 1, false);
RemoveItem(asItem);
}
void sounds1(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "scare_steps_big", "ScriptArea_3", 0, false);
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_4", 0, "");
}
void sounds2(string &in asParent, string &in asChild, int alState)
{
SetLampLit("candlestick_floor_17", false, false);
SetLampLit("candlestick_floor_16", false, false);
SetMessage("Hints", "blockhint", 5);
GiveSanityDamage(10, true);
PlaySoundAtEntity("", "notice_long", "ScriptArea_2", 0, false);
SetSwingDoorClosed("mansion_3", true, true);
SetEntityPlayerInteractCallback("mansion_4", "doorspook", true);
}
void sounds3(string &in asParent, string &in asChild, int alState)
{
AddTimer("", 0, "manhorror");
AddTimer("", 2, "gruntslash");
}
void kaappi(string &in entity){
PlaySoundAtEntity("","21_screams", "cabinet_simple_1",0,false);
GiveSanityDamage(10, true);
}
void sounds5(string &in asParent, string &in asChild, int alState){
PlaySoundAtEntity("","15_the_big_scream", "ScriptArea_2", 0, false);
AddQuest("startquest", "startquest");
}
void TurnLampOff(string &in asParent, string &in asChild, int alState){

}
void sounds6(string &in asParent, string &in asChild, int alState){
PlaySoundAtEntity("","scare_human_noices","ScriptArea_1",0,false);
}
void OfficeKeyPicked(){
CompleteQuest("startquest", "end_startquest");
}
void manhorror(string &in asTimer){
PlaySoundAtEntity("","15_man_hunted", "ScriptArea_2", 0, false);
}
void gruntslash(string &in asTimer){
PlaySoundAtEntity("","amb_idle", "ScriptArea_2", 0, false);
PlaySoundAtEntity("","attack_claw_hit", "ScriptArea_2", 0, false);
}
void enemydisappear(string & asEntity){
SetEntityActive("servant_grunt_1", false);
AddDebugMessage("enemy disapperared", false);
}
void doorspook(string &in entity){
PlaySoundAtEntity("", "scare_steps_big", "ScriptArea_9", 0, false);
}
void doorgrunt(string &in entity){
SetEntityActive("1doorgrunt", true);
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_7", 5, "");
AddEnemyPatrolNode("1doorgrunt", "PathNodeArea_24", 0, "");
}

In case you wanted to know the bugged sound is 15_the_big_scream


Look in your OnStart

AddEntityCollideCallback("Player", "ScriptArea_6", "sounds5", true, 1);

and your function
void sounds5(string &in asParent, string &in asChild, int alState){
PlaySoundAtEntity("","15_the_big_scream", "ScriptArea_2", 0, false);
AddQuest("startquest", "startquest");
}

I think you missed the area, so its playing somewhere else.
10-13-2010 04:42 PM
Find all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)