Wintermute Engine Forum
Wintermute Engine => Technical forum => Topic started by: Yakuzza on October 02, 2012, 06:59:03 PM
-
Let's say to go to the next scene player must pick up 5 items from the various scenes.
Can someone please point me to the right direction on how to script it?
-
if (Game.HasItem("itemname") && Game.HasItem("itemname") etc etc etc)
{
Game.ChangeScene("scenename");
}
else
{
actor.Talk("I need to pick up, itemnames before leaving the room.");
}
-
yeah i've tried that already
if (Game.HasItem("200euro") && Game.HasItem("I_Hairpin") && Game.HasItem("I_lipstick"))
{
Game.ChangeScene("scenes\Basement\Basement3\Basement3.scene", false, false);
}
else
{
Sleep(200);
}
but the game does nothing when all 3 items picked up
-
hmm it should work.
when picking up items are you using Game.TakeItem or actor.TakeItem ?
i am assuming this happens in a script file with , on "LeftClick" and attached to the exit entity?
-
You could try using
-
Oh I didn't realize it has to be "OnLeftClick". I thought game gonna constantly check if items has been taken.
Anyway it works now.
Thanks for your help guys!
-
:) sure no problem.
you can put it all in loop, it should work, but i haven't tried it.
while (true)
{
{
Game.
ChangeScene("scenes\Basement\Basement3\Basement3.scene",
false,
false);
}
else
{
}
}
-
Thanks again lof!
-
To be honest - this "check in the loop" is a terrible advice. It will add a lot of unpredictability to your game. Typically when another action will be taking place suddenly player gets random scene change. Is it what you want?
What I personally would do is to make a global Scene method which would be called after each TakeItem.
So:
in scene_init.script
method CheckAllItems()
{
{
Game.
ChangeScene("scenes\Basement\Basement3\Basement3.scene",
false,
false);
}
}
then when you pick either of those items simply do:
This way you exactly can control where your scene changing occurs and you'll save yourself tons of pulled hair from impossible to replicate bugs reported by your testers.
Just my 2 cents.