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


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Need help with Crowbar on door
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#1
Need help with Crowbar on door

hello i get error at 44,2 at this script im going to make a crowbar that opens a door here is script "
PHP Code: (Select All)
void OnStart()
{
SetEntityConnectionStateChangeCallback("lever""func_shelf");
AddEntityCollideCallback("Player""monsterspawn_1""MonsterFunction"true1); 
AddEntityCollideCallback("servant_brute_1""servant_grunt_1_remove""RemoveMonster"true1);
AddUseItemCallback("""crowbar_1""mansion_1""CrowbarOnDoor"true);
}

 
void func_shelf(string &in asEntityint alState)
{
     if (
alState == 1)
     {
     
SetMoveObjectState("shelf",1.0f);
     
PlaySoundAtEntity("""quest_completed.snt""shelf_move_1"0false);
          return;
     }
}
void MonsterFunction(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("servant_brue_1"true); 
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_1"2"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_2"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_3"0"");
}
void RemoveMonster(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("servant_brute_1"false);
}    
void CrowbarOnDoor(string &in itemstring &in door)
{
    
SetSwingDoorLocked(mansion_1", false, true);
    PlaySoundAtEntity("", "
unlock_door", "mansion_1", 0, false);
    RemoveItem(crowbar_1);
}    
    
    void OnEnter() 
{

}

void OnLeave() 
{


http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
12-30-2011, 04:10 AM
Website Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: Need help with Crowbar on door

I have a tip for you. If you are using Notepad ++. Go over to language and change it to C++. You will see all the errors you are making ALOT easier.


Quote:void OnStart()
{
SetEntityConnectionStateChangeCallback("lever", "func_shelf");
AddEntityCollideCallback("Player", "monsterspawn_1", "MonsterFunction", true, 1);
AddEntityCollideCallback("servant_brute_1", "servant_grunt_1_remove", "RemoveMonster", true, 1);
AddUseItemCallback("", "crowbar_1", "mansion_1", "CrowbarOnDoor", true);
}


void func_shelf(string &in asEntity, int alState)
{
if (alState == 1)
{
SetMoveObjectState("shelf",1.0f);
PlaySoundAtEntity("", "quest_completed.snt", "shelf_move_1", 0, false);
return;
}
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brue_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
}
void RemoveMonster(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_1", false);
}
void CrowbarOnDoor(string &in item, string &in door)
{
SetSwingDoorLocked("mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false);
RemoveItem("crowbar_1");
}

void OnEnter()
{

}

void OnLeave()
{
}
I haven't checked whether or not you want to have the animation of the crowbar. Or if it just disappears and the door opens. Either way; I fixed up some of the errors. You are making some mistakes by not closing your strings with another ". Or not even doing them at all sometimes. Do what I said with the notepad and try to figure out the problem from there. It is alot easier than using the regular notepad. Smile

12-30-2011, 05:58 AM
Find
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#3
RE: Need help with Crowbar on door

Thank you im going to test the script now Smile
it work but like a key want a crowbar to be pusched like in the dark descent Sad how do i do that

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 12-30-2011, 02:56 PM by jessehmusic.)
12-30-2011, 02:43 PM
Website Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#4
RE: Need help with Crowbar on door


I'm too tired to tell you what everything means but here is the script. Put "crowbar_joint" in the door and set it unactive. Put a scriptarea next to the crowbar; this is for when the crowbar hits the scriptarea, it will trigger the "crowbarfunc". Put the scriptarea name where i made the text bold.

Quote:void OnStart()
{
AddUseItemCallback("crowbaractivate1", "crowbar_1", "cellar_wood01_4", "crowbar" , true);
AddEntityCollideCallback("crowbar_joint_1", "nameofscript", "crowbarfunc", true, 1);
}


void crowbar(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
}


void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("cellar_wood01_4", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
}

12-30-2011, 04:04 PM
Find
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#5
RE: Need help with Crowbar on door

So
PHP Code: (Select All)
void OnStart()
 {
 
AddUseItemCallback("this is area ""the item""The door""No ide" true);
 
AddEntityCollideCallback("name of what""script name""the func"true1);
 }


 
void crowbar(string &in asItemstring &in asEntity)
 {
 
SetEntityActive("crowbar_joint_1"true);
 }


 
void crowbarfunc(string &in asParentstring &in asChildint alState)
 {
 
SetPropHealth("cellar_wood01_4"0.0f);
 
SetEntityActive("crowbar_joint_1"false);
 
SetEntityActive("crowbar_dyn_1"true);
 } 
or do i have wrong please help am new :S
Still got same prob

http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 12-30-2011, 07:45 PM by jessehmusic.)
12-30-2011, 07:26 PM
Website Find
jessehmusic Offline
Senior Member

Posts: 423
Threads: 102
Joined: Dec 2011
Reputation: 8
#6
RE: Need help with Crowbar on door

this is my hps and crowbar open the door like a key it dosnt work at all cant get it to work Sad i have made that with Crowbar_joint_1 dosnt work
PHP Code: (Select All)
oid OnStart()
{
//START MOVE SHELF EVENT1
    
SetEntityConnectionStateChangeCallback("lever""func_shelf");
//END MOVE SHELF EVENT1

//START SERVANT BRUTE EVENT1
    
AddEntityCollideCallback("Player""monsterspawn_1""MonsterFunction"true1); 
    
AddEntityCollideCallback("servant_brute_1""servant_grunt_1_remove""RemoveMonster"true1);
//END SERVANT BRUTE EVENT1

//START CROWBAR EVENT1
    
AddUseItemCallback("""crowbar_1""mansion_1""CrowbarOnDoor"true);
    
AddEntityCollideCallback("crowbar_joint_1""door_script_1""crowbarfunc"true1);
//END CROWBAR EVENT1
}
void crowbar(string &in asItemstring &in asEntity)
 {
 
SetEntityActive("crowbar_joint_1"true);
 }


 
void crowbarfunc(string &in asParentstring &in asChildint alState)
 {
 
SetPropHealth("mansion_1"0.0f);
 
SetEntityActive("crowbar_joint_1"false);
 
SetEntityActive("crowbar_1"true);
 }
//START MOVE SHELF EVENT1
void func_shelf(string &in asEntityint alState)
{
if (
alState == 1)
{
    
SetMoveObjectState("shelf",1.0f);
    
PlaySoundAtEntity("""quest_completed.snt""shelf_move_1"0false);
    return;
}
}
//END MOVE SHELF EVENT1


//START SERVANT BRUTE EVENT1 
void MonsterFunction(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("servant_brute_1"true); 
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_1"2"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_2"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_3"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_4"2"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_5"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_6"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_7"2"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_8"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_9"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_10"2"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_11"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_12"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_13"0"");
    
AddEnemyPatrolNode("servant_brute_1""PathNodeArea_14"0"");
    
    }    

void RemoveMonster(string &in asParentstring &in asChildint alState)
{
    
SetEntityActive("servant_brute_1"false);

//END SERVANT BRUTE EVENT1

//START CROWBAR EVENT1
void CrowbarOnDoor(string &in itemstring &in door)
{
    
SetSwingDoorLocked("mansion_1"falsetrue);
    
PlaySoundAtEntity("""unlock_door""mansion_1"0false);
    
RemoveItem("crowbar_1");
}
//END CROWBAR EVENT1

void OnEnter() 
{

}

void OnLeave() 
{



http://www.moddb.com/mods/jessehmusic - Hospital of horror , WIP
(This post was last modified: 12-30-2011, 08:28 PM by jessehmusic.)
12-30-2011, 08:28 PM
Website Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#7
RE: Need help with Crowbar on door

Okay, start again.

Put a crowbar joint where you want to move the crowbar and set it inactive.
Also put crowbar_dyn in the same spot as the crowbar_joint and set it inactive.
Then put a little scriptarea next to that crowbar, this so when the crowbar meets the scriptarea; function will happen.

Now:

Quote:void OnStart()
{
AddUseItemCallback("", "crowbar_1", "mansion_1", "CrowbarOnDoor", true);
AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1);
}

void CrowbarOnDoor(string &in asItem, string &in asEntity)
{
SetEntityActive("crowbar_joint_1", true);
}


void crowbarfunc(string &in asParent, string &in asChild, int alState)
{
SetPropHealth("mansion_1", 0.0f);
SetEntityActive("crowbar_joint_1", false);
SetEntityActive("crowbar_dyn_1", true);
}
Sorry I didn't explain it very good before. Smile

(This post was last modified: 12-31-2011, 02:08 AM by flamez3.)
12-31-2011, 02:06 AM
Find




Users browsing this thread: 1 Guest(s)