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 Repeating Functions SOLVED
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Repeating Functions

There are ways of doing such, by simply using the asEntity parameter. Kinda like what Neelke said, but more flexible. Try this:

PHP Code: (Select All)
void OnEnter()
{
    
AddUseItemCallback("""key_study_1""AreaLock""UnlockingDoor"true);
}

void UnlockingDoor(string &in asEntitystring &in asItem)
{
    
SetPlayerRunSpeedMul(0);
    
SetPlayerMoveSpeedMul(0.2);
    
SetPlayerLookSpeedMul(0.3);

    
AddTimer(asEntity "_door"2.0f"Unlocked");
    
SetSwingDoorLocked(asEntity "_door"falsetrue);
}

void Unlocked(string &in asTimer)
{
    
PlaySoundAtEntity("""unlock_door"asTimer0false);
    
SetPlayerRunSpeedMul(1);
    
SetPlayerMoveSpeedMul(1);
    
SetPlayerLookSpeedMul(1);


As you can see, I edited your callback to be used on an area named AreaLock. You can name it for example AreaLock_1, but the door NEEDS to have the same name but including _door at the end. For for example your area is named AreaLock, the door the area is located on must be named AreaLock_door. This is because the code will use the name of the area but add the _door extension to it, then trigger the script on the matching entity.

(This post was last modified: 04-14-2014, 05:15 PM by Mudbill.)
04-14-2014, 05:14 PM
Find


Messages In This Thread
RE: Repeating Functions - by Neelke - 04-14-2014, 03:30 PM
RE: Repeating Functions - by Mudbill - 04-14-2014, 05:14 PM
RE: Repeating Functions - by hunchbackproduction - 04-15-2014, 10:35 AM



Users browsing this thread: 1 Guest(s)