Город Джунов
Problem with chest - Версия для печати

+- Город Джунов (https://www.gipat.ru/forum)
+-- Форум English-speaking Diaspora (https://www.gipat.ru/forum/forum-22.html)
+--- Форум General Discussion (https://www.gipat.ru/forum/forum-13.html)
+--- Темы: Problem with chest (/thread-3238.html)



Problem with chest - Mikelos - 01.09.2008

I've put zone8 to multiplayer, everything works coretly. I've deleted whole script from singleplayer and tried to make my own. I wanted to put a chest, which is able to open, but it doesn't work
Код:
GlobalVars (
 NULL : object,
 VSS#i#val : object,
 i : object,
 Heroes : group,
 Chest1 : object
)
DeclareScript VCheck#0#1 (  this : object )
DeclareScript VCheck#0#2 (  this : object )
DeclareScript VTriger#0#4 (  this : object )
DeclareScript #OnBriefingComplete (  nPlayer : float,  szComplete : string )

Script VCheck#0#1
(
 if
 (
   IsEqual( GetLeverState( Chest1 ) , 0 )
 )
 then
 (
   KillScript(  )
   VCheck#0#2( this )
 )
)

Script VCheck#0#2
(
 if
 (
   IsEqual( GetLeverState( Chest1 ) , 1 )
 )
 then
 (
   KillScript(  )
   VTriger#0#4( this )
 )
)

Script VTriger#0#4
(
 if
 (
 )
 then
 (
   KillScript(  )
   GiveMoney( 0, 500 )
 )
)

WorldScript
(
 ConsoleString ( "test")
 Sleep( 2 )
 Chest1 = GetObjectByID( "1670" )
 VCheck#0#1( NULL )
 VCheck#0#2( NULL )
 VTriger#0#4( NULL )
)
When I go on map and open console I see the console string "test", but when I'm close to chest and I want to open it, i'm not able to do this, like it has been closed by key (I've changed the value "Key" from this object on 0). Any ideas what am I doing wrong?


Problem with chest - ALtair - 02.09.2008

There's a few options you are to be sure about:
1) The Lever in EI can be opened in three different ways:
a) With no condition
b) With a key
c) With a sufficient hand-skill (don't know how it is named in your localized version)
This condition is set in the first field of LeverStats in MRT. The second field of LeverStats is then a value for a condition. For 1b it is a key ID and for 1c it is a skill value.
2) If the first option is satisfied then the lever will switch its' state while player is performing an action on it. If the lever is Cycled (another param of Lever object in the MRT), then this lever will switch its' state in cycle (0-1-0-1-0-1-...) beginning with the CurrentState param in the (so popular nowadays) MRT ^_^.

Nevertheless, I just can't imagine why do you invoke all the scripts at a time in the WorldScript? What i saw is that you've tried to run them in the specified by some conditions order (#0#1 - #0#2 - #0#4). Then why do you call them unconditionally in the WorldScript? And i should pay your attention to the unnecessarity of the VCheck#0#1. The chest as a lever object must be in a zero-state by default, meaning it should be defined so in your mob-editor (MRT).


Problem with chest - Mikelos - 02.09.2008

Thanks for fast reply.
I've checked once again the ID_Lever I didn't find any mistake, it was set for no condition and the cycle was turned off I think (set on 0).
I've corrected the script but it's still like before. Isn't it because this script is in zone8-lmp.mob file and script could collide somehow with script from z8q1.mob? There is in both of them ConsoleString, in both it's different text and both are shown in the console.
That's how my script looks now:
Код:
GlobalVars (
 NULL : object,
 VSS#i#val : object,
 i : object,
 Heroes : group,
 Chest1 : object
)
DeclareScript VCheck#0#1 (  this : object )
DeclareScript VTriger#0#2 (  this : object )
DeclareScript #OnBriefingComplete (  nPlayer : float,  szComplete : string )

Script VCheck#0#1
(
 if
 (
   IsEqual( GetLeverState( Chest1 ) , 1 )
 )
 then
 (
   KillScript(  )
   VTriger#0#2( this )
 )
)

Script VTriger#0#2
(
 if
 (
 )
 then
 (
   KillScript(  )
   GiveMoney( 0, 500 )
 )
)

WorldScript
(
 ConsoleString ( "test" )
 Sleep( 2 )
 Chest1 = GetObjectByID( "1670" )
 VCheck#0#1( NULL )
)

EDIT:
Damn, I found stupid mistake, I've had 3 chests on my map, my script was to the first one, but I've made the "pink light" over the second one. But thanks for your help anyway. Everything works perfectly now.