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 Door
proshitness Offline
Junior Member

Posts: 20
Threads: 3
Joined: Nov 2011
Reputation: 0
#1
Door

How to do a door swing lock script?
the door is :castle_1
script area: Shut1
this is the script if you can help:


void OnStart(){    AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);}
void OnEnter(){}
void OnLeave(){}
void CloseDoors(string &in asParent, bool abChild, bool abEffects){    setSwingDoorLocked("castle_1", true, true);}
11-09-2011, 09:15 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#2
RE: Door

void OnStart()
{
AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);
}

void CloseDoors(string &in asParent, bool abChild, bool abEffects)
{
setSwingDoorLocked("castle_1", true, true);
}




That should work

11-09-2011, 10:39 PM
Find
Statyk Offline
Schrödinger's Mod

Posts: 4,390
Threads: 72
Joined: Sep 2011
Reputation: 241
#3
RE: Door


This should work. Includes the wind sound. If the sound does not play, you will have to make a Script Area near the door, title it something and change the name at: "PlaySoundAtEntity("", "general_wind_whirl.snt", "castle_1", 0, false);" to the name of the Script Area and it will work fine. Also, organizing your script with "Enter"s and "Tab"s can help a LOT.

Your issues(fixed):
- An entity collide does not have "bool abEffects", It is "int alState".
- SetSwingDoorLocked was spelled: "setSwingDoorLocked" again with the capitalizations buddy =]

Just copy and paste this all.

void OnStart()
{
AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);
}
void OnEnter()
{
}
void OnLeave()
{
}

void CloseDoors(string &in asParent, bool abChild, int alState)
{
SetSwingDoorLocked("castle_1", true, true);
PlaySoundAtEntity("", "general_wind_whirl.snt", "castle_1", 0, false);
}



(This post was last modified: 11-09-2011, 10:46 PM by Statyk.)
11-09-2011, 10:40 PM
Find
proshitness Offline
Junior Member

Posts: 20
Threads: 3
Joined: Nov 2011
Reputation: 0
#4
RE: Door

the door didn't work =\
11-11-2011, 01:24 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#5
RE: Door

(11-11-2011, 01:24 PM)proshitness Wrote: the door didn't work =\
Didn't work? Are you talking about locking a closed door, or by slamming an open door shut and than lock the door?

11-11-2011, 01:40 PM
Find
proshitness Offline
Junior Member

Posts: 20
Threads: 3
Joined: Nov 2011
Reputation: 0
#6
RE: Door

slamming an open door shut and than lock the door
11-11-2011, 02:45 PM
Find
flamez3 Offline
Posting Freak

Posts: 1,281
Threads: 48
Joined: Apr 2011
Reputation: 57
#7
RE: Door

(11-11-2011, 02:45 PM)proshitness Wrote: slamming an open door shut and than lock the door
well than you need to add propforce:

AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
SetSwingDoorLocked(string& asName, bool abLocked, bool abEffects);


11-11-2011, 03:11 PM
Find
proshitness Offline
Junior Member

Posts: 20
Threads: 3
Joined: Nov 2011
Reputation: 0
#8
RE: Door

Where to put it?
11-11-2011, 04:57 PM
Find
Unearthlybrutal Offline
Posting Freak

Posts: 775
Threads: 12
Joined: May 2011
Reputation: 26
#9
RE: Door

Use this instead of PropForce:

SetSwingDoorClosed("castle_1", true, true);

It's much easierSmile

Here is the full thing:


void OnStart()
{
AddEntityCollideCallback("Player", "Shut1", "CloseDoors", true, 1);
}

void CloseDoors(string &in asParent, bool abChild, bool abEffects)
{
SetSwingDoorClosed("castle_1", true, true);
SetSwingDoorLocked("castle_1", true, true);
}

When Life No Longer Exists
Full-conversion mod
(This post was last modified: 11-11-2011, 05:30 PM by Unearthlybrutal.)
11-11-2011, 05:29 PM
Website Find
proshitness Offline
Junior Member

Posts: 20
Threads: 3
Joined: Nov 2011
Reputation: 0
#10
RE: Door

didn't work
11-11-2011, 06:49 PM
Find




Users browsing this thread: 2 Guest(s)