Beispiel #1
0
def init_scummbar():
    if mopy.monkey.engine.previous_room == 'kitchen':
        s = Script(loop=100, uid='cook')
        s.add_action(
            al.create_item('cook', {
                'pos': (115, 18),
                'dir': 'n'
            }, 'walkarea_0'))
        s.add_action(actions.Delay(sec=2))
        s.add_action(
            actions.Walk(
                tag='cook',
                pos=mopy.monkey.engine.data.game.pos.scummbar_kitchen_door))
        s.add_action(al.remove_item('cook'))
        s.add_action(al.close_door('door_scummbar_kitchen', 'kitchen'))
        cook_init_helper(s, 100)
        #
        # s.add_action(actions.CallFunc(f=a.Callbacks.add_item('cook', {'pos': (115, 18), 'parent': 'walkarea_0'})))
        # s.add_action(scumm.actions.Turn(tag='cook', dir='n'))
        # s.add_action(actions.Delay(sec=2))
        # s.add_action(scumm.actions.Walk(tag='cook', pos=vars.pos.scummbar_kitchen_door))
        # s.add_action(actions.RemoveEntity(tag='cook'))
        # s.add_action(actions.Animate(tag='scummbar_kitchen_door', anim='closed'))
        example.play(s)
    else:
        s = Script(loop=0, uid='cook')
        cook_init_helper(s, 0)
        example.play(s)

    anim_helper('scummbar_mancomb')
    anim_helper('scummbar_estevan')
Beispiel #2
0
def rise():
    player = example.get('player')
    player.setState('warp', {})
    s = Script()
    s.add_action(act.Move(speed=50, by=(0, 64), tag='player'))
    s.add_action(act.SetState(tag='player', state='walk'))
    example.play(s)
Beispiel #3
0
def on_exit_storekeeper():
    s = Script()
    s.add_action(scumm.actions.ExitDialogue())
    # resume script unless storekeeper is away
    if vars.items['storekeeper']['room'] == 'store':
        s.add_action(actions.ResumeScript(s='_storekeeper'))
    example.play(s)
Beispiel #4
0
 def f(nid, x, y, z):
     s = Script()
     s.add_action(
         act.MoveAccelerated(entity_id=nid,
                             v0=[vx, vy],
                             a=[0, -0.5 * data.globals.gravity],
                             yStop=0))
     s.add_action(act.RemoveEntity(entity_id=nid))
     example.play(s)
Beispiel #5
0
def lookout_start_dialogue(args):
    s = Script()
    s.add(Say(_a(args[0]), 'player'))
    s.add_action(Turn('s', 'main.lookout'))
    l = [_b(5), (_b(43) + _b(53 + random.randint(0, 1)))
         ] if scumm.gl.talked_to_lookout == 1 else [
             _b(5), _b(6), _b(7), _b(8), _b(9)
         ]
    s.add(Sayd(l, 'main.lookout'))
    return s
Beispiel #6
0
def change_room(room, pos=None, dir=None, parent='walkarea_0'):
    s = Script()
    if pos:
        s.add_action(
            update_item(mopy.monkey.engine.data.globals.current_player, {
                'room': room,
                'pos': pos,
                'dir': dir,
                'parent': parent
            }))
    s.add_action(ChangeRoom(room))
    return s
Beispiel #7
0
 def walk(id, script_id='_main'):
     s = Script(uid=script_id)
     has_item = vars.inventory.get(id, 0) > 0
     if not has_item:
         item = data.items[id]
         wt = monkey.engine.read(item.get('walkto', None))
         if wt is not None:
             wdir = item.get('wdir', None)
             s.add_action(scumm.actions.Walk(pos=wt, tag='player'))
             if wdir is not None:
                 s.add_action(scumm.actions.Turn(dir=wdir, tag='player'))
     return s
Beispiel #8
0
def walk_to(item_id):
    # now get the walk_to for this item
    s = Script(uid='_main')
    # if you own the item, no need to walk
    if item_id in mopy.monkey.engine.data.globals.inventory:
        return s
    item = sc.get_item(item_id)
    pos = item.get('walk_to')
    wdir = item.get('wdir', None)
    s.add_action(Walk(pos, 'player'))
    if wdir:
        s.add_action(Turn(wdir, 'player'))
    return s
Beispiel #9
0
def on_kitchen_trap(player, entity, x, y):
    example.remove(entity.id)
    s = Script()
    s.add_action(al.create_item('seagull'))
    s.add_action(actions.Animate(tag='seagull', anim='fly', sync=True))
    s.add_action(actions.Animate(tag='seagull', anim='eat'))
    s.add_action(actions.SetVariable("game.seagull_on_plank", True))
    example.play(s)
Beispiel #10
0
 def _start_dialogue():
     _enable_controls(False)()
     dialogue = mopy.monkey.engine.data.dialogues.get(dialogue_id)
     if not dialogue:
         print('## warning! dialogue ' + dialogue_id + ' does not exist')
         return
     s = Script()
     if (not continue_dialogue) and 'on_entry' in dialogue:
         s = getattr(mopy.monkey.engine.data.scripts,
                     dialogue['on_entry'])()
     s.add_action({
         'type':
         'action.callfunc',
         'func':
         _display_dialogue(dialogue_id, dialogue, start_node)
     })
     example.play(s)
Beispiel #11
0
 def f(x, y, z):
     scr = s.script
     if 'activate' in s.line:
         for node in s.line['activate']:
             s.dialogue['lines'][node]['active'] = True
     if 'deactivate' in s.line:
         for node in s.line['deactivate']:
             s.dialogue['lines'][node]['active'] = False
     persist = s.line.get('persist', False)
     if not persist:
         s.line['active'] = False
     s1 = Script()
     iid = s1.add(enable_controls(False))
     print('Ok 222 ' + str(iid))
     example.get('dialogue').clearText()
     s.line["clicked"] = s.line.get("clicked", 0) + 1
     if isinstance(scr, str):
         fc: ScriptDesc = mopy.monkey.engine.get_script(scr)
         if not fc:
             print('mmh cannot find script: ' + scr)
             exit(1)
         #fc = getattr(mopy.monkey.engine.data.scripts, scr, None)
         args = s.line.get('args', [])
         print('Ok 223 ' + str(iid))
         dc = RunScript(fc.make(args))
         print('ok 234 = ' + str(iid))
         iid = s1.add_action(dc, after=iid)
     next = s.line.get('next')
     if next:
         s1.add_action(start_dialogue(s.dialogue_id, True, next), after=iid)
     else:
         # check if dialogue has a on_exit script
         on_exit = s.dialogue.get('on_exit')
         if on_exit:
             on_exit_script = getattr(mopy.monkey.engine.data.scripts,
                                      on_exit)()
             if on_exit_script:
                 s1.add(RunScript(on_exit_script), after=iid)
         else:
             pass
             #s.add_action(scumm.actions.ExitDialogue())
     example.play(s1)
Beispiel #12
0
def pippolandia():
    s = Script()
    s.add_action(
        scumm.actions.Say(tag='player',
                          font='monkey',
                          lines=a.make_lines(['$dialogues/storekeeper/11'])))
    s.add_action(
        scumm.actions.Say(tag='storekeeper',
                          font='monkey',
                          lines=a.make_lines(['$dialogues/storekeeper/12'])))
    s.add_action(scumm.actions.ExitDialogue())
    s.add_action(actions.ResumeScript(s='_storekeeper'))
    example.play(s)
Beispiel #13
0
def sierra_walk_to(x, y):
    gl = mopy.monkey.engine.data.globals
    if gl.current_action == 0:
        s = Script(uid='_main')
        s.add_action(Walk((x, y), 'player'))
        example.play(s)
    else:
        # check if we have a default script for given action
        sa = '_default_' + str(gl.current_action) + '_' + str(
            mopy.monkey.engine.room)
        script = mopy.monkey.engine.get_script(sa)
        if script:
            s = script.make()
            example.play(s)
        else:
            sa = '_default_' + str(gl.current_action)
            script = mopy.monkey.engine.get_script(sa)
            if script:
                s = script.make()
                example.play(s)
Beispiel #14
0
def init_circus():
    example.get('player').follow(False)
    s = Script(uid='_fettuccini')
    s.on_kill =cane
    rv = monkey.engine.read
    s.add_action(actions.Scroll(pos=(0, 72), cam='maincam', speed=0, relative=False))
    s.add_action(id=1, action=actions.CallFunc(f=a.Callbacks.enable_controls(False)))
    s.add_action(scumm.actions.Walk(tag='player', pos=(178, 9)), after=[1])
    # TODO add after debug
    # if data.circus_data == 0:
    #     s.add_action(asay(1), after=[1])
    #     s.add_action(bsay(2))
    #     s.add_action(asay(3))
    #     s.add_action(bsay(4))
    #     s.add_action(asay(5))
    #     s.add_action(bsay(5))
    #     s.add_action(asay(6))
    #     s.add_action(bsay(7))
    #     s.add_action(asay(8))
    #     s.add_action(bsay(9))
    s.add_action(action=actions.CallFunc(f=a.Callbacks.enable_controls(True)))
    s.add_action(scumm.actions.StartDialogue(dialogue_id='fettuccini'))
    append_script(s)
    s.set_loop(100)
    # --            action.disable_controls
    # {id = 1},
    # --            action.walkto
    # {id = 2, actor = "guybrush", pos = {178, 9}},
    # --            action.say
    # {id = 3, after = {1}, actor = "circus.purpleclown", lines = {d[1]}},
    # --            action.say
    # {id = 4, actor = "circus.greenclown", lines = {d[2]}},
    # --            action.say
    # {id = 5, actor = "circus.purpleclown", lines = {d[3]}},
    # --            action.say
    # {id = 6, actor = "circus.greenclown", lines = {d[4]}},
    # --            action.say
    # {id = 7, actor = "circus.purpleclown", lines = {d[5]}},
    # --            action.say
    # {id = 8, actor = "circus.greenclown", lines = {d[5]}},
    # --            action.say
    # {id = 9, actor = "circus.purpleclown", lines = {d[6]}},
    # --            action.say
    # {id = 10, actor = "circus.greenclown", lines = {d[7]}},
    # --            action.say
    # {id = 11, actor = "circus.purpleclown", lines = {d[8]}},
    # --            action.say
    # {id = 12, actor = "circus.greenclown", lines = {d[9]}},
    # --            action.start_dialogue
    # {id = 13, dialogue = "fettuccini"},
    example.play(s)
Beispiel #15
0
def play_flag_scene(player, obj, x, y):
    player.vy = 0
    s = Script()
    s.add_action(act.SetState(tag='player', state='slide'))
    s.add_action(act.Move(tag='player', by=(0, obj.y - player.y), speed=50))
    s.add_action(act.SetState(tag='player', state='npcwalk', args={'direction': 1}))
    example.play(s)
Beispiel #16
0
def seagull_lands():
    s = Script()
    if 'fish' in mopy.monkey.engine.data.globals.inventory:
        s.add_action(actions.Animate(tag='seagull', anim='leave', sync=True))
        s.add_action(al.remove_item('seagull'))
    else:
        s.add_action(actions.Animate(tag='seagull', anim='eat'))
    example.play(s)
Beispiel #17
0
def end_level(player, warp, x, y):
    player.setActive(False)
    info = warp.getInfo()
    s = Script()
    s.add_action(act.Delay(sec=1))
    s.add_action(act.SetVariable('globals.start_position', info['start_position']))
    s.add_action(act.ChangeRoom(room=info['warp_to']))
    example.play(s)
Beispiel #18
0
def on_enter_loom():
    s = Script()
    s.add_action(scumm.actions.EnableUI(False))
    l = ['$dialogues/loom/1']
    lines = [monkey.engine.read(x) for x in l]
    s.add_action(scumm.actions.Say(tag='loom', lines=lines, animate=False, font='monkey'))
    s.add_action(scumm.actions.StartDialogue('loom'))
    example.play(s)
Beispiel #19
0
def pappo():
    s = Script()
    s.add_action(scumm.actions.EnableUI(False))
    l = ['$dialogues/mancomb/1', '$dialogues/mancomb/2']
    lines = [monkey.engine.read(x) for x in l]
    s.add_action(scumm.actions.Say(tag='mancomb', lines=lines, animate=False, font='monkey'))
    s.add_action(scumm.actions.StartDialogue('mancomb'))
    example.play(s)
Beispiel #20
0
def on_kitchen_trap(trap):
    example.remove(trap.id)
    s = entity.Sprite(model='01/seagull', tag='seagull',pos=[0, 0, 1])
    id = example.get('main').add(s)
    script = Script()
    script.add_action(actions.Animate(entity_id=id, anim='fly', sync=True))
    script.add_action(actions.Animate(entity_id=id, anim='eat'))
    script.add_action(actions.CallFunc(f=a.Callbacks.set_var("@seagull_on_plank", True)))
    example.play(script)
Beispiel #21
0
def foe_hits_mario(player, foe, x, y):
    if player.getState() == 'jump' and player.vy < 0:
        s = Script()
        player.vy = data.globals.jump_velocity * 0.5
        s.add_action(act.SetState(state='dead', entity_id=foe.id))
        s.add_action(act.Delay(211))
        s.add_action(act.RemoveEntity(foe.id))
        example.play(s)
    else:
        pass
Beispiel #22
0
def storekeeper_script(walk_to_pos,
                       next_room,
                       next_room_pos,
                       next_room_dir,
                       parent='walkarea_0'):
    if example.get('storekeeper').valid:
        s = Script()
        s.add_action(scumm.actions.Walk(tag='storekeeper', pos=walk_to_pos))
        s.add_action(actions.SetActive(tag='storekeeper', value=False))
        s.add_action(
            custom_actions.update_item(item_id='storekeeper',
                                       room=next_room,
                                       pos=next_room_pos,
                                       dir=next_room_dir,
                                       parent=parent,
                                       size=None))
        s.add_action(custom_actions.set_timestamp('@storekeeper_last_update'))
        example.play(s)
Beispiel #23
0
def on_create_flying_coin(nid, x, y, z):
    s = Script()
    yt = y + data.globals.tile_size[1]
    s.add_action(
        act.MoveAccelerated(v0=[0, 100], a=[0, -100], yStop=yt, entity_id=nid))
    s.add_action(act.RemoveEntity(nid))
    s.add_action(
        act.CreateEntity('scripts.factories.score_100',
                         pos=(x, yt, z),
                         use_tile=False))
    example.play(s)
Beispiel #24
0
def say_random():
    s = Script(uid='_storekeeper')
    s.add_action(
        scumm.actions.Say(
            tag='storekeeper',
            font='monkey',
            lines=a.make_lines(
                ['$dialogues/storekeeper/' + str(random.randint(2, 9))])))
    s.add_action(actions.Delay(sec=5))
    s.add_action(actions.CallFunc(f=say_random))
    example.play(s)
Beispiel #25
0
def init_store():
    # only if storekeeper in store
    if example.get('storekeeper').valid:
        s = Script(uid='_storekeeper')
        s.add_action(
            scumm.actions.Say(tag='storekeeper',
                              font='monkey',
                              lines=a.make_lines(['$dialogues/storekeeper/1'
                                                  ])))
        s.add_action(actions.Delay(sec=5))
        s.add_action(actions.CallFunc(f=say_random))
        s.add_action(actions.CallFunc(f=say_random))
        example.play(s)
Beispiel #26
0
def sierra_msg(text):
    gl = mopy.scumm.gl  #mopy.monkey.engine.data.globals
    s = Script()
    s.add_action(sierra_enable_controls(False))
    s.add_action(
        Msg(font=gl.msg_font,
            color=(127, 83, 30, 255),
            align=TextAlignment.center,
            text=mopy.monkey.engine.read(text),
            pos=(gl.sci_viewport[2] * 0.5, gl.sci_viewport[3] * 0.5, 1),
            inner_texture=gl.msg_inner_texture,
            border_texture=gl.msg_border_texture,
            eoc=True,
            timeout=1000,
            box=True,
            padding=(4, 5)))
    s.add_action(sierra_enable_controls(True))
    return s
Beispiel #27
0
def on_exit_lookout():
    s = Script()
    s.add_action(scumm.actions.Turn(tag='lookout', dir='w'))
    s.add_action(scumm.actions.ExitDialogue())
    data.dialogues['lookout']['lines'][6]['active'] = True
    example.play(s)
Beispiel #28
0
def walk_to(x, y):
    s = Script(uid='_main')
    s.add_action(Walk((x, y), 'player'))
    example.play(s)
Beispiel #29
0
def pane(a, b, c):
    s = sl.walk_to('plank')
    s2 = Script()
    s2.add_action(actions.Animate(tag='player', anim='push_plank'))
    s2.add_action(actions.Delay(sec=0.3), id=1)
    s2.add_action(actions.Animate(tag='player', anim='idle_s'), after=[1])
    s2.add_action(actions.Animate(tag='plank', anim='pushed', sync=True),
                  after=[1])
    s2.add_action(actions.Animate(tag='plank', anim='idle'))
    ss = example.get('seagull')
    if ss.valid:
        s2.add_action(actions.SetVariable("game.seagull_on_plank", False))
        s2.add_action(
            actions.Animate(tag='seagull',
                            anim='jump' +
                            str(mopy.monkey.engine.data.game.seagull_jump),
                            sync=True))
        s2.add_action(actions.SetVariable("game.seagull_on_plank", True))
        s2.add_action(actions.CallFunc(f=seagull_lands))
        mopy.monkey.engine.data.game.seagull_jump = 2 if mopy.monkey.engine.data.game.seagull_jump == 1 else 1
    s.add_action(actions.RunScript(s2))
    example.play(s)
Beispiel #30
0
def anim_helper(tag):
    s1 = Script(loop=0, uid='_' + tag)
    s1.add_action(actions.DelayRandom(1.0, 5.0))
    s1.add_action(actions.Animate(tag=tag, anim='idle_2', sync=True))
    s1.add_action(actions.Animate(tag=tag, anim='idle_1'))
    example.play(s1)