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 Automatic open door script
MaksoPL Offline
Member

Posts: 51
Threads: 26
Joined: Mar 2014
Reputation: 0
#1
Automatic open door script

I make a script, when door must open automaticly. It din't work. Working only sound.
.hps file:
void OnStart()
{
AddEntityCollideCallback("Player", "quest1", "Memento1", true, 1);
AddEntityCollideCallback("Player", "DoorScriptArea1", "EventDoor", true, 1);
}

void Memento1(string &in asParent, string &in asChild, int alState)
{
AddQuest("area", "quest1");
}

void EventDoor(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("DoorScripted1", false, false);
SetSwingDoorDisableAutoClose("DoorScripted1", true);

PlaySoundAtEntity("creak", "joint_door_move_special.snt", "DoorScripted1", 1, false);

AddTimer("", 2, "TimerStopSound");
AddTimer("DoorScripted1", 0, "TimerMoveDoor");
}

void TimerMoveDoor(string &in asTimer)
{
if(GetLocalVarInt("VarDoor") == 10) return;
AddLocalVarInt("VarDoor", 1);

AddTimer(asTimer, 0.03, "TimerMoveDoor");

AddPropForce(asTimer, -70, 0, 0, "world");
}

void TimerStopSound(string &in asTimer)
{
StopSound("creak", 0.4);
}
01-03-2015, 12:55 PM
Find
G510s Offline
Banned

Posts: 58
Threads: 32
Joined: Jun 2014
#2
RE: Automatic open door script

its possible that you didn't match the names of something. did you match up "DoorScripted1" with whats in you hpl?
01-03-2015, 01:37 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#3
RE: Automatic open door script

Change this
PHP Code: (Select All)
AddTimer("DoorScripted1"0"TimerMoveDoor"); 
to this
PHP Code: (Select All)
AddTimer("DoorScripted1"0.05"TimerMoveDoor"); 

This line here:
PHP Code: (Select All)
AddPropForce(asTimer, -7000"world"); 
This is correct, but make sure of a few things:

1. asTimer here would mean that your door would be named TimerMoveDoor in the Level Editor. If not, then make sure it is! Tongue
2. The numbers may need to be tweaked, depending on which way your door faces. Try these alterations as well:
PHP Code: (Select All)
AddPropForce(asTimer7000"world");
AddPropForce(asTimer00, -70"world");
AddPropForce(asTimer0070"world"); 

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 01-03-2015, 01:55 PM by Romulator.)
01-03-2015, 01:54 PM
Find
MaksoPL Offline
Member

Posts: 51
Threads: 26
Joined: Mar 2014
Reputation: 0
#4
RE: Automatic open door script

(01-03-2015, 01:54 PM)Romulator Wrote: Change this
PHP Code: (Select All)
AddTimer("DoorScripted1"0"TimerMoveDoor"); 
to this
PHP Code: (Select All)
AddTimer("DoorScripted1"0.05"TimerMoveDoor"); 

This line here:
PHP Code: (Select All)
AddPropForce(asTimer, -7000"world"); 
This is correct, but make sure of a few things:

1. asTimer here would mean that your door would be named TimerMoveDoor in the Level Editor. If not, then make sure it is! Tongue
2. The numbers may need to be tweaked, depending on which way your door faces. Try these alterations as well:
PHP Code: (Select All)
AddPropForce(asTimer7000"world");
AddPropForce(asTimer00, -70"world");
AddPropForce(asTimer0070"world"); 

It din't work.
01-03-2015, 02:30 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#5
RE: Automatic open door script

Quote:AddPropForce(asTimer, 70, 0, 0, "world");
AddPropForce(asTimer, 0, 0, -70, "world");
AddPropForce(asTimer, 0, 0, 70, "world");
Try more!!!
I had HAVE this as well everytime..
Some doors just wont get to move from it's hinges..
You could add MORE force, i have doors witch need for examplé;
PHP Code: (Select All)
AddPropForce(asTimer005000"world"); 
---
Try using ridiculous numbers to see if it is actually working!
Then lower it's values..
FIRST you need to see if it is going open to the RIGHT direction.
Good luck, this specific question needs to be tested by the user itself, THIS time a little more then other questions.
(This post was last modified: 01-03-2015, 04:59 PM by DnALANGE.)
01-03-2015, 04:58 PM
Find
Daemian Offline
Posting Freak

Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation: 49
#6
RE: Automatic open door script

Yep, 70 is almost nothing.

or use the Impulse one instead of Force

(This post was last modified: 01-03-2015, 08:18 PM by Daemian.)
01-03-2015, 08:18 PM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#7
RE: Automatic open door script

Yeah, Force with the quantity of 70 is worthless. The all-mighty wiki said that to use quantities from 1000 to 10000.

EDIT:
Or you could just use Impulse, but 70 is way too much. An quantity of 1 - 10 is enough.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 01-04-2015, 07:35 AM by PutraenusAlivius.)
01-04-2015, 07:35 AM
Find




Users browsing this thread: 1 Guest(s)