Author Topic: ChangeState problem  (Read 1926 times)

0 Members and 1 Guest are viewing this topic.

Offline fck

ChangeState problem
« on: October 04, 2002, 07:14:27 AM »
I want to program a scene where Ego walks in the water and gets knee deeper ext.  I used a control area in the Roomscript which trigger the egoInWaterScript.  All works fine, but once the ChangeState in activated, I cannot reset it.  So, if Ego walks in the water again, the scene does not repeats itself.


(instance RoomScript of Script
  (properties)
  (method (doit)
     (super:doit())
     (if(== (send gEgo:onControl()) ctlYELLOW)
        (send gRoom:setScript(egoInWaterScript))
     )//if
  )//method


(instance egoInWaterScript of Script
   (properties)
   (method (changeState newState)
      (super:changeState(newState))
      =state newState
      (switch (state)
         (case 0
            (send gEgo:loop(4))      //in water loop
            (send gEgo:setMotion(NULL)) //stop walking
            (send gEgo:cel(1))       //knee deep
            =cycles 5
         )//case 0
         
         (case 1
            (send gEgo:cel(2))    //waste deep
         )//case 1
      )//switch
   )//method
)//instance

Any help on this?

Another question: How can I make Ego to jump onto a box?  If you just position him on top of the box, the view priorities hide legs behind the box and this creates the wrong visual impression.



Offline fck

Re:ChangeState problem
« Reply #1 on: October 09, 2002, 08:23:32 AM »
Hi Guys! The solution is very simple!  For other people, like myself still trying to master SCI, here is the solution:

Do not call in the doit() function a separate script.  Change the code to be something like this:

(if(==(send gEgo:onControl()) ctlYELLOW)
        (send gEgo:view(300))
     )(else
     
        (if(<>(send gEgo:onControl()) ctlYELLOW)
            (send gEgo:view(0))
        )//if
       )//else

View 300 is a view of Ego swimming in the 4 directions.
View 0 is the default walking view.

You would typically call a script with a ChangeState method if you want to set up a scene where Ego is drowning, then you want to print some messages and lastly call the dying scene.

Any expert out that could advise on the "jump on box problem" - Please!!! It take hours  for a beginner to sort it out these things on your own!


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.043 seconds with 20 queries.