Advertisement
Guest User

Untitled

a guest
Jul 18th, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 5.92 KB | None | 0 0
  1. class 1 wiseman : citizen
  2. {
  3. parameter:
  4.   string  wiseman_challenge_1 = "wiseman_challenge_1.htm";
  5.   string  wiseman_challenge_2 = "wiseman_challenge_2.htm";
  6.   string  wiseman_challenge_3 = "wiseman_challenge_3.htm";
  7.   string  wiseman_challenge_4 = "wiseman_challenge_4.htm";
  8.   string  wiseman_challenge_5 = "wiseman_challenge_5.htm";
  9.  
  10. handler:
  11.   EventHandler CREATED()
  12.     {
  13.       myself::Shout( "All we have to decide is what to do with the time that is given us." );
  14.     }
  15.  
  16.   EventHandler TALKED( talker )
  17.   {
  18.     if( myself.i_ai0 == 1 )
  19.     {
  20.       myself::Say( "bye");
  21.       myself::Despawn();
  22.     }
  23.  
  24.     myself::AddTimerEx( 1, 30 * 1000 );
  25.  
  26.     if( gg::Rand( 5 ) == 0 && myself.i_ai0 == 0 )
  27.     {
  28.       myself::ShowPage( talker, wiseman_challenge_1 );
  29.       myself.i_ai0 = 1;
  30.     }
  31.  
  32.     else if( gg::Rand( 5 ) == 1 && myself.i_ai0 == 0 )
  33.     {
  34.       myself::ShowPage( talker, wiseman_challenge_2 );
  35.       myself.i_ai0 = 1;
  36.     }
  37.  
  38.     else if( gg::Rand( 5 ) == 2 && myself.i_ai0 == 0 )
  39.     {
  40.       myself::ShowPage( talker, wiseman_challenge_3 );
  41.       myself.i_ai0 = 1;
  42.     }
  43.  
  44.     else if( gg::Rand( 5 ) == 3 && myself.i_ai0 == 0 )
  45.     {
  46.       myself::ShowPage( talker, wiseman_challenge_4 );
  47.       myself.i_ai0 = 1;
  48.     }
  49.  
  50.     else if( gg::Rand( 5 ) == 4 && myself.i_ai0 == 0 )
  51.     {
  52.       myself::ShowPage( talker, wiseman_challenge_5 );
  53.       myself.i_ai0 = 1;
  54.     }
  55.  
  56.     else if (myself.i_ai0 == 0 )
  57.     {
  58.       myself::ShowPage( talker, wiseman_challenge_5 );
  59.       myself.i_ai0 = 1;
  60.     }
  61.   }
  62.  
  63.   EventHandler MENU_SELECTED( talker, ask, reply, fhtml0 )
  64.   {
  65.     target = talker;
  66.     if ( ask == -1 )
  67.     {
  68.       if ( reply == 1 )
  69.       {        
  70.         myself::Say( "Correct answer");
  71.  
  72.         if( gg::Rand( 10 ) < 2 )
  73.         {                
  74.           myself::GiveItem1( target, 7863, 1 );              
  75.         }    
  76.       myself::Despawn();
  77.     }
  78.  
  79.     if ( reply == 2 )
  80.     {
  81.       myself::Say( "nope");
  82.       myself::Despawn();
  83.     }
  84.  
  85.     if ( reply == 3 )
  86.     {
  87.       myself::Say( "nope");
  88.       myself::Despawn();
  89.     }
  90.  
  91.     if ( reply == 4 )
  92.     {
  93.       myself::Say( "nope");
  94.       myself::Despawn();
  95.     }
  96.  
  97.     if ( reply == 5 )
  98.     {
  99.       myself::Say( "nope");
  100.       myself::Despawn();
  101.     }
  102.   }
  103.  
  104.   if (ask == -2)
  105.     {
  106.       if ( reply == 1 )
  107.       {
  108.         myself::Say( "Correct answer");
  109.        
  110.         if( gg::Rand( 10 ) < 2 )
  111.           {                
  112.             myself::GiveItem1( target, 7863, 1 );              
  113.           }
  114.         myself::Despawn();
  115.       }
  116.  
  117.       if ( reply == 2 )
  118.       {
  119.         myself::Say( "nope");
  120.         myself::Despawn();
  121.       }
  122.  
  123.       if ( reply == 3 )
  124.       {
  125.         myself::Say( "nope");
  126.         myself::Despawn();
  127.       }
  128.  
  129.       if ( reply == 4 )
  130.       {
  131.         myself::Say( "nope");
  132.         myself::Despawn();
  133.       }
  134.  
  135.       if ( reply == 5 )
  136.       {
  137.         myself::Say( "nope");
  138.         myself::Despawn();
  139.       }
  140.     }
  141.  
  142.   if (ask == -3)
  143.   {
  144.     if ( reply == 1 )
  145.     {
  146.       myself::Say( "Correct answer");
  147.       if( gg::Rand( 10 ) < 2 )
  148.       {                
  149.         myself::GiveItem1( target, 7863, 1 );              
  150.       }
  151.       myself::Despawn();
  152.     }
  153.  
  154.     if ( reply == 2 )
  155.     {
  156.       myself::Say( "nope");
  157.       myself::Despawn();
  158.     }
  159.  
  160.     if ( reply == 3 )
  161.     {
  162.       myself::Say( "nope");
  163.       myself::Despawn();
  164.     }
  165.  
  166.     if ( reply == 4 )
  167.     {
  168.       myself::Say( "nope");
  169.       myself::Despawn();
  170.     }
  171.  
  172.     if ( reply == 5 )
  173.     {
  174.       myself::Say( "nope");
  175.       myself::Despawn();
  176.     }    
  177.   }
  178.  
  179.   if (ask == -4)
  180.     {
  181.       if ( reply == 1 )
  182.       {
  183.         myself::Say( "Correct answer");
  184.         if( gg::Rand( 10 ) < 2 )
  185.         {                
  186.           myself::GiveItem1( target, 7863, 1 );              
  187.         }
  188.  
  189.       myself::Despawn();
  190.       }
  191.  
  192.     if ( reply == 2 )
  193.     {
  194.       myself::Say( "nope");
  195.       myself::Despawn();
  196.     }
  197.  
  198.     if ( reply == 3 )
  199.     {
  200.       myself::Say( "nope");
  201.       myself::Despawn();
  202.     }
  203.  
  204.     if ( reply == 4 )
  205.     {
  206.       myself::Say( "nope");
  207.       myself::Despawn();
  208.     }
  209.  
  210.     if ( reply == 5 )
  211.     {
  212.       myself::Say( "nope");
  213.       myself::Despawn();
  214.     }
  215.      
  216.   }
  217.  
  218.   if (ask == -5)
  219.   {
  220.     if ( reply == 1 )
  221.     {
  222.       myself::Say( "Correct answer");
  223.       if( gg::Rand( 10 ) < 2 )
  224.       {                
  225.         myself::GiveItem1( target, 7863, 1 );              
  226.       }
  227.       myself::Despawn();
  228.     }
  229.  
  230.     if ( reply == 2 )
  231.     {
  232.       myself::Say( "nope");
  233.       myself::Despawn();
  234.     }
  235.  
  236.     if ( reply == 3 )
  237.     {
  238.       myself::Say( "nope");
  239.       myself::Despawn();
  240.     }
  241.  
  242.     if ( reply == 4 )
  243.     {
  244.       myself::Say( "nope");
  245.       myself::Despawn();
  246.     }
  247.  
  248.     if ( reply == 5 )
  249.     {
  250.       myself::Say( "nope");
  251.       myself::Despawn();
  252.     }    
  253.   }
  254. }
  255.  
  256.   EventHandler SEE_CREATURE( creature )
  257.   {
  258.     myself::Say( "Who are there ?");
  259.     if( myself.p_state != 3 && myself::GetLifeTime() > 7 )
  260.     {
  261.       if( myself::DistFromMe( creature ) > 200 )
  262.       {
  263.         myself::InstantTeleport( myself.sm, myself::FloatToInt( creature.x ),
  264.                                  myself::FloatToInt( creature.y ),
  265.                                  myself::FloatToInt( creature.z ) );
  266.  
  267.         if( myself::Skill_GetConsumeMP( TeleportEffect ) < myself.sm.mp &&
  268.             myself::Skill_GetConsumeHP( TeleportEffect ) < myself.sm.hp &&
  269.             myself::Skill_InReuseDelay( TeleportEffect ) == 0 )
  270.         {
  271.           myself::AddUseSkillDesire( myself.sm, TeleportEffect, 1, 1, 1000000 );
  272.         }
  273.       }
  274.     }
  275.   }
  276.  
  277.   EventHandler NO_DESIRE()
  278.   {
  279.     myself::AddMoveAroundDesire( 5, 5 );
  280.   }
  281.  
  282.   EventHandler TIMER_FIRED_EX( timer_id )
  283.   {
  284.     if( timer_id == 1 )
  285.     {
  286.       myself::Say( "bye");
  287.       myself::Despawn();
  288.     }
  289.   }
  290.  
  291.   EventHandler MY_DYING( target , last_attacker )
  292.   {
  293.     //
  294.   }
  295. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement