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 Int and Float Question
Plazmater Offline
Member

Posts: 122
Threads: 24
Joined: Aug 2013
Reputation: 1
#1
Int and Float Question

Ok, so what i want to ask is how should i write these 2 scripts in hps so that they are working.
I need correct form of these scripts.

First, Int:

How or where should i write that number of the door state so that this script works ?

int GetSwingDoorState(string& asName);

I need this , so that when puzzle is completed and door is unlocked , that door will remain little opened after that.



Second, Float:

Same thing here i guess ?

float GetPlayerSanity();
(This post was last modified: 07-19-2014, 11:00 AM by Plazmater.)
07-19-2014, 10:58 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#2
RE: Int and Float Question

Those two is usually in If-Else statements. Example:
Spoiler below!

PHP Code: (Select All)
if(GetSwingDoorState("DoorName") == i)
{

or
PHP Code: (Select All)
if(GetPlayerSanity() == f)
{



"Veni, vidi, vici."
"I came, I saw, I conquered."
07-19-2014, 02:15 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#3
RE: Int and Float Question

What do you want to do with the player sanity? As Mr. Potter already stated, these are used to get a value and test it in for example an if-statement.

If you're interested in leaving a door slightly open at some point, I do have a video that might help. It is a bit lengthy though, and there are probably easier methods of doing so if you're not interested in the effect that I show here.

07-19-2014, 02:27 PM
Find
Plazmater Offline
Member

Posts: 122
Threads: 24
Joined: Aug 2013
Reputation: 1
#4
RE: Int and Float Question

Nah, that float isnt important to me... i was just curious.

But that door state is important, i want that if door unlocks after i complete book puzzle, it also remain opened to some extent.

As written in wiki, there are 3 door states:

-1 = angle is close to 0°, 1 = angle is 70% or higher of max, 0 = inbetween -1 and 1.

Now, can i use it in void like this ?

void PuzzleCompleted()
{
SetSwingDoorLocked("mansion_7", false, true);
GetSwingDoorState("DoorName") == 1;
}

(I dont know if i am writing that code correctly.)

Unlike your script Mudbill which makes door slowly opening, i want the door open to certain extent instantly.
Thats what that script does i guess ?
07-19-2014, 03:36 PM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#5
RE: Int and Float Question

Not really. Since this is only a "getter" and not a "setter" script, it will only tell you what the door state is, not actually do anything to it.

One thing you could do is replace the door with one that is already open. In the level editor you can set the OpenAmount. Have one door with a value there being inactive, then use SetEntityActive and disable the locked, closed door, then enable the already opened door.
That's probably the easiest way to achieve this.

07-19-2014, 04:55 PM
Find
Plazmater Offline
Member

Posts: 122
Threads: 24
Joined: Aug 2013
Reputation: 1
#6
RE: Int and Float Question

(07-19-2014, 04:55 PM)Mudbill Wrote: Not really. Since this is only a "getter" and not a "setter" script, it will only tell you what the door state is, not actually do anything to it.

One thing you could do is replace the door with one that is already open. In the level editor you can set the OpenAmount. Have one door with a value there being inactive, then use SetEntityActive and disable the locked, closed door, then enable the already opened door.
That's probably the easiest way to achieve this.

Aaaaach thanks man, clever idea, so easy to do , oh well i think reason i wasnt thinking about that is that i am too much into scripting... Thanks again! Big Grin
07-19-2014, 05:05 PM
Find




Users browsing this thread: 2 Guest(s)