Exemplo n.º 1
0
def setup_bar():
    ra = mopy.monkey.engine.room_args
    gl = mopy.monkey.engine.data.globals
    bonus_left = Entity()
    bonus_left.model = gl.bonus_list[ra[0]]['gfx']
    bonus_left.pos = (2.5*16, 10.2*16, 0.11)
    example.get('main').add(bonus_left)
    bonus_right = Entity()
    bonus_right.model = gl.bonus_list[ra[2]]['gfx']
    bonus_right.pos = (9.5*16, 10.2*16, 0.11)
    example.get('main').add(bonus_right)




    from wbml.data.actions import WBM

    # check if player has enough gold to buy items
    min_cost = min(int(ra[1]), int(ra[3]))
    if gl.gold < min_cost:
        s = Script()
        s.seq([WBM('$msg/8'), act.ChangeRoom('citywl')])
        example.play(s)
    else:
        mopy.monkey.engine.data.globals.pos = [(2, 7.625, 0.1), (5.25, 7.625, 0.1), (9.5, 7.625, 0.1)]
        mopy.monkey.engine.data.globals.cpos = 1
        s = Script()
        s.seq([WBM('$msg/5')])
        example.play(s)
Exemplo n.º 2
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')
Exemplo n.º 3
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)
Exemplo n.º 4
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)
Exemplo n.º 5
0
def init_flying_coin(id, x, y):
    s = Script()
    s.seq([
        act.MoveAccelerated(v0=(0, 300), a=(0, -mopy.monkey.engine.data.globals.gravity), yStop=y+16, entity_id=id),
        act.RemoveEntity(entity_id=id),
        act.AddEntity(entity_id='entities.score_100', pos=[x/16, y/16+1, 1])])
    example.play(s)
Exemplo n.º 6
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)
Exemplo n.º 7
0
def hand_select():
    from wbml.data.actions import WBM
    gl = mopy.monkey.engine.data.globals
    selected = mopy.monkey.engine.data.globals.cpos
    s = Script()
    if selected == 1:
        s.seq([act.SetActive(tag='hand', value=False),
            WBM('$msg/6'), act.SetVariable('globals.start_position', 2), act.ChangeRoom('citywl')])
    else:
        bonus_picked = None
        cost = 0
        msg = None
        if selected == 0:
            bonus_picked = mopy.monkey.engine.room_args[0]
            cost = int(mopy.monkey.engine.room_args[1])
            msg = mopy.monkey.engine.room_args[4]
        else:
            bonus_picked = mopy.monkey.engine.room_args[2]
            cost = int(mopy.monkey.engine.room_args[3])
            msg = mopy.monkey.engine.room_args[5]
        if mopy.monkey.engine.data.globals.gold >= cost:
            mopy.monkey.engine.data.globals.gold -= cost
            bonus =gl.bonus_list[bonus_picked]
            bonus['callback']()
            s.seq([
                act.SetActive(tag='hand', value=False),
                WBM(msg),
                act.SetVariable('globals.start_position', 2),
                act.ChangeRoom('citywl')])
    example.play(s)
Exemplo n.º 8
0
def on_load_swordmaster():
    if example.get('storekeeper').valid:
        s = Script()
        s.add_action(a.custom_actions.disable_controls)
        s.add_action(a.custom_actions.set_follow(False), id=1)
        s.add_action(scumm.actions.Walk(tag='storekeeper', pos=(375, 68)),
                     id=2)
        s.add_action(actions.Scroll(pos=(304, 72),
                                    cam='maincam',
                                    speed=50,
                                    relative=False),
                     after=[1])
        s.add_action(scumm.actions.Walk(tag='player', pos=(210, 14)),
                     id=3,
                     after=[1])
        s.add_action(scumm.actions.Turn(tag='storekeeper', dir='e'), after=[2])
        s.add_action(scumm.actions.Turn(tag='player', dir='s'), after=[3])
        s.add_action(
            scumm.actions.Say(tag='player',
                              font='monkey',
                              lines=a.make_lines(['$lines/50'])))
        s.add_action(scumm.actions.Turn(tag='player', dir='n'))
        s.add_action(actions.Delay(sec=1.0), after=[2])
        # TODO change room to sword master house here
        s.add_action(a.custom_actions.enable_controls)
        example.play(s)
Exemplo n.º 9
0
def warp_down(a):
    if data.globals.active_warp:
        s = Script()
        s.seq([
            act.SetState(tag='player', state='warp'),
            act.Move(speed=50, by=(0, -64), tag='player'),
            act.ChangeRoom(data.globals.active_warp)])
        example.play(s)
Exemplo n.º 10
0
 def f(item_id, entity):
     print('HEY item = ' + item_id)
     s = Scripts.walk(item_id) if item_id else Script()
     s.add_action(
         actions.CallFunc(
             f=Callbacks.set_pos(data.current_player, room, pos, dir)))
     s.add_action(actions.ChangeRoom(room=room))
     example.play(s)
Exemplo n.º 11
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)
Exemplo n.º 12
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)
Exemplo n.º 13
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)
Exemplo n.º 14
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)
Exemplo n.º 15
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)
Exemplo n.º 16
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)
Exemplo n.º 17
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)
Exemplo n.º 18
0
def lookout_5(args):
    s = Script()
    s.add(Say(_a('squinky'), 'player'))
    if mopy.monkey.engine.data.dialogues['lookout']['lines'][4].get(
            'clicked', 0) == 0:
        s.add(Say(_a(41), 'main.lookout'))
    else:
        s.add(Say(_a(27), 'main.lookout'))
    return s
Exemplo n.º 19
0
def ciaone2(player_attack, foe, x, y):
    foe.setState('dead', {})
    s = Script()
    s.seq([
        act.Delay(sec=1),
        act.RemoveEntity(entity_id=foe.id),
        act.AddEntity(entity_id='entities.flying_coin', pos=[foe.x / 16, foe.y / 16, 1])
    ])
    example.play(s)
Exemplo n.º 20
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
Exemplo n.º 21
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
Exemplo n.º 22
0
def ciappo(e):
    gl = mopy.monkey.engine.data.globals
    gl.invincible = True
    example.get('player').setState('walk', {})
    s = Script()
    s.seq([
        Blink(duration=gl.invincible_time, blink_duration=0.1, tag='player'),
        SetVariable(name='globals.invincible', value=False)
    ])
    example.play(s)
Exemplo n.º 23
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)
Exemplo n.º 24
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)
Exemplo n.º 25
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
Exemplo n.º 26
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
Exemplo n.º 27
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)
Exemplo n.º 28
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)
Exemplo n.º 29
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
Exemplo n.º 30
0
def setup2():
    #pass
    from wbml.data.actions import WBM

    s = Script()
    s.seq([WBM('$msg/1'),# WBM('$msg/2'), WBM('$msg/3'), WBM('$msg/4'),
           act.SetVariable('globals.player_mode', 1),
           act.SetVariable('globals.start_position', 1),
           act.SetVariable('globals.doors.0.open', 0),
           act.SetVariable('globals.room0', 1),
           act.ChangeRoom('citywl')])

    example.play(s)