I have made a custom dialogue tree, and I have problems with it. The type of dialogue tree is a icon based one, and I am having problems with making objects not clickable when this tree appears.
The tree appears when you interact with characters, and replaces the inventory.
This is the code I used.
cDerek.FaceCharacter(cAgraj, eBlock);
cDerek.Say("Um, sir?");
cAgraj.Say("What is it?");
cAgraj.Clickable = false;
RemoveWalkableArea(1);
gInventory.Visible = false;
gDialogueTreeAgraj.Visible = true;
Please elaborate, which objects you are trying to disable, and what does not work or does not work like you expected?
Quote from: Crimson Wizard on Thu 09/07/2020 14:32:45
Please elaborate, which objects you are trying to disable, and what does not work or does not work like you expected?
I'm currently just testing in one room, but I'm trying to make one object, the painting, not clickable while talking. I have tried to find a way to make the objects in the room not clickable, but I haven't found a way to code object in the global script.
I already tried a code but it didn't work
object.clickable = false
You can try setting the GUI's PopUpStyle to "pause game when shown", but that might have unintended consequences.
You can also make gDialogueTreeAgraj cover the entire screen and make part of the GUI's background image transparent, that should also catch room clicks.
A third way is to use eModePointer as mouse.Mode when the dialog GUI is open and modify on_mouse_click etc. so they ignore eModePointer clicks.
If you only want to make one or two specific objects in one specific room not clickable, you can use their IDs:
object[x].Clickable = false; // where x is the object's ID, found in the room's Properties panel
If you want to turn all objects in the room unclickable, you can always do
for (int i = 0; i < 30; i++) { // rooms can have a maximum of 30 objects I think? Or was it 40?
object[i].Clickable = false;
}
(and then you would do the opposite to make them clickable again)
Or you can make gDialogueTreeAgraj cover the whole screen, like Khris says, or you can create a black GUI at 99% transparency that covers the whole screen, and place it right behind gDialogueTreeAgraj so it catches any clicks in the room.
Quote from: Laura Hunt on Thu 09/07/2020 15:11:44
for (int i = 0; i < 30; i++) { // rooms can have a maximum of 30 objects I think? Or was it 40?
object[i].Clickable = false;
}
You must not do this IIRC, because object[ i ] can return null or cause "index out of array bounds" error if it does not exist. The proper way is to compare to Room.ObjectCount:
for (int i = 0; i < Room.ObjectCount; i++) {
object[i].Clickable = false;
}
Quote from: Crimson Wizard on Thu 09/07/2020 15:13:36
Quote from: Laura Hunt on Thu 09/07/2020 15:11:44
for (int i = 0; i < 30; i++) { // rooms can have a maximum of 30 objects I think? Or was it 40?
object[i].Clickable = false;
}
You must not do this IIRC, because object[ i ] can return null or cause "index out of array bounds" error if it does not exist. The proper way is to compare to Room.ObjectCount:
for (int i = 0; i < Room.ObjectCount; i++) {
object[i].Clickable = false;
}
I totally forgot
Room.ObjectCount existed. Thanks for the correction!