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 Determine angle on object
SwingsDarkCreeps Offline
Junior Member

Posts: 26
Threads: 3
Joined: Jun 2015
Reputation: 0
#8
RE: Determine angle on object

Hello Smile, I think that the better way to do that is to use a lever(custom entity)-that when is attached at a mount(support) and the player move the lever in the right direction the result will be something like: unlock a door/ opens a way/unlock a gate for the next path. Using a ScriptArea is one of the easiest way in order to make the lever to attach at the specific mount (the lever is hidden somewhere "random" in the map).Here is my ScriptArea:


.rar   LevelEditor the area.rar (Size: 224.25 KB / Downloads: 102)

That ScriptArea has an EntityCollideCallback function:

AddEntityCollideCallback("Handle", "ConnectTheLever", "AttachLeverToMount", true, 1);

And the rest sequence of the HPS file:

void AttachLeverToMount(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("Lever_1", true);//So I place a compound(lever and the mount) -which I set them Inactive in the level editor

SetEntityActive(asParent, false);
SetEntityActive("Mount", false);
}

//the next part is for unlocking the door depending on the lever's state(position):
//so as Romulator said before the up state is marked with number 1 which i usedSmile
void UnlockDoor(string &in asEntity, int LeverState)
{
if(LeverState == 1) {
SetSwingDoorLocked("Mansion_1", false, true);
PlaySoundAtEntity("", "unlock_door.snt", "Mansion_1", 0, false);
SetLeverStuckState(asEntity, LeverState, true);//this locks the lever in the position in which the player move it
}
}

it worksBig Grin
(This post was last modified: 07-05-2015, 08:32 PM by SwingsDarkCreeps.)
07-05-2015, 08:11 PM
Find


Messages In This Thread
Determine angle on object - by Neelke - 07-03-2015, 02:00 PM
RE: Determine angle on object - by Neelke - 07-03-2015, 02:15 PM
RE: Determine angle on object - by Rahmerh - 07-03-2015, 02:40 PM
RE: Determine angle on object - by Romulator - 07-03-2015, 03:19 PM
RE: Determine angle on object - by Rahmerh - 07-03-2015, 03:23 PM
RE: Determine angle on object - by Neelke - 07-03-2015, 04:31 PM
RE: Determine angle on object - by SwingsDarkCreeps - 07-05-2015, 08:11 PM



Users browsing this thread: 1 Guest(s)