Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: kypho on October 28, 2008, 06:52:41 PM
-
Hi, I tried to block one region (make it blocked from sceneedit) and then make a if statement that should release it if item is given to one guy. I tried this:
if (!TeleportOpen) Region.Blocked = true;
else Region.Blocked = false;
but as usually it didn't work...it was only blocked for eternity :) hehe, I know this might be very basic to you guys, but I can't figure it out. The TeleportOpen is set to true if item is given to one npc entity. plz help :P
Thanks already!
- Kypho the Beginner
-
It may be something more, but I would put some brackets in that script to begin with:
if (!TeleportOpen)
{Region.Blocked = true;
}
else
{Region.Blocked = false;
}
Although I don't think the last bracket set is absolutely necessary. If this doesn't help, it's something deeper.
-
unfortunately it was something deeper, still wondering how deep :P ???
-
Someone will help you, I'm sure. Meanwhile, I did a search and found this:
var blockedDeskRegion = Scene.GetNode("block_desk");
blockedDeskRegion.Blocked = false;
You could try fitting that code into your conditional code somehow if--what you wanted to happen as a condition happens but you have to use your own variable and region name.
I'd like to know what works too. This seems like something I'd be using quite a bit. : ) This does sound like something basic but I can't find any documentation on it.
-
you get it all wrong. Blocked region is a node in the scene.
-
Thank you. : )
-
Kypho, are you OK now?
-
we scared him away. :)
-
Hi Meta and Catacomber :) Yes I am here and not scared, brave as a sir Lancelot :D...Thanks for your help, I'll try meta's code later today...see if I can get it work ;)
- Kypho the beginner
-
Huh and Hi again :/ I can't get it working still...
Here is what I got...
#include "scripts\base.inc"
global TeleportOpen;
var e = Scene.GetNode("guarded");
on "LeftClick"
{
if (!TeleportOpen)
{
e.Active = false;
actor.Talk("I am too scared of the space monster!");
actor.Talk("I can't go there");
}
else
{
e.Active = true;
actor.Talk("I think I can go there now safely");
}
}
"guarded" is the name of my region and TeleportOpen is a global variable storing boolean false/true value.
The LeftClick didn't do anything if take the leftclick code away, it says I am too scared of the space monster! in the start of scene (as it should), but later I can't get the else branch working at all...
ALSO I tried following:
#include "scripts\base.inc"
global TeleportOpen;
var e = Scene.GetNode("guarded");
if (!TeleportOpen)
{
e.Active = true;
e.Blocked = true;
}
else
{
e.Active = true;
e.Blocked = false;
}
but neither any of this code works :P
- Kypho the beginner
-
The script looks correct to me. Where exactly is the script loacted (i.e. what is it attached to?)?
-
Hi :)
This script is tried to attach to "guarded" region as a guarded.script...I saw that you can put scripts to region, so I put and you can neither get to there from scenes folder or from sceneEdit.
- Kypho the beginner
-
Well, scene regions aren't "clickable", i.e. their scripts can never receive the LeftClick events. If you need a clickable region, you'll have to place some interactive object over it. Region *entity* might me a good candidate.
Scene regions are used to build scene layout. They are not interactive.
Region entities are invisible interactive spots within the scene.
-
AHhH, I see...thanks for your support again O0
- Kypho
-
Hmm, now when I changed it to region entity it says the first texts when clicking on the region, but later when it should let the region be active when TeleportOpen == true then it doens't say anything or let the character walk on the area. I have the first codes now, which I put here after your glues...
-
And are you sure the variable contains true? Try adding:
Game.Msg(TeleportOpen);
to the beginning of the LeftClick handler. It will briefly display the value of the variable on screen when you click.
-
Jee JEE I got it working...Here is the code:
#include "scripts\base.inc"
global TeleportOpen;
var e = Scene.GetNode("guarded");
on "LeftClick"
{
if (!TeleportOpen)
{
e.Blocked = true;
actor.Talk("I am too scared of the space monster!");
actor.Talk("I can't go there");
}
else
{
GoToObject();
e.Blocked = false;
actor.Talk("I think I can go there now safely");
}
}
function GoToObject ()
{
actor.GoTo(770,550);
actor.TurnTo(DI_DOWNRIGHT);
}
so you see, there is slight difference... I use e.Blocked and then on the else branch I use gotoobject function to make that lameass fat wizard to move :)
- Kypho the beginner