home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2004 July & August / Gamestar_64_2004-07-08_dvd.iso / Dema / singles_trial.exe / KOMMODECHAR.LUA < prev    next >
Encoding:
Text File  |  2004-05-21  |  1.8 KB  |  85 lines

  1. -- kommode character state machine
  2. beginStateMachine()
  3.     
  4.     onEnter(function(msg)
  5.         local kommode = getStateObjectFromID(msg.sender);
  6.         storeStateObject("kommode", kommode);
  7.         
  8.         
  9.         if (kommode) then
  10.             -- kommode does exist
  11.             local actionPointName = retrieveData("actionPointName");
  12.             local actionPoint = getParent().getFreeActionPoint(kommode, actionPointName);
  13.             
  14.             if exitIfWrongPosition(getParent(), kommode, actionPointName) then return end;    
  15.             
  16.             if (not actionPoint) then
  17.                 -- action points is locked
  18.                 getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
  19.                 sendMsg("emoThink", getParent().walkSO);
  20.                 exitStateMachine();
  21.             else
  22.                 getParent().lockActionPoint(kommode, actionPointName);
  23.             end
  24.         else
  25.             -- kommode does not exist anymore
  26.             getParent().setEmoticon(EMOTICON_CANNOT, EMOTICON_DELAY);
  27.             sendMsg("emoThink", getParent().walkSO);
  28.             exitStateMachine();
  29.         end
  30.         
  31.         
  32.         freeHands(getParent());
  33.         
  34.     end )
  35.     
  36.     onExit(function(msg)
  37.         local kommode = retrieveStateObject("kommode");
  38.         getParent().unlockActionPoints(kommode);
  39.         removeStateObject("kommode");
  40.     end )
  41.     
  42.     state("outfit")
  43.     
  44.     
  45.         
  46.         onEnter(function(msg)
  47.             --startAnimation("ausziehen2");
  48.             startAnimation(getChangeOutfitAnim(getParent()));
  49.             sendDelayedMsgThis("change", 1600);
  50.         end )
  51.         
  52.         onMsg("change", function(msg)
  53.             local outfit = retrieveData("outfit")
  54.             if (getParent().getOutfit() ~= outfit) then
  55.                 getParent().changeOutfit(outfit);
  56.             end
  57.         end )
  58.     
  59.         onMsg("end", function(msg)
  60.             exitAndGoAway();
  61.         end )
  62.         
  63.         
  64. --        onEnter(function(msg)
  65. --            setPose(archize(getParent(), "stand1"));
  66. --        end )
  67. --        
  68. --        onMsg("end", function(msg)
  69. --            local outfit = retrieveData("outfit")
  70. --            getParent().changeOutfit(outfit);
  71. --            exitAndGoAway();
  72. --        end)
  73. --        
  74.         
  75.         
  76.         
  77.     
  78.         
  79.         
  80.         
  81.         
  82.         
  83.         
  84. endStateMachine()
  85.