MaksoPL
Member
Posts: 51
Threads: 26
Joined: Mar 2014
Reputation:
0
|
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 |
|
G510s
Banned
Posts: 58
Threads: 32
Joined: Jun 2014
|
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 |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Automatic open door script
Change this
AddTimer("DoorScripted1", 0, "TimerMoveDoor");
to this
AddTimer("DoorScripted1", 0.05, "TimerMoveDoor");
This line here:
AddPropForce(asTimer, -70, 0, 0, "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!
2. The numbers may need to be tweaked, depending on which way your door faces. Try these alterations as well:
AddPropForce(asTimer, 70, 0, 0, "world"); AddPropForce(asTimer, 0, 0, -70, "world"); AddPropForce(asTimer, 0, 0, 70, "world");
Discord: Romulator#0001
(This post was last modified: 01-03-2015, 01:55 PM by Romulator.)
|
|
01-03-2015, 01:54 PM |
|
MaksoPL
Member
Posts: 51
Threads: 26
Joined: Mar 2014
Reputation:
0
|
RE: Automatic open door script
(01-03-2015, 01:54 PM)Romulator Wrote: Change this
AddTimer("DoorScripted1", 0, "TimerMoveDoor");
to this
AddTimer("DoorScripted1", 0.05, "TimerMoveDoor");
This line here:
AddPropForce(asTimer, -70, 0, 0, "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!
2. The numbers may need to be tweaked, depending on which way your door faces. Try these alterations as well:
AddPropForce(asTimer, 70, 0, 0, "world"); AddPropForce(asTimer, 0, 0, -70, "world"); AddPropForce(asTimer, 0, 0, 70, "world");
It din't work.
|
|
01-03-2015, 02:30 PM |
|
DnALANGE
Banned
Posts: 1,549
Threads: 73
Joined: Jan 2012
|
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é;
AddPropForce(asTimer, 0, 0, 5000, "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 |
|
Daemian
Posting Freak
Posts: 1,129
Threads: 42
Joined: Dec 2012
Reputation:
49
|
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 |
|
PutraenusAlivius
Posting Freak
Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation:
119
|
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."
|
|
01-04-2015, 07:35 AM |
|
|