Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
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)
Ejemplo n.º 6
0
def pickup_fish(item_id, e):
    data = mopy.monkey.engine.data
    if item_id in data.globals.inventory:
        return
    s = sl.walk_to(item_id)
    s.add_action(actions.Animate(tag='player', anim='kneel_s'))
    s.add_action(actions.Delay(sec=0.5))
    if data.game.seagull_on_plank:
        s.add_action(actions.Say(lines=['$lines/38'], tag='player'))
    else:
        s.add_action(actions.Animate(tag='player', anim='idle_s'))
        s.add_action(al.pickup_item(item_id, e.id))
        s.add_action(actions.SetVariable('game.fish_not_taken', False))
    example.play(s)
Ejemplo n.º 7
0
def give_pot_alfredo(item, id):
    s = a.Scripts.walk('alfredo')
    s.add_action(a.custom_actions.disable_controls)
    s.add_action(actions.SetVariable('@circus_feat_done', 1))
    s.add_action(actions.Animate(tag='player', anim='circus_cutscene_1', sync=True))
    s.add_action(scumm.actions.Say(tag='bill', font='monkey', lines=[gl(82)]))
    s.add_action(actions.Animate(tag='player', anim='circus_cutscene_1', fwd=False, sync=True))
    s.add_action(actions.Animate(tag='player', anim='idle_s'))
    s.add_action(scumm.actions.Say(tag='alfredo', font='monkey', lines=[gl(83)]))
    s.add_action(scumm.actions.Say(tag='bill', font='monkey', lines=[gl(84)]), id=1)
    s.add_action(scumm.actions.Walk(tag='alfredo', pos=(333, 1)), after=[1], id=2)
    s.add_action(scumm.actions.Walk(tag='bill', pos=(296, 24)), after=[1], id=3)
    s.add_action(scumm.actions.Walk(tag='player', pos=(250, 24)), after=[1], id=4)
    s.add_action(actions.Scroll(pos=(48, 0), relative=True, speed=50, cam ='maincam'), after=[1])
    s.add_action(scumm.actions.Turn(tag='alfredo', dir='n'), after=[2], id=5)
    s.add_action(scumm.actions.Turn(tag='bill', dir='w'), after=[3], id=6)
    s.add_action(scumm.actions.Turn(tag='player', dir='s'), after=[4], id=7)
    s.add_action(scumm.actions.Say(tag='alfredo', font='monkey', lines=[gl(85)]), after=[5,6,7])
    s.add_action(scumm.actions.Say(tag='bill', font='monkey', lines=[gl(86)]))
    s.add_action(scumm.actions.Say(tag='alfredo', font='monkey', lines=[gl(87)]))
    s.add_action(scumm.actions.Walk(tag='player', pos=(264, 23)))
    s.add_action(scumm.actions.Turn(tag='player', dir='e'))
    s.add_action(scumm.actions.Say(tag='player', font='monkey', lines=[gl(88)]))
    s.add_action(scumm.actions.Walk(tag='player', pos=(250, 24)))
    s.add_action(scumm.actions.Turn(tag='player', dir='s'))
    s.add_action(actions.Animate(tag='player', anim='circus_cutscene_2', sync=True))
    s.add_action(actions.SetActive(tag='player',value=False))
    s.add_action(actions.Delay(sec=1), id=10)
    s.add_action(a.custom_actions.add_item('circus_explosion'), after=[10])
    s.add_action(a.custom_actions.add_item('flying_guybrush'), after=[10])
    s.add_action(actions.Animate(tag='circus_explosion', anim='default', sync=True), id=11)
    s.add_action(actions.Animate(tag='flying_guybrush', anim='default', sync=True), id=12)
    s.add_action(a.custom_actions.remove_item('circus_explosion'), after=[11])
    s.add_action(scumm.actions.Say(tag='alfredo', font='monkey', lines=[gl(89)]), after=[12])
    s.add_action(scumm.actions.Say(tag='bill', font='monkey', lines=[gl(90)]), id=13)
    s.add_action(scumm.actions.Walk(tag='alfredo', pos=(87, 29)), after=[13])
    s.add_action(scumm.actions.Turn(tag='alfredo', dir='e'), id=14)
    s.add_action(scumm.actions.Walk(tag='bill', pos=(126, 29)), after=[13])
    s.add_action(scumm.actions.Turn(tag='bill', dir='w'))
    s.add_action(scumm.actions.Say(tag='alfredo', font='monkey', lines=[gl(91)]), after=[14])
    s.add_action(scumm.actions.Say(tag='bill', font='monkey', lines=[gl(92)]))
    s.add_action(a.custom_actions.add_to_inventory('pieces_of_eight', 478))
    #{type = scumm.action.remove_from_inventory, args = {id = "kitchen.pot"}},
    s.add_action(a.custom_actions.enable_controls)
    s.add_action(scumm.actions.StartDialogue('fettuccini', 'm3'))
    example.play(s)
Ejemplo n.º 8
0
def player_hit_by_enemy(player):

    gl = mopy.monkey.engine.data.globals
    if gl.invincible:
        return
    gl.invincible = True
    if gl.player_mode > 0:
        gl.player_mode -= 1
        player.setModel(gl.player_modes[gl.player_mode]['model'])
        s = Script()
        s.seq([
            act.Blink(duration=gl.invincible_time, blink_duration=0.2, entity_id=player.id),
            act.SetVariable(name='globals.invincible', value=False)])
        example.play(s)
    else:
        player.setState('dead', {})
        s = Script()
        s.seq([
            act.Delay(0.5),
            act.MoveAccelerated(v0=(0, 250), a=(0, -gl.gravity), yStop=0, entity_id=player.id),
            act.CallFunc(restartMario)
        ])
        example.play(s)
Ejemplo n.º 9
0
def _make_set(a, context):
    print(a)
    return actions.SetVariable(a[1], a[2])