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 Can't progress without picking up note+key Script?
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#1
Exclamation  Can't progress without picking up note+key Script?

I'll try to keep my posts to a minimal. Can't believe I've been working on this map for around 2-3 months. Maybe a bit more. Still haven't finished the first map. I'm close to finishing, I just want to add a few small tweaks which will make the custom story more complete and special.

Basically, the character starts in the hotel reception. Before he can walk over to the Room Corridor, he must first pick up the note and key. The note tells him where is Room Key is and the key is in the top drawer. I want a script so that if the character tries to go towards the Room Corridor before he picks up the note, it turns the screen to look at the note and a message is displayed saying "I best pick up that note first."

Then once he reads the note and tries to go to the Room Corridor before picking up the key, screen turns to basically look at the same part (Because of the angle) and a message "I'm going to need my key."

I know how to display the message & make the character look at a script area, plus how to use a timer. I just don't know how to trigger a script and make it so two different things show up, depending if he has picked up the key or note or whatever.
02-03-2014, 09:26 PM
Find
Slanderous Offline
Posting Freak

Posts: 1,606
Threads: 78
Joined: Dec 2012
Reputation: 63
#2
RE: Can't progress without picking up note+key Script?

Send me your map here, and I will see what I can do.
02-03-2014, 09:59 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#3
RE: Can't progress without picking up note+key Script?

Make 2 script area's.
You can do it on the exacpt same spot.
Then do this for the FIRST look :
Quote:void OnStart()
{
AddEntityCollideCallback("Player", "FIRSTSCRIPTAREA", "JUSTYOURSCRIPTNAME", true, 1);
AddEntityCollideCallback("Player", "SECONDSCRIPTAREA", "JUSTYOURSCRIPTNAMETWO", true, 1);
SetEntityPlayerInteractCallback("YOURKEYNAME", "JUSTHECALLBACKNAME", false);
}
+ DEactivate the second scriptarea in the leveleditor.
Quote: void JUSTHECALLBACKNAME(string &in asItem)
{
SetEntityActive("FIRSTSCRIPTAREA" , false);// FIRST script will DEACTIVATE
SetEntityActive("SECONDSCRIPTNAME" , true); //This is when the SECOND script is getting ACTIVE :
}

------
Do you understand what i mean here?
If not, i'll explane more.
Try it, it should work!
(This post was last modified: 02-03-2014, 11:24 PM by DnALANGE.)
02-03-2014, 11:22 PM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#4
RE: Can't progress without picking up note+key Script?

(02-03-2014, 11:22 PM)DnALANGE Wrote: Make 2 script area's.
You can do it on the exacpt same spot.
Then do this for the FIRST look :
Quote:void OnStart()
{
AddEntityCollideCallback("Player", "FIRSTSCRIPTAREA", "JUSTYOURSCRIPTNAME", true, 1);
AddEntityCollideCallback("Player", "SECONDSCRIPTAREA", "JUSTYOURSCRIPTNAMETWO", true, 1);
SetEntityPlayerInteractCallback("YOURKEYNAME", "JUSTHECALLBACKNAME", false);
}
+ DEactivate the second scriptarea in the leveleditor.
Quote: void JUSTHECALLBACKNAME(string &in asItem)
{
SetEntityActive("FIRSTSCRIPTAREA" , false);// FIRST script will DEACTIVATE
SetEntityActive("SECONDSCRIPTNAME" , true); //This is when the SECOND script is getting ACTIVE :
}

------
Do you understand what i mean here?
If not, i'll explane more.
Try it, it should work!

What do you mean by "just your script name"? And if that's the function it calls on, where is it?
02-04-2014, 11:15 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#5
RE: Can't progress without picking up note+key Script?

"JUSTYOURSCRIPTNAME", Meaning i just name the scriptfuncion that..
You can change it in somethng you want..
Those functions are onstart.
---
AddEntityCollideCallback - there are 2 of these for 2 scriptarea's in your leveleditor.
Name them :
1 = FIRSTSCRIPTAREA
2 = SECONDSCRIPTAREA

Hope this helps you a little.

--------
-- And if that's the function it calls on, where is it?--

AWNSER : You have to make them yourself.
Here is the function, you need to do the rest yourself.
Quote: void JUSTYOURSCRIPTNAME(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("SECONDSCRIPTAREA", true);
}
(This post was last modified: 02-05-2014, 12:05 AM by DnALANGE.)
02-05-2014, 12:02 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#6
RE: Can't progress without picking up note+key Script?

It'll be much easier to just use one area and with some if-else statements.
PHP Code: (Select All)
void OnStart()
{
SetEntityCallbackFunc("InsertNoteName""PickUpNote");
SetEntityCallbackFunc("InsertKeyName""PickUpKey");
AddEntityCollideCallback("Player""InsertScriptAreaName""AreaCollideMsg"true1);
}

void PickUpNote(string &in asEntitystring &in type)
{
SetLocalVarInt("Note"1);
}

void PickUpKey(string &in asEntitystring &in type)
{
SetLocalVarInt("Key"1);
}

void AreaCollideMsg(string &in asParentstring &in asChildint alState)
{
if(
GetLocalVarInt("Note") == 0)
{
SetMessage("MessageCategory""MessageEntry"0);
//This should be the message if the Player haven't picked up the note and the key.
StartPlayerLookAt("NoteName"515"");
StopPlayerLookAt();
}

else if(
GetLocalVarInt("Note") == && !GetLocalVarInt("Key") == 1)
{
SetMessage("MessageCategory""MessageEntry"0);
//This should be the message if the Player picked up the note, but not the key.
StartPlayerLookAt("KeyName"515"");
StopPlayerLookAt();
}

else if(
GetLocalVarInt("Note") == && GetLocalVarInt("Key") == 1)
{
}

I'm not that sure that this will work or not. I just quickly did this.

"Veni, vidi, vici."
"I came, I saw, I conquered."
(This post was last modified: 02-05-2014, 03:29 AM by PutraenusAlivius.)
02-05-2014, 03:29 AM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#7
RE: Can't progress without picking up note+key Script?

Hd want 2 scriptareas..
1 is i need the note message
1 is i need the key message
so 2 scriprareas needed here.
maybe add it there player.
(This post was last modified: 02-05-2014, 03:32 AM by DnALANGE.)
02-05-2014, 03:32 AM
Find
PutraenusAlivius Offline
Posting Freak

Posts: 4,713
Threads: 75
Joined: Dec 2012
Reputation: 119
#8
RE: Can't progress without picking up note+key Script?

(02-05-2014, 03:32 AM)DnALANGE Wrote: Hd want 2 scriptareas..
1 is i need the note message
1 is i need the key message
so 2 scriprareas needed here.
maybe add it there player.

You don't have to make 2 areas. You can just do it with just 1 Script Area by using If-Else statements like I did. If the Player picks up the note, but not the key a message will appear. If both is picked up, then another message appears.

See? It's easier to use If-Else statements with just 1 Script Area rather then 2 Script Area with Activate-Deactivating it.

"Veni, vidi, vici."
"I came, I saw, I conquered."
02-05-2014, 03:39 AM
Find
FurtherGames Offline
Member

Posts: 72
Threads: 23
Joined: Apr 2013
Reputation: 1
#9
RE: Can't progress without picking up note+key Script?

(02-05-2014, 03:39 AM)JustAnotherPlayer Wrote:
(02-05-2014, 03:32 AM)DnALANGE Wrote: Hd want 2 scriptareas..
1 is i need the note message
1 is i need the key message
so 2 scriprareas needed here.
maybe add it there player.

You don't have to make 2 areas. You can just do it with just 1 Script Area by using If-Else statements like I did. If the Player picks up the note, but not the key a message will appear. If both is picked up, then another message appears.

See? It's easier to use If-Else statements with just 1 Script Area rather then 2 Script Area with Activate-Deactivating it.


I don't want a message to appear when they pick up both that's the point. I've figured it out using my own method which involves two script areas. I'd rather just use two so I can see what I'm doing.
02-05-2014, 12:28 PM
Find
DnALANGE Offline
Banned

Posts: 1,549
Threads: 73
Joined: Jan 2012
#10
RE: Can't progress without picking up note+key Script?

Next time be more explicit to what you want.
THIS here is 2 messages...??
Quote: I want a script so that if the character tries to go towards the Room Corridor before he picks up the note, it turns the screen to look at the note and a message is displayed saying "I best pick up that note first."

Then once he reads the note and tries to go to the Room Corridor before picking up the key, screen turns to basically look at the same part (Because of the angle) and a message "I'm going to need my key."
---
I've figured it out using my own method ??? That's what i try to say the whole time...
Anyway... try harder next time maybe? IF you think you can do it.?
(This post was last modified: 02-05-2014, 02:24 PM by DnALANGE.)
02-05-2014, 02:23 PM
Find




Users browsing this thread: 1 Guest(s)