04-21-2014, 03:24 AM
04-21-2014, 03:30 AM
Firstly, FrictionalGames did do this in their second map, so it would be a good idea to look at how they did it 
Search up in the 01_old_archives.hps code for "//BEGIN PICK LANTERN & OIL//"
If you still can't figure it out, let us know where you're getting stuck! (While we can help just by giving code, it's still a good idea to learn about doing these things through looking at other code)

Search up in the 01_old_archives.hps code for "//BEGIN PICK LANTERN & OIL//"
If you still can't figure it out, let us know where you're getting stuck! (While we can help just by giving code, it's still a good idea to learn about doing these things through looking at other code)

04-21-2014, 04:33 AM
(04-21-2014, 03:30 AM)Romulator Wrote: [ -> ]Firstly, FrictionalGames did do this in their second map, so it would be a good idea to look at how they did it
Search up in the 01_old_archives.hps code for "//BEGIN PICK LANTERN & OIL//"
If you still can't figure it out, let us know where you're getting stuck! (While we can help just by giving code, it's still a good idea to learn about doing these things through looking at other code)
sure its better to learn things from other codes, but i saw these.. its to high for me, because i think i dont need some if-statements.. also i dont understand this part

04-21-2014, 07:14 AM
Spoiler below!
PHP Code:
void OnStart()
{
SetEntityCallbackFunc("Lantern", "OpenDoor");
SetLocalVarInt("Door", 0);
}
void OpenDoor(string &in asEntity, string &in type)
{
AddLocalVarInt("Door", 1);
CheckLocal();
}
void CheckLocal()
{
if (GetLocalVarInt("Door") == 1)
{
SetSwingDoorLocked("DoorName", false, true);
}
}
04-21-2014, 10:34 AM
Actually you don't need a single if-statement.
Just use an interaction-callback.
Think about it like a sentence:
When touching the lantern
---unlock the door.
Now this can be made into an if-statement like this:
When walking through area
---IF the player has the lantern
------unlock the door
Just use an interaction-callback.
Think about it like a sentence:
When touching the lantern
---unlock the door.
Now this can be made into an if-statement like this:
When walking through area
---IF the player has the lantern
------unlock the door
04-21-2014, 12:07 PM
(04-21-2014, 07:14 AM)SomethingRidiculous Wrote: [ -> ]Spoiler below!
PHP Code:void OnStart()
{
SetEntityCallbackFunc("Lantern", "OpenDoor");
SetLocalVarInt("Door", 0);
}
void OpenDoor(string &in asEntity, string &in type)
{
AddLocalVarInt("Door", 1);
CheckLocal();
}
void CheckLocal()
{
if (GetLocalVarInt("Door") == 1)
{
SetSwingDoorLocked("DoorName", false, true);
}
}
Thanks a lot man!