jessehmusic
Senior Member
Posts: 423
Threads: 102
Joined: Dec 2011
Reputation:
8
|
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 " 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() { }
|
|
12-30-2011, 04:10 AM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
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.
|
|
12-30-2011, 05:58 AM |
|
jessehmusic
Senior Member
Posts: 423
Threads: 102
Joined: Dec 2011
Reputation:
8
|
RE: Need help with Crowbar on door
Thank you im going to test the script now
it work but like a key want a crowbar to be pusched like in the dark descent how do i do that
(This post was last modified: 12-30-2011, 02:56 PM by jessehmusic.)
|
|
12-30-2011, 02:43 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
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 |
|
jessehmusic
Senior Member
Posts: 423
Threads: 102
Joined: Dec 2011
Reputation:
8
|
RE: Need help with Crowbar on door
So void OnStart() { AddUseItemCallback("this is area ", "the item", "The door", "No ide" , true); AddEntityCollideCallback("name of what", "script name", "the func", 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); }
or do i have wrong please help am new :S
Still got same prob
(This post was last modified: 12-30-2011, 07:45 PM by jessehmusic.)
|
|
12-30-2011, 07:26 PM |
|
jessehmusic
Senior Member
Posts: 423
Threads: 102
Joined: Dec 2011
Reputation:
8
|
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 i have made that with Crowbar_joint_1 dosnt work
oid OnStart() { //START MOVE SHELF EVENT1 SetEntityConnectionStateChangeCallback("lever", "func_shelf"); //END MOVE SHELF EVENT1
//START SERVANT BRUTE EVENT1 AddEntityCollideCallback("Player", "monsterspawn_1", "MonsterFunction", true, 1); AddEntityCollideCallback("servant_brute_1", "servant_grunt_1_remove", "RemoveMonster", true, 1); //END SERVANT BRUTE EVENT1
//START CROWBAR EVENT1 AddUseItemCallback("", "crowbar_1", "mansion_1", "CrowbarOnDoor", true); AddEntityCollideCallback("crowbar_joint_1", "door_script_1", "crowbarfunc", true, 1); //END CROWBAR EVENT1 } void crowbar(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_1", true); } //START MOVE SHELF EVENT1 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; } } //END MOVE SHELF EVENT1
//START SERVANT BRUTE EVENT1 void MonsterFunction(string &in asParent, string &in asChild, int 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 asParent, string &in asChild, int alState) { SetEntityActive("servant_brute_1", false); } //END SERVANT BRUTE EVENT1
//START CROWBAR EVENT1 void CrowbarOnDoor(string &in item, string &in door) { SetSwingDoorLocked("mansion_1", false, true); PlaySoundAtEntity("", "unlock_door", "mansion_1", 0, false); RemoveItem("crowbar_1"); } //END CROWBAR EVENT1
void OnEnter() {
}
void OnLeave() {
}
(This post was last modified: 12-30-2011, 08:28 PM by jessehmusic.)
|
|
12-30-2011, 08:28 PM |
|
flamez3
Posting Freak
Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation:
57
|
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.
(This post was last modified: 12-31-2011, 02:08 AM by flamez3.)
|
|
12-31-2011, 02:06 AM |
|
|