Frictional Games Forum (read-only)

Full Version: Please Help me!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi all, I am beginner in scripting and have some questions.

How to open the door with script? Not unlock, but open.

How to fix the position of the character's head on that door?

Thanks previously.
open automaticly?
Well that goos like this
---
Make an ScriptArea in the editor. { when the player walks over, you can make stuff happen "scripted" }
---
This below must put in the .hps file.

AddEntityCollideCallback("Player", "YOURSCRIPTNAMEINEDITOR", "TYPEWHATEVERYOUWANT", false, 1);
---->
Player = This is whenever the player\enemy\or whatever touches the ScriptArea will activate stuff... THIS time is the PLAYER i asume...
YOURSCRIPTNAMEINEDITOR = This is the name of the ScriptArea in the editor { you may change it offcourse }
TYPEWHATEVERYOUWANT = Here you may type whatever you want for example dooropenplease
false = one time of more times .. so false = Unlimited TIMES , true = only one time.
1 = while entering or leaving an script area... I never use this stuff.. always on 1 with all my scripts.

------------

void TYPEWHATEVERYOUWANT(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorDisableAutoClose("NAMEOFTHEDOORYOUWANTTOOPEN", true);
SetSwingDoorClosed("NAMEOFTHEDOORYOUWANTTOOPEN", false, true);
AddPropForce("NAMEOFTHEDOORYOUWANTTOOPEN", 0, 0, 5600, "world");
}
PS... this AddPropForce above you might need to change the values..
Cause i dont know witch way it need to open.....
So try change those 0, 0,5600 if its not working to
0,5600,0 or
5600,0,0
--> The 5600 is the FORCE to open it with... with some doors i think might be diffferent so ALSO may change it to lower or higher values, Just try some out! ps don't go over 50000... The door will fly into heavon.. ehhehee.
Or so on... you have to look for yourself how you want this to to be opend..
Hopefully it helps you a bit.
Btw here is a link for some good help for beginners and sometimes even for me :
http://frictionalgames.com/forum/thread-7085.html
PRESS ON THE SPOILER BELOW click to show
dnalange, Thanks, but another questions: How to fix character's head on that door?


1) The door Opens
2) GiveSanityDamage
3) Camera fixing on that door

And the second: Grunt is walking, but can't see and attack player even if he saw him. How to realise that idea?
To make the player look at the door, use this script: ( i will use the functions of dnalange)

AddEntityCollideCallback("Player", "YOURSCRIPTNAMEINEDITOR", "TYPEWHATEVERYOUWANT", false, 1);



-------------


void TYPEWHATEVERYOUWANT(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorDisableAutoClose("NAMEOFTHEDOORYOUWANTTOOPEN", true);
SetSwingDoorClosed("NAMEOFTHEDOORYOUWANTTOOPEN", false, true);
AddPropForce("NAMEOFTHEDOORYOUWANTTOOPEN", 0, 0, 5600, "world");



StartPlayerLookAt("NAME OF THE DOOR", 6, 6, "");

AddTimer("", "PUT HERE THE TIME IN SECONDS THAT THE PLAYER WILL STAY LOOKING TO THE DOOR", "TimerStopLooking");





}




void TimerStopLooking(string&in asTimer)
{
StopPlayerLookAt();
}
str4wberrypanic, No Matching signatures to AddTimer
Oh, did you put quotes in the " time in seconds that the player wil stay looking to the door " ?
If you did, remove it and try again. It should work.
Grunt is walking, but can't see and attack player even if he saw him. How to realise that idea?
(12-10-2012, 06:51 PM)Sanyam Wrote: [ -> ]Grunt is walking, but can't see and attack player even if he saw him. How to realise that idea?
SetEnemyDisableTriggers(string& asName, bool abX);

Put this in your function. Like:

void Function (parameters)
{
SetEnemyDisableTriggers("Grunt", true);
}
Ok here is your script... Just COPY PASTE :
THIS AT Void OnONTER() --->
{
AddEntityCollideCallback("Player", "YOURSCRIPTNAMEINEDITOR", "TYPEWHATEVERYOUWANT", false, 1);
}
This below In your scipt
--->

void TYPEWHATEVERYOUWANT(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorDisableAutoClose("NAMEOFTHEDOORYOUWANTTOOPEN", true);
SetSwingDoorClosed("NAMEOFTHEDOORYOUWANTTOOPEN", false, true);
AddPropForce("NAMEOFTHEDOORYOUWANTTOOPEN", 0, 0, 5600, "world");

SetEnemyDisableTriggers("YOURENEMYNAME", true);

StartPlayerLookAt("NAME OF THE DOOR", 6, 6, "");

AddTimer("", "5.0f", "TimerStopLooking");

GiveSanityDamage(10.0f, true);
}

void TimerStopLooking(string&in asTimer)
{
StopPlayerLookAt();
FadeEnemyToSmoke("YOURENEMYNAME", true);
}
----------------------------------------------------------------
REPLACE THE ITEMS\ENEYMY names to your things in the editor!
FadeEnemyToSmoke = will DEACTIVATE your enemy, this time in 5 seconds ---> { like it fades into smoke } Or just deactivate by this script:
SetEntityActive("NAME OF THE ENEMY", false); --> false means it will be DE-activated
,
AddTimer("", "5.0f", "TimerStopLooking"); ---> Means after 5 seconds "TimerStopLooking" will be activated.
The 5.0f = 5 seconds ,
The "TimerStopLooking" is the scripted timername, you may name whatever you want to.

Grunt is walking, but can't see and attack player even if he saw him. How to realise that idea?
--? What do you mean here???
I think i fixed that in the script above.. let us know here if it worked.
Thanks very much to all! I will + your reputation. =)
Pages: 1 2