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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[SOLVED] Script Problem
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#1
[SOLVED] Script Problem

Hey guys, While scripting i ran into a error and i have NO idea what to do or how to fix it. So i decided to ask it here.

ERROR:
main (62, 25) :ERR :Expected data Type

My Code:
void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansion_2", true, true);
    SetSwingDoorLocked("cabinet_nice_1", false, true);
    PlaySoundAtEntity("","unlock_door", "cabinet_nice_1" ,0.0f, false);
    RemoveItem("CabinetKey1");
    StartPlayerLookAt("Monster3", 2, 2, "");

      AddTimer("donelook", 2.5f, "TimerDoneLookAt");

    SetEntityActive("Monster3", true);
}

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


((THis is one part of where the error is.))
(This post was last modified: 04-16-2011, 12:13 AM by laser50.)
04-14-2011, 09:51 PM
Find
Pandemoneus Offline
Senior Member

Posts: 328
Threads: 2
Joined: Sep 2010
Reputation: 0
#2
RE: Script Problem

Post your whole code so we can see which line it is pointing at...

04-14-2011, 10:49 PM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#3
RE: Script Problem

Here is my FULL code:

void OnStart()
{  
    SetPlayerLampOil(10.0f);
    AddEntityCollideCallback("Player", "ScriptArea_1", "ActivateMonsters", true, 1);  
    AddUseItemCallback("","CabinetKey1", "cabinet_nice_1","UsedKeyOnDoor", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked("mansion_2", true, true);
    SetSwingDoorLocked("cabinet_nice_1", false, true);
    PlaySoundAtEntity("","unlock_door", "cabinet_nice_1" ,0.0f, false);
    RemoveItem("CabinetKey1");
    StartPlayerLookAt("Monster3", 2, 2, "");

      AddTimer("donelook", 2.5f, "TimerDoneLookAt");

    SetEntityActive("Monster3", true);
}


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


////////////////////////////
// Run when entering map
void OnEnter()
{

}

////////////////////////////
// Run when leaving map
void OnLeave()
{

}

void ActivateMonsters(string &in asParent, string &in asChild, int alState)
{
    /////////////////////
    // Monster 1
    SetEntityActive("Monster1", true);
    AddEnemyPatrolNode("Monster1", "PatrolNode1", 10.0f, "");
    GiveSanityDamage(15.0f, true);
    /////////////////////
    // Monster 2
    SetEntityActive("Monster2", true);
    AddEnemyPatrolNode("Monster2", "Monster2Path1", 6.0f, "");
    AddEnemyPatrolNode("Monster2", "Monster2Path2", 6.0f, "");
    AddEnemyPatrolNode("Monster2", "Monster2Path3", 6.0f, "");
    AddEnemyPatrolNode("Monster2", "Monster2Path4", 6.0f, "");
    AddEnemyPatrolNode("Monster2", "Monster2Path1", 6.0f, "");
    AddEnemyPatrolNode("Monster2", "Monster2Path2", 6.0f, "");
    AddEnemyPatrolNode("Monster2", "Monster2Path3", 6.0f, "");
    AddEnemyPatrolNode("Monster2", "Monster2Path4", 6.0f, "");
    
}

void OnLeverStateChange("Lever1", -1)
{

    if (alState == 1)
    {
        SetSwingDoorLocked("mansion_2", false, true);
    }
}
04-15-2011, 12:51 PM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#4
RE: Script Problem

Could someone please take a look and help me here?? Thanks.
04-15-2011, 03:23 PM
Find
Dalroc Offline
Member

Posts: 57
Threads: 2
Joined: Mar 2011
Reputation: 0
#5
RE: Script Problem

void OnLeverStateChange
Where did you find this function? Never seen it and it's not on the script functions page on the wiki so I guess this is the problem Tongue
(This post was last modified: 04-15-2011, 03:32 PM by Dalroc.)
04-15-2011, 03:30 PM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#6
RE: Script Problem

I found it here:
http://www.frictionalgames.com/forum/thread-5117.html

I think it should work. (I think it worked on a level before I reinstalled my PC...)
04-15-2011, 03:35 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#7
RE: Script Problem

That's a user defined function, like MonsterFunc1 for example. It's not a "script function".

Use this: GetLeverState(string& asName);
(This post was last modified: 04-15-2011, 04:16 PM by MrBigzy.)
04-15-2011, 04:15 PM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#8
RE: Script Problem

Then how should i use it if i use GetLeverState? SOme help would be great.
(I'm much of a newb when it comes to scripting.)
04-15-2011, 07:03 PM
Find
MrBigzy Offline
Senior Member

Posts: 616
Threads: 18
Joined: Mar 2011
Reputation: 8
#9
RE: Script Problem

If you just want to open a door with a lever, this is the best way I think:

SetEntityConnectionStateChangeCallback(string& asName, string& asCallback);

So if you had SetEntityConnectionStateChangeCallback("LeverOpensDoor", "LeverDoor");

void LeverDoor(string &in EntityName, int alState)
{
   if (alState==1) SetSwingDoorLocked("mansion_2", false, true);
}

Something like that.
04-15-2011, 11:12 PM
Find
laser50 Offline
Member

Posts: 242
Threads: 22
Joined: Apr 2011
Reputation: 0
#10
RE: Script Problem

I fixed it. Thanks for the help everyone!
04-16-2011, 12:13 AM
Find




Users browsing this thread: 2 Guest(s)