def cook_init_helper(s, id): s.add_action(actions.Delay(sec=5), id=id) s.add_action(actions.CallFunc(f=a.openDoor('scummbar_kitchen_door', 'open'))) s.add_action(actions.CallFunc(f=a.Callbacks.add_item('cook', {'pos': '@pos/scummbar_kitchen_door', 'parent': 'walkarea_0'}))) s.add_action(scumm.actions.Walk(tag='cook', pos=(115, 18))) 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'))
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')
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)
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)
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)
def cook_init_helper(s, id): s.add_action(actions.Delay(sec=5), id=id) s.add_action(al.open_door('door_scummbar_kitchen', 'kitchen')) s.add_action( al.create_item( 'cook', { 'pos': mopy.monkey.engine.data.game.pos.scummbar_kitchen_door, 'dir': 'w' }, 'walkarea_0')) s.add_action(actions.Walk(tag='cook', pos=(115, 18))) s.add_action(actions.Turn(tag='cook', dir='n')) 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'))
def citizen_map(s, *args): bb = shc('$dialogues/citizen/') s.add_action(a.custom_actions.set_variable("@talked_to_citizen", 2)) s.add_action( scumm.actions.Say(tag='player', font='monkey', lines=bb([args[0]]))) s.add_action( scumm.actions.Say(tag='citizen', font='monkey', lines=bb(args[1]))) # # business s.add_action( scumm.actions.Say(tag='citizen', font='monkey', lines=bb([18]))) s.add_action(actions.Animate(tag='citizen', anim='open_jacket', sync=True)) s.add_action(actions.Animate(tag='citizen', anim='idle_e_1', sync=True)) s.add_action(actions.Delay(sec=1)) s.add_action(actions.Animate(tag='citizen', anim='talk_e_1', sync=True)) s.add_action( scumm.actions.Say(tag='citizen', font='monkey', animate=False, lines=bb([19]))) s.add_action(actions.Animate(tag='citizen', anim='idle_e_1', sync=True)) s.add_action(actions.Delay(sec=1)) s.add_action( actions.Animate(tag='citizen', anim='open_jacket', sync=True, fwd=False)) s.add_action( scumm.actions.Say(tag='citizen', font='monkey', lines=bb([20]))) s.add_action(actions.Animate(tag='citizen', anim='rollmap', sync=True)) s.add_action(actions.Animate(tag='citizen', anim='idle_e_2', sync=True)) s.add_action(actions.Delay(sec=1)) s.add_action(actions.Animate(tag='citizen', anim='talk_e_2', sync=True)) s.add_action( scumm.actions.Say(tag='citizen', font='monkey', animate=False, lines=bb([21, 22]))) s.add_action(actions.Animate(tag='citizen', anim='idle_e_2', sync=True)) s.add_action( actions.Animate(tag='citizen', anim='rollmap', sync=True, fwd=False)) s.add_action( scumm.actions.Say(tag='citizen', font='monkey', lines=bb([23]))) example.play(s)
def __init__(self, msg_id): super().__init__() self.activities.append(WonderBoyMsg(msg_id)) aa = mopy.monkey.engine.read(msg_id) for n in range(1, len(aa) + 1): self.activities.append(act.SetText(tag='ciaone', text=aa[0:n])) self.activities.append(act.Delay(0.05)) self.activities.append(act.WaitForKey()) self.activities.append(act.RemoveEntity(tag='ciaone')) self.activities.append(act.RemoveEntity(tag='msg_wrap'))
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
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)
def pickup_fish(item_id, entity): if item_id in vars.inventory: return s = a.Scripts.walk(item_id) s.add_action(actions.Animate(tag='player', anim='kneel_s')) s.add_action(actions.Delay(sec=0.5)) if vars.seagull_on_plank: s.add_action(scumm.actions.Say(lines=[monkey.engine.read(x) for x in ['$lines/38']], font='monkey', tag='player')) else: s.add_action(actions.Animate(tag='player', anim='idle_s')) s.add_action(actions.CallFunc(f=a.Callbacks.pickup(item_id, entity.id))) example.play(s)
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)
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)
def enter_door(x): if mopy.monkey.engine.data.globals.active_warp is not None: warp_id =mopy.monkey.engine.data.globals.active_warp mopy.monkey.engine.data.globals.active_warp = None door_info = mopy.monkey.engine.data.globals.doors[warp_id] s = Script() args = door_info.get('args',None) print('args=' +str(args)) s.seq([ act.SetState(tag='player', state='knock'), act.Delay(sec=0.1), act.Animate(tag='door_' + str(warp_id), anim='open'), act.ChangeRoom(room=door_info['room'], args=args) ]) example.play(s)
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.seq([ act.SetState(state='dead', entity_id=foe.id), act.Delay(2), act.RemoveEntity(entity_id=foe.id) ]) #s.add_action(act.SetState(state='dead', entity_id=foe.id)) #s.add_action(act.Delay(2)) #s.add_action(act.RemoveEntity(entity_id=foe.id)) example.play(s) else: player_hit_by_enemy(player)
def on_click_plank(x, y, pippo): s = a.Scripts.walk('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')) s2.add_action(actions.CallFunc(f=a.Callbacks.set_var("@seagull_on_plank", False)), after=[1]) s2.add_action(actions.Animate(tag='seagull', anim='jump' + str(vars.seagull_jump), sync=True)) s2.add_action(actions.CallFunc(f=a.Callbacks.set_var("@seagull_on_plank", True))) s2.add_action(actions.Animate(tag='seagull', anim='eat')) vars.seagull_jump = 2 if vars.seagull_jump == 1 else 1 s.add_action(actions.RunScript(s2)) example.play(s)
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)
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)
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)
def on_load_forest7(): if example.get('storekeeper').valid: s = Script() s.add_action(a.custom_actions.disable_controls) s.add_action(scumm.actions.Walk(tag='storekeeper', pos=(160, 20))) s.add_action(actions.Delay(sec=0.5)) s.add_action(actions.Animate(tag='swordmaster_sign', anim='activated')) s.add_action(actions.Animate(tag='trunk_bridge', anim='activated')) s.add_action( a.custom_actions.set_variable('@forest_bridge', 'activated')) s.add_action(scumm.actions.SetWall('walkarea_0', 0, False)) s.add_action(scumm.actions.Walk(tag='storekeeper', pos=(320, 47))) s.add_action(actions.SetActive(tag='storekeeper', value=False)) s.add_action( a.custom_actions.update_item(item_id='storekeeper', room='swordmaster', pos=(144, 20), dir='e', parent='walkarea_0', size=None)) s.add_action( a.custom_actions.set_timestamp('@storekeeper_last_update')) s.add_action(a.custom_actions.enable_controls) example.play(s)
def pane(): aa = mopy.monkey.engine.read('$msg/1') print(aa) id = example.get('main').add(Text(font='sprites.mario_font', size=8, text=aa, color=[0,0,0,0], maxwidth=160,align=TextAlignment.center, pos=[96, 132,1.01 ])) text_size = example.getById(id).getTextSize() # 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 #s = Script() # # # print ('fottimilcazzzzo!!!!') #s.seq([ # act.AddEntity(entity_id='entities.textbg', pos=[0.5, 7, 1]) #]) import math tw = (text_size[2] - text_size[0]) th = (text_size[3] - text_size[1]) width = math.ceil(tw / 8.0) height = math.ceil(th / 8.0) data = [22, 8] data.extend([23, 8] * width) data.extend([24, 8]) md = [22, 7] md.extend([23, 7] * width) md.extend([24, 7]) data.extend(md * height) data.extend([22, 6]) data.extend([23, 6] * width) data.extend([24, 6]) e = Entity() e.model = { 'type': 'model.tiled', 'tex': 'gfx/wbml.png', 'img_tile_size': [8, 8], 'tile_size': [8, 8], 'size': [width + 2, height + 2], 'data': data} e.pos=[96 - 0.5 * tw - 8, 132 - 0.5*th - 8, 1] example.get('main').add(e) s = Script() acts=[] print('positioned ' + str(text_size)) id1 = example.get('main').add(Text(tag='ciaone', font='sprites.mario_font', size=8, text=aa, color=[255,255,255,255], maxwidth=160,align=TextAlignment.top_left, pos=[96-0.5*tw, 132+0.5*th, 1.02])) for n in range(1, len(aa)+1): acts.append(act.SetText(tag='ciaone', text=aa[0:n])) acts.append(act.Delay(0.05)) s.seq(acts) example.play(s)