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
Crowbar won't work on door! help
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#1
Crowbar won't work on door! help

when I use the crowbar on the door, it get's me a message saying cannot use item this way! I named everything the same from level editor to the hps file? is there something I forgot to add for it not not work?

Spoiler below!

void PickupKey(string &in asEntity, string &in asItem)

{

AddQuest("quest1", "TestQuest");
AddTimer("", 0.5f, "NeverCalledTimer"); //Change the time as long as you want

AddUseItemCallback("", "MasterBedroomKey", "bedroomdoor","UseMasterBedroomKey", true);

AddEntityCollideCallback("Player", "AreaMemento", "EventQuest", true, 1);

}



void UseMasterBedroomKey(string &in asItem, string &in asEntity)

{

SetMessage("message", "message1", 3);

}



void NeverCalledTimer(string &in asTimer)

{

AddTimer("", 1.1f, "TimerDoorStart");

}



void TimerDoorStart(string &in asTimer)

{

AddUseItemCallback("", "Crowbar", "Door", "UseCrowbarOnDoor", true);

AddEntityCollideCallback("Joint", "AreaBreak", "BreakDoor", true, 1);

}



void UseCrowbarOnDoor(string &in asItem, string &in asEntity)

{

RemoveItem(asItem);

PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);

AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");

}



void TimerPlaceCrowbar(string &in asTimer)

{

SetEntityActive("Joint", true);

PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);

}



void BreakDoor(string &in asParent, string &in asChild, int alState)

{

SetEntityActive("Joint", false);

SetEntityActive("Broken", true);


SetSwingDoorLocked("Door", false, false);

SetSwingDoorClosed("Door", false, false);

SetSwingDoorDisableAutoClose("Door", true);


AddPropImpulse("Door", 0, 0, 3, "world");


CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "Areaeffect", false);

PlaySoundAtEntity("", "break_wood_metal", "Areaeffect", 0, false);


GiveSanityBoostSmall();


PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);


AddTimer("", 0.1, "TimerPushDoor");

}



void TimerPushDoor(string &in asTimer)

{

AddPropImpulse("Door", -4, 2, 1, "world");

AddTimer("", 1.1, "TimerDoorCanClose");

}

void TimerDoorCanClose(string &in asTimer)

{
SetSwingDoorDisableAutoClose("Door", false);

}

//void touchdoor(string &in asEntity, string &in type) //Where is it called at? Ignoring it for now.

//{

//AddQuest("door", "touchdoor");

//}

void EventQuest(string &in asParent, string &in asChild, int alState)

{

AddQuest("door", "touchdoor");

}

(This post was last modified: 12-23-2013, 01:53 PM by Kreekakon.)
12-23-2013, 01:41 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Crowbar won't work on door! help

As silly as it sounds, had you activated the timer which has the AddUseItemCallback for the joint and the crowbar?

If you cannot actually activate that timer, cut and paste those two lines of code and place them within your OnStart() routine, so that the callbacks are added when the map begins.

Discord: Romulator#0001
[Image: 3f6f01a904.png]
12-23-2013, 01:55 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#3
RE: Crowbar won't work on door! help

(12-23-2013, 01:55 PM)Romulator Wrote: As silly as it sounds, had you activated the timer which has the AddUseItemCallback for the joint and the crowbar?

If you cannot actually activate that timer, cut and paste those two lines of code and place them within your OnStart() routine, so that the callbacks are added when the map begins.
so where it says

AddUseItemCallback("", "Crowbar", "Door", "UseCrowbarOnDoor", true);

I am supposed to add a timer?
12-23-2013, 02:02 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
RE: Crowbar won't work on door! help

No no, put them into an OnStart().

Like this:
PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""Crowbar""Door""UseCrowbarOnDoor"true);
AddEntityCollideCallback("Joint""AreaBreak""BreakDoor"true1);


Put that anywhere in your code, and delete those two lines from the timer.

Look at this topic, and actually read it. Although it is tough stuff, you need to understand what you are scripting. http://wiki.frictionalgames.com/hpl2/tut...iferorange

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 12-23-2013, 02:05 PM by Romulator.)
12-23-2013, 02:05 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#5
RE: Crowbar won't work on door! help

(12-23-2013, 02:05 PM)Romulator Wrote: No no, put them into an OnStart().

Like this:
PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""Crowbar""Door""UseCrowbarOnDoor"true);
AddEntityCollideCallback("Joint""AreaBreak""BreakDoor"true1);


Put that anywhere in your code, and delete those two lines from the timer.

Look at this topic, and actually read it. Although it is tough stuff, you need to understand what you are scripting. http://wiki.frictionalgames.com/hpl2/tut...iferorange
still didn't work :/ still gets me cannot use item this way! this is the updated hps

void OnStart()
{
AddUseItemCallback("", "Crowbar", "Door", "UseCrowbarOnDoor", true);
AddEntityCollideCallback("Joint", "AreaBreak", "BreakDoor", true, 1);
}


void PickupKey(string &in asEntity, string &in asItem)

{

AddQuest("quest1", "TestQuest");
AddTimer("", 0.5f, "NeverCalledTimer"); //Change the time as long as you want

AddUseItemCallback("", "MasterBedroomKey", "bedroomdoor","UseMasterBedroomKey", true);

AddEntityCollideCallback("Player", "AreaMemento", "EventQuest", true, 1);

}



void UseMasterBedroomKey(string &in asItem, string &in asEntity)

{

SetMessage("message", "message1", 3);

}



void NeverCalledTimer(string &in asTimer)

{

AddTimer("", 1.1f, "TimerDoorStart");

}



void UseCrowbarOnDoor(string &in asItem, string &in asEntity)

{

RemoveItem(asItem);

PlaySoundAtEntity("", "player_crouch.snt", "Player", 0.05, false);

AddTimer(asEntity, 0.2, "TimerPlaceCrowbar");

}



void TimerPlaceCrowbar(string &in asTimer)

{

SetEntityActive("Joint", true);

PlaySoundAtEntity("", "puzzle_place_jar.snt", asTimer, 0, false);

}



void BreakDoor(string &in asParent, string &in asChild, int alState)

{

SetEntityActive("Joint", false);

SetEntityActive("Broken", true);


SetSwingDoorLocked("Door", false, false);

SetSwingDoorClosed("Door", false, false);

SetSwingDoorDisableAutoClose("Door", true);


AddPropImpulse("Door", 0, 0, 3, "world");


CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "Areaeffect", false);

PlaySoundAtEntity("", "break_wood_metal", "Areaeffect", 0, false);


GiveSanityBoostSmall();


PlayMusic("10_puzzle01.ogg", false, 0.7, 0.1, 10, false);


AddTimer("", 0.1, "TimerPushDoor");

}



void TimerPushDoor(string &in asTimer)

{

AddPropImpulse("Door", -4, 2, 1, "world");

AddTimer("", 1.1, "TimerDoorCanClose");

}

void TimerDoorCanClose(string &in asTimer)

{
SetSwingDoorDisableAutoClose("Door", false);

}

//void touchdoor(string &in asEntity, string &in type) //Where is it called at? Ignoring it for now.

//{

//AddQuest("door", "touchdoor");

//}

void EventQuest(string &in asParent, string &in asChild, int alState)

{

AddQuest("door", "touchdoor");

}
12-23-2013, 02:15 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#6
RE: Crowbar won't work on door! help

Spoiler below!

PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""Crowbar_Entity""Door""CrowbarInteract"true);
AddEntityCollideCallback("Crowbar_Joint""JointCollideArea_1""BreakDoorCrowbar"true1);
}
 
 
void CrowbarInteract(string &in asItemstring &in asEntity)
 {
 
AddTimer(""0.2f"TimerSwitchJoint");
 
RemoveItem("Crowbar_Entity");
 }
 
 
void TimerSwitchJoint(string &in asTimer)
 {
 
PlaySoundAtEntity("","puzzle_place_jar.snt""Door"0false);
 
SetEntityActive("Crowbar_Joint"true);
 }
 
 
void BreakDoorCrowbar(string &in asParentstring &in asChildint alState)
 {
 
AddPlayerSanity(25);
 
PlayMusic("10_puzzle01.ogg"false0.70.110false);
 
SetSwingDoorLocked("Door"falsetrue);
 
AddPropImpulse("Door"00, -50"World");
 
SetSwingDoorDisableAutoClose("Door"true);
 
SetSwingDoorClosed("Door"falsefalse);
 
SetMoveObjectState("prison_1"1);
 
PlaySoundAtEntity("","break_wood_metal""EffectsArea"0false);
 
CreateParticleSystemAtEntity("""ps_hit_wood""EffectsArea"false);
 
SetEntityActive("Crowbar_Joint"false);
 
SetLocalVarInt("DoorVarInt"1);
 } 
 
 
void OnEnter()
{
}
 
 
void OnLeave()
{



You might wanna rename some script areas and items in your map...

"Veni, vidi, vici."
"I came, I saw, I conquered."
12-23-2013, 05:07 PM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#7
RE: Crowbar won't work on door! help

(12-23-2013, 05:07 PM)JustAnotherPlayer Wrote:
Spoiler below!

PHP Code: (Select All)
void OnStart()
{
AddUseItemCallback("""Crowbar_Entity""Door""CrowbarInteract"true);
AddEntityCollideCallback("Crowbar_Joint""JointCollideArea_1""BreakDoorCrowbar"true1);
}
 
 
void CrowbarInteract(string &in asItemstring &in asEntity)
 {
 
AddTimer(""0.2f"TimerSwitchJoint");
 
RemoveItem("Crowbar_Entity");
 }
 
 
void TimerSwitchJoint(string &in asTimer)
 {
 
PlaySoundAtEntity("","puzzle_place_jar.snt""Door"0false);
 
SetEntityActive("Crowbar_Joint"true);
 }
 
 
void BreakDoorCrowbar(string &in asParentstring &in asChildint alState)
 {
 
AddPlayerSanity(25);
 
PlayMusic("10_puzzle01.ogg"false0.70.110false);
 
SetSwingDoorLocked("Door"falsetrue);
 
AddPropImpulse("Door"00, -50"World");
 
SetSwingDoorDisableAutoClose("Door"true);
 
SetSwingDoorClosed("Door"falsefalse);
 
SetMoveObjectState("prison_1"1);
 
PlaySoundAtEntity("","break_wood_metal""EffectsArea"0false);
 
CreateParticleSystemAtEntity("""ps_hit_wood""EffectsArea"false);
 
SetEntityActive("Crowbar_Joint"false);
 
SetLocalVarInt("DoorVarInt"1);
 } 
 
 
void OnEnter()
{
}
 
 
void OnLeave()
{



You might wanna rename some script areas and items in your map...
still not working :/
12-23-2013, 05:34 PM
Find
Froge Offline
Posting Freak

Posts: 2,955
Threads: 176
Joined: Jul 2012
Reputation: 125
#8
RE: Crowbar won't work on door! help

While this is relevant, why is it that when I do AddPropForce("door", -1000, 0, 0, "world") instead of AddPropImpulse on the door after the crowbar'ing it open, the door sometimes flies open in the respective x direction and sometimes doesn't?

[Image: p229xcq]
12-23-2013, 06:34 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#9
RE: Crowbar won't work on door! help

Forces push objects according to their mass. Impulses don't, hence will push an object by a set amount. A large enough impulse will cause something to break :3

Discord: Romulator#0001
[Image: 3f6f01a904.png]
12-24-2013, 12:44 AM
Find
Radical Batz Offline
Posting Freak

Posts: 953
Threads: 145
Joined: Dec 2013
Reputation: 25
#10
RE: Crowbar won't work on door! help

well I started from scratch again with the crowbar code, but it still doesn't work! so goodbye for my custom story even though lots of people said "it looks amazing" and "best custom story ever", now it's deleted! I just don't know why the crowbar code won't work! I couldn't find the error anyway! happy Christmas guys and a happy new year! sigh it's always been my dream to make a custom story, but the stupid code crushed my dreams :'(
(This post was last modified: 12-25-2013, 03:41 PM by Radical Batz.)
12-25-2013, 03:41 PM
Find




Users browsing this thread: 1 Guest(s)