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
problems with scripting
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#11
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
Website Find
Brute Offline
Member

Posts: 197
Threads: 10
Joined: Aug 2011
Reputation: 3
#12
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. Smile

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... Blush

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
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#13
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
Website Find
Brute Offline
Member

Posts: 197
Threads: 10
Joined: Aug 2011
Reputation: 3
#14
RE: problems with scripting

OMG!
Big Grin 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. Undecided





(This post was last modified: 08-12-2011, 01:54 PM by Brute.)
08-12-2011, 01:13 PM
Find
Tanshaydar Offline
From Beyond

Posts: 3,085
Threads: 17
Joined: Mar 2009
Reputation: 67
#15
RE: problems with scripting

ChangePlayerStatetoNormal or something like that, I don't remember exactly, should do it.

08-12-2011, 02:01 PM
Website Find
Tesseract Offline
Senior Member

Posts: 498
Threads: 7
Joined: Mar 2011
Reputation: 18
#16
RE: problems with scripting

SetPlayerCrouching(false);

that will stop him from crouching.
08-12-2011, 02:06 PM
Find
Brute Offline
Member

Posts: 197
Threads: 10
Joined: Aug 2011
Reputation: 3
#17
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
Find
Endlvl Offline
Junior Member

Posts: 28
Threads: 4
Joined: Aug 2011
Reputation: 0
#18
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
Find
Tesseract Offline
Senior Member

Posts: 498
Threads: 7
Joined: Mar 2011
Reputation: 18
#19
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
Find
Brute Offline
Member

Posts: 197
Threads: 10
Joined: Aug 2011
Reputation: 3
#20
RE: problems with scripting

Thanks Saffire192. Big Grin
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. Undecided

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! Confused Not even with a button!
Maybe my script is total fail again... Big Grin

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
Find




Users browsing this thread: 1 Guest(s)