Hi everyone,
I'm still making progress on the game I mentioned in my post over Christmas, only I've gotten stuck again...
I want to make a room where the hotspot is dependant on you having been to another room and seen/experienced the event that happens.
So I have 4 or 5 rooms which all lead together, and the last one - let's say this is room4, is dependant on you having walked into room2 and having seen a scene. If you go in before it will just give you a random message saying "No" or something.
In my head it looks like:
if cEgo [has been to] room2 [then take action x]
if cEgo [has not been to] room 2 [then Display("No, you can't use that yet.");
Can anyone help? I had thought of maybe making the final string in room 4's code so that it adds an inventory item, which if you have allows you to use the hotspot (as I'm not using the inventory for the purposes of this game), but I couldn't figure this out either... If anyone can help either way I'd appreciate it immensely!
Many thanks
NeuroticNugg
[Newb who laughs at his own failure]
Sorry - misleading heading - Didn't think before posting... Either inventory dependant or some other dependancy I'm still to figure out.
Thanks again!
NN
1) Declare variable on Global Variables
Name: beenonroom2
Type: boolean
Value: false
function on_event (EventType event, int data) { //Global Script
if ((event==eEventEnterRoomBeforeFadein) && (data==2)) {
if (Game.DoOnceOnly("justonce")) beenonroom2=true;
}
function room_RepExec(){//this is on room 4 additionally this can go on the on event. Not sure exactly from your description
if (beenonroom2) {
// [then take action x]
}
else {
Display("No, you can't use that yet.");
}
}
Ok, so I've set up the global variable, pardon my denseness, but do I put the first code in room 2 as a new function or mix it up with the event??? My event on entering the room is:
// room script file
function room_FirstLoad()
{
cPlayer2.Say("Speech text");
cPlayer1.Say("Speech text");
cPlayer2.Say("Speech text");
}
The way I'm understanding it I add your code in after this part as a new function?
Thanks for your help!
NN
This code goes into the global script. Not the room.
function on_event (EventType event, int data) { //Global Script
if ((event==eEventEnterRoomBeforeFadein) && (data==2)) {
if (Game.DoOnceOnly("justonce")) beenonroom2=true;
}
There's a function for this condition:
HasPlayerBeenInRoom() (http://www.adventuregamestudio.co.uk/manual/HasPlayerBeenInRoom.htm)
In general though, stuff like this is done with variables, yes (NOT WITH INVENTORY ITEMS, JEEZ).
Quote from: Khricey on Tue 08/02/2011 07:39:45
There's a function for this condition:
HasPlayerBeenInRoom() (http://www.adventuregamestudio.co.uk/manual/HasPlayerBeenInRoom.htm)
I totally forgot about this.