Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: problems with scripting
I didn't understand what you mean by break down, but for looking at an enemy, you can use StartPlayerLookAt
like that:
StartPlayerLookAt("enemy_name", 5, 5, "");
and for a few second later, you should use a timer:
AddTimer("seconds_later", 4, "MapChanger");
then:
void MapChanger(string &in asTimer)
{
ChangeMap("map name", "PlayerStartArea_1", "", "");
}
|
|
08-12-2011, 10:02 AM |
|
Brute
Member
Posts: 197
Threads: 10
Joined: Aug 2011
Reputation:
3
|
RE: problems with scripting
Maybe I should explain something more...
I had a nightmare sequence in my story. The player rans in a corridor and a monster is hunting him.
The End of the corridor is a dead end. The player enters an area then, which should make the following things:
The player break down, what means, the player falls on the ground (maybe by insanity), he looks to his Hunter (the enemy) and after a few seconds, the game change the map.
I had already a script in it but it doesn't work. Maybe it is a total fail...
Here is the script, I had tried to use:
void LevelChange(string &in asTimer)
{
if(asTimer == "1") {
StartPlayerLookAt("Nightmare",7,100,""); // Nightmare is the enemy
}
if(asTimer == "3") {
SetPlayerRunSpeedMul(0);
FadePlayerRollTo(60,8,15);
MovePlayerHeadPos(-1,-1.2f,0,0.4f,0.2f);
ChangeMap("Map01.map", "Game_Start", "", "");
}
}
I also had this line by onStart()
AddEntityCollideCallback("Player" , "Nightmare_End" , "LevelChange" , true , 1);
The names are correct, at this point, I am sure.
|
|
08-12-2011, 10:58 AM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: problems with scripting
Ah, I see.
For collide call back functions, you should put something different instead of (string &in asTimer)
Should be like this:
void LevelChange(string &in asParent, string &in asChild, int alState)
{
AddTimer("First",1, " TimerFunction");
AddTimer("Second",3, " TimerFunction");
}
void TimerFunction(string &in asTimer)
{
if(asTimer == "First") {
StartPlayerLookAt("Nightmare",7,100,""); // Nightmare is the enemy
}
if(asTimer == "Second") {
SetPlayerRunSpeedMul(0);
FadePlayerRollTo(60,8,15);
MovePlayerHeadPos(-1,-1.2f,0,0.4f,0.2f);
ChangeMap("Map01.map", "Game_Start", "", "");
}
}
|
|
08-12-2011, 12:27 PM |
|
Brute
Member
Posts: 197
Threads: 10
Joined: Aug 2011
Reputation:
3
|
RE: problems with scripting
OMG!
Thank you Tanshaydar!
It works, and I think, I had now understand to use timer. Thanks so much!
But which script must I wrote in the second map to stop this? I had already tried
StopPlayerLookAt()
but he is still crouching.
(This post was last modified: 08-12-2011, 01:54 PM by Brute.)
|
|
08-12-2011, 01:13 PM |
|
Tanshaydar
From Beyond
Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation:
67
|
RE: problems with scripting
ChangePlayerStatetoNormal or something like that, I don't remember exactly, should do it.
|
|
08-12-2011, 02:01 PM |
|
Tesseract
Senior Member
Posts: 498
Threads: 7
Joined: Mar 2011
Reputation:
18
|
RE: problems with scripting
SetPlayerCrouching(false);
that will stop him from crouching.
|
|
08-12-2011, 02:06 PM |
|
Brute
Member
Posts: 197
Threads: 10
Joined: Aug 2011
Reputation:
3
|
RE: problems with scripting
I had just seen, that I had already SetPlayerCrouching(false); line in the other map in a wake script. So I think I must change the HeadPos of the Player.
But what is the normal position of his head?
|
|
08-12-2011, 03:01 PM |
|
Endlvl
Junior Member
Posts: 28
Threads: 4
Joined: Aug 2011
Reputation:
0
|
RE: problems with scripting
Don't spam
(This post was last modified: 08-12-2011, 03:48 PM by Tanshaydar.)
|
|
08-12-2011, 03:25 PM |
|
Tesseract
Senior Member
Posts: 498
Threads: 7
Joined: Mar 2011
Reputation:
18
|
RE: problems with scripting
(08-12-2011, 03:01 PM)Brute Wrote: I had just seen, that I had already SetPlayerCrouching(false); line in the other map in a wake script. So I think I must change the HeadPos of the Player.
But what is the normal position of his head?
this is a normal player head pos took me FOREVER to get it right U_U
MovePlayerHeadPos(0, 0, 0, 2, 0.5f);
|
|
08-13-2011, 01:50 AM |
|
Brute
Member
Posts: 197
Threads: 10
Joined: Aug 2011
Reputation:
3
|
RE: problems with scripting
Thanks Saffire192.
Now it works.
I will report, when I had other problems with my full conversion. But meanwhile you could help me with another custom story, which I had stop, because my weak knowledge of scripting.
Quote: I had already problem by making buttons and levers.
So this is my concept.
The player used a lever ( I had also tried with a button, with no succes)
which makes the following things:
- He unlock a door
- He activate some enemys
- He plays a sound
But nothing works! Not even with a button!
Maybe my script is total fail again...
This is by onStart
Quote:SetEntityConnectionStateChangeCallback("LeverExit01", "OpentheExit");
And this is the rest:
Quote:void OpentheExit(string &in asConnectionName, string &in asMainEntity, string &in asConnectEntity, int alState)
{
if (alState == 1)
{
SetLeverStuckState(asMainEntity, -1, true);
SetSwingDoorLocked("Ceiling", false, true);
SetEntityActive("Exit_Guard01" , true);
PlaySoundAtEntity("LeverExit01", "levelexitopen.ogg", "Player", 0.5f, false);
AddEnemyPatrolNode("Exit_Guard01", "Path9", 0.1f, "true"); // There are more pathnodes, but then my post would explode... xD
}
}
So what is wrong?
I have also a small question. It is possible to make enemys never dissapear and always followed their pathnodes, like in Justine? How did I do this?
|
|
08-13-2011, 08:14 AM |
|
|