<b>Maybe you find no use for this article, and wonder why the hell did I post it?</b> Read the question... that's exactly how you should NOT write - and look at the result: a not so good answer. However, this might also be exactly what you are looking for, and then, welcome and read the answer!
<b>Question:</b> "how do you make an object tell if it is in another room besides the 1 its in and know if its in a certain room even if the objects not in the same room as the 1 its trying to know what room its in"
<b>Answer:</b> First of all, I just love your sentence. Not only is it hard to understand, but it is also one piece of text without any interpunctation what so ever. For everyone else's comprhension I'll simplifie it like this:
- Make the object tell if there is a duplicate of itself in the room beside the one it is in.
- Be able to know whether a object exists in a certain room, without actually being in that room.
I hope I got the question right. Anyway, there is not way to check any kind of values in one room, from another, as long as these values are not global. So you need to make all the information you want to find out global, and preferably you simply count it yourself so that you know that there are a enemy of the type swordsman in room number five. This is the easiest way. Otherwise, you would have to go through the rooms at the start of the game and "index" all the rooms. The code for this would typically be using this method:
if (object_exists(obj_enemy_swordsman)) {
global.obj_exist_swordsman[room_index] = true;
}
if (object_exists(obj_enemy_crossbowman)) {
global.obj_exist_crossbowman[room_index] = true;
}
But this is highly unefficient, insufficient. If I would just have little more information about what your were trying to do there could possibly be a brilliant solution - but with the currently given conditions there are no better.
<b>This is also why I chose to post this question - to prove how one's way to write a question might ruin all chances of having it answered. Everyone should think about this!</b>
.
Users logged in:
Comments
Loading comments...