Initial commit
This commit is contained in:
1685
devtools/create_ultima/files/ultima6/scripts/md/actor.lua
Normal file
1685
devtools/create_ultima/files/ultima6/scripts/md/actor.lua
Normal file
File diff suppressed because it is too large
Load Diff
529
devtools/create_ultima/files/ultima6/scripts/md/combat.lua
Normal file
529
devtools/create_ultima/files/ultima6/scripts/md/combat.lua
Normal file
@@ -0,0 +1,529 @@
|
||||
-- [objectnum] = range
|
||||
local range_weapon_tbl = {
|
||||
[41] = 4,
|
||||
[42] = 5,
|
||||
[43] = 4,
|
||||
[44] = 9,
|
||||
[45] = 9,
|
||||
[46] = 9,
|
||||
[47] = 4,
|
||||
[48] = 5,
|
||||
[240] = 6,
|
||||
[241] = 6,
|
||||
[129] = 2,
|
||||
[261] = 2,
|
||||
[313] = 9,
|
||||
[40] = 6,
|
||||
[366] = 3,
|
||||
[386] = 4,
|
||||
[364] = 3,
|
||||
[384] = 2,
|
||||
}
|
||||
|
||||
function get_weapon_range(weapon)
|
||||
local range = range_weapon_tbl[weapon.obj_n]
|
||||
if range == nil then
|
||||
range = 1
|
||||
end
|
||||
return range
|
||||
end
|
||||
|
||||
local weapon_dmg_tbl = {
|
||||
[16] = 30, --bloody saber
|
||||
[40] = 1, --Cupid's bow and arrows (charms)
|
||||
[41] = 15, --derringer
|
||||
[42] = 18, --revolver
|
||||
[43] = 20, --shotgun
|
||||
[44] = 30, --rifle
|
||||
[45] = 30, --Belgian combine
|
||||
[46] = 45, --elephant gun
|
||||
[47] = 8, --sling
|
||||
[48] = 12, --bow
|
||||
[49] = 15, --hatchet
|
||||
[50] = 20, --axe
|
||||
[51] = 10, --ball-peen hammer
|
||||
[52] = 25, --sledge hammer
|
||||
[54] = 10, --knife
|
||||
[55] = 20, --machete
|
||||
[56] = 25, --saber
|
||||
[65] = 15, --pick
|
||||
[66] = 8, --shovel
|
||||
[67] = 10, --hoe
|
||||
[68] = 10, --rake
|
||||
[69] = 15, --pitchfork
|
||||
[70] = 12, --cultivator
|
||||
[71] = 20, --scythe
|
||||
[72] = 10, --saw
|
||||
[102] = 12, --pry bar
|
||||
--[109] = 1, --torch
|
||||
--[110] = 1, --lit torch
|
||||
--[111] = 1, --candlestick
|
||||
--[112] = 1, --lit candle
|
||||
--[113] = 1, --candelabra
|
||||
--[114] = 1, --lit andelabra
|
||||
--[115] = 1, --oil lamp
|
||||
--[116] = 1, --lit oil lamp
|
||||
--[117] = 1, --lantern
|
||||
--[118] = 1, --lit lantern
|
||||
[129] = 60, --weed sprayer -- FIXME: no damage normally. Only effects plants?
|
||||
--[136] = 1, --tongs
|
||||
[241] = 20, --heat ray gun
|
||||
[242] = 10, --freeze ray gun
|
||||
--[243] = 1, --martian ritual pod knife
|
||||
[261] = 60, --spray gun -- FIXME: no damage normally. Only effects plants?
|
||||
[263] = 10, --martian hoe (couldn't be equipped in original)
|
||||
[264] = 20, --martian scythe (couldn't be equipped in original)
|
||||
[265] = 15, --martian pitchfork (couldn't be equipped in original)
|
||||
[266] = 10, --martian rake (couldn't be equipped in original)
|
||||
[267] = 8, --martian shovel (couldn't be equipped in original)
|
||||
[313] = 254, --M60 machine gun (scripted to only attack and kill the big bad)
|
||||
[327] = 15, --martian pick (couldn't be equipped in original)
|
||||
[401] = 12, --pool cue
|
||||
}
|
||||
|
||||
function get_weapon_damage(weapon)
|
||||
local dmg
|
||||
if weapon.luatype == "actor" then
|
||||
dmg = actor_get_damage(weapon)
|
||||
else
|
||||
dmg = weapon_dmg_tbl[weapon.obj_n]
|
||||
end
|
||||
|
||||
if dmg == nil then
|
||||
dmg = -1
|
||||
end
|
||||
|
||||
return dmg
|
||||
end
|
||||
|
||||
function sub_1B432(attacker, target)
|
||||
|
||||
end
|
||||
|
||||
function actor_get_weapon(attacker, target)
|
||||
local int_test = false
|
||||
local selected_weapon = attacker
|
||||
if not actor_has_bad_alignment(attacker) then
|
||||
if math.random(1, 0x1e) <= actor_int_adj(attacker) then
|
||||
int_test = true
|
||||
end
|
||||
end
|
||||
local range = actor_get_combat_range(attacker, target.x, target.y)
|
||||
|
||||
for obj in actor_inventory(actor) do
|
||||
if get_weapon_damage(obj) > 0 and get_weapon_range(obj) >= range then
|
||||
if (obj.obj_n ~= 129 and obj.obj_n ~= 261) --OBJ_WEED_SPRAYER, OBJ_SPRAY_GUN
|
||||
or (obj.quality ~= 0 and obj.invisible)
|
||||
or (obj.quality == 0 and (is_plant_obj(target) or (target.luatype=="actor" and (is_actor_stat_bit_set(target.obj_n, 7) and not is_actor_stat_bit_set(target.obj_n, 14))))) then
|
||||
|
||||
local weapon_requires_int = false
|
||||
if obj.obj_n == 240 --OBJ_HEAT_RAY_GUN
|
||||
or obj.obj_n == 241 --OBJ_FREEZE_RAY_GUN
|
||||
or obj.obj_n == 45 then
|
||||
weapon_requires_int = true
|
||||
end
|
||||
|
||||
--if int_test == true and weapon_requires_int == true or obj.obj_n == 43 and not sub_1B432(attacker, target) then --OBJ_SHOTGUN
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function attack_dex_saving_throw(attacker, defender, weapon)
|
||||
if defender == nil or defender.luatype == "obj" then
|
||||
return true
|
||||
end
|
||||
|
||||
local attacker_value
|
||||
if weapon.luatype == "actor" and is_actor_stat_bit_set(weapon.obj_n, 5) then
|
||||
attacker_value = actor_str_adj(attacker)
|
||||
else
|
||||
attacker_value = actor_dex_adj(attacker)
|
||||
end
|
||||
|
||||
local defender_value = actor_dex_adj(defender)
|
||||
|
||||
if math.random(1, 30) >= math.floor((defender_value + 30 - attacker_value) / 2) then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function out_of_ammo(attacker, weapon, print_message) -- untested function
|
||||
|
||||
local weapon_obj_n = weapon.obj_n
|
||||
|
||||
if ((weapon_obj_n == 41 or weapon_obj_n == 42) and Actor.inv_has_obj_n(attacker, 57) == false) --derringer, revolver, pistol rounds
|
||||
or (weapon_obj_n == 43 and Actor.inv_has_obj_n(attacker, 58) == false) --shotgun, shotgun shell
|
||||
or (weapon_obj_n == 44 and Actor.inv_has_obj_n(attacker, 59) == false) --rifle, rifle round
|
||||
or (weapon_obj_n == 45 and weapon.quality == 0 and (Actor.inv_has_obj_n(attacker, 58) == false or Actor.inv_has_obj_n(attacker, 59) == false)) --belgian combine (combine), shotgun shell, rifle round
|
||||
or (weapon_obj_n == 45 and weapon.quality == 1 and Actor.inv_has_obj_n(attacker, 59) == false) --belgian combine (rifle), rifle round
|
||||
or (weapon_obj_n == 45 and weapon.quality == 2 and Actor.inv_has_obj_n(attacker, 58) == false) --belgian combine (shotgun), shotgun shell
|
||||
or (weapon_obj_n == 46 and Actor.inv_has_obj_n(attacker, 60) == false) --elephant gun, elephant gun round
|
||||
or (weapon_obj_n == 47 and Actor.inv_has_obj_n(attacker, 63) == false) --sling, sling stone
|
||||
or ((weapon_obj_n == 240 or weapon_obj_n == 241 or weapon_obj_n == 129 or weapon_obj_n == 261) and weapon.qty == 0) then --heat ray gun, freeze ray gun, weed sprayer, spray gun
|
||||
if(print_message) then
|
||||
printl("OUT_OF_AMMUNITION")
|
||||
play_md_sfx(5)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
if weapon_obj_n == 48 and Actor.inv_has_obj_n(attacker, 64) == false then --bow, arrows
|
||||
if(print_message) then
|
||||
printl("OUT_OF_ARROWS")
|
||||
play_md_sfx(5)
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function attack_with_freezeray(actor, target_actor, damage)
|
||||
if actor_tbl[target_actor.obj_n] ~= nil
|
||||
and (is_actor_stat_bit_set(target_actor.obj_n, 14) or is_actor_stat_bit_set(target_actor.obj_n, 7)) then
|
||||
target_actor.paralyzed = true
|
||||
printfl("ACTOR_PARALYZED", target_actor.name)
|
||||
if not is_actor_stat_bit_set(target_actor.obj_n, 7)
|
||||
or is_actor_stat_bit_set(target_actor.obj_n, 14) then
|
||||
hit_target(target_actor, BLUE_HIT_TILE)
|
||||
else
|
||||
actor_take_hit(actor, target_actor, damage, 1)
|
||||
end
|
||||
else
|
||||
printl("IT_HAS_NO_EFFECT")
|
||||
end
|
||||
end
|
||||
|
||||
function check_ammo(actor, weapon)
|
||||
local obj_n = weapon.obj_n
|
||||
if obj_n == 47 and not Actor.inv_has_obj_n(actor, 63) then --OBJ_SLING, OBJ_SLING_STONE
|
||||
return 1
|
||||
end
|
||||
|
||||
if (obj_n == 41 or obj_n == 42) and not Actor.inv_has_obj_n(actor, 57) then --OBJ_DERRINGER, OBJ_REVOLVER, OBJ_PISTOL_ROUND
|
||||
return 1
|
||||
end
|
||||
|
||||
if obj_n == 46 and not Actor.inv_has_obj_n(actor, 60) then --OBJ_ELEPHANT_GUN, OBJ_ELEPHANT_GUN_ROUND
|
||||
return 1
|
||||
end
|
||||
|
||||
if obj_n == 44 and not Actor.inv_has_obj_n(actor, 59) then --OBJ_RIFLE, OBJ_RIFLE_ROUND
|
||||
return 1
|
||||
end
|
||||
|
||||
if obj_n == 43 and not Actor.inv_has_obj_n(actor, 58) then --OBJ_SHOTGUN, OBJ_SHOTGUN_SHELL
|
||||
return 1
|
||||
end
|
||||
|
||||
if (obj_n == 129 or obj_n == 261) and weapon.qty ~= 0 then --OBJ_WEED_SPRAYER, OBJ_SPRAY_GUN
|
||||
return 1
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
function attack_target_with_weapon(actor, target_x, target_y, weapon)
|
||||
local target_range = actor_get_combat_range(actor, target_x, target_y)
|
||||
local weapon_range = get_weapon_range(weapon)
|
||||
|
||||
if target_range > weapon_range then
|
||||
return 2 --out of range
|
||||
end
|
||||
|
||||
local ret = check_ammo(actor, weapon)
|
||||
if ret ~= 0 then
|
||||
return ret
|
||||
end
|
||||
|
||||
local obj_n = weapon.obj_n
|
||||
|
||||
|
||||
local var_10 = 0
|
||||
local var_12 = 0
|
||||
--OBJ_HEAT_RAY_GUN
|
||||
--OBJ_FREEZE_RAY_GUN
|
||||
--OBJ_BELGIAN_COMBINE
|
||||
if obj_n == 240 or obj_n == 241 or obj_n == 45 then
|
||||
if weapon.quality < 2 then
|
||||
var_10= 1
|
||||
end
|
||||
|
||||
if weapon.quality ~= 1 then
|
||||
var_12 = 1
|
||||
end
|
||||
|
||||
if obj_n == 45 then --OBJ_BELGIAN_COMBINE
|
||||
if var_10 ~= 0 then
|
||||
if not Actor.inv_has_obj_n(actor, 59) then --OBJ_RIFLE_ROUND
|
||||
var_10 = 0
|
||||
end
|
||||
end
|
||||
if var_12 ~= 0 then
|
||||
if not Actor.inv_has_obj_n(actor, 58) then --OBJ_SHOTGUN_SHELL
|
||||
var_12 = 0
|
||||
end
|
||||
end
|
||||
else
|
||||
if weapon.qty == 0 then
|
||||
return 1
|
||||
end
|
||||
if weapon.qty < (var_12 * 4) + var_10 then
|
||||
var_12 = 0
|
||||
end
|
||||
end
|
||||
|
||||
if var_10 == 0 and var_12 == 0 then
|
||||
return 1
|
||||
end
|
||||
else
|
||||
if obj_n == 43 then --OBJ_SHOTGUN
|
||||
var_10 = 0
|
||||
var_12 = 1
|
||||
else
|
||||
var_10 = 1
|
||||
var_12 = 0
|
||||
end
|
||||
end
|
||||
|
||||
local damage_mode = 0
|
||||
if obj_n == 240 then --OBJ_HEAT_RAY_GUN
|
||||
damage_mode = 3
|
||||
end
|
||||
|
||||
if obj_n == 241 then --OBJ_FREEZE_RAY_GUN
|
||||
damage_mode = 1
|
||||
end
|
||||
|
||||
g_attack_target = g_selected_obj
|
||||
|
||||
if var_10 == 0 then
|
||||
spread_weapon_damage(actor, target_x, target_y, weapon)
|
||||
return 0
|
||||
end
|
||||
|
||||
local is_ranged_attack = false
|
||||
if target_range > 1 then
|
||||
is_ranged_attack = true
|
||||
end
|
||||
|
||||
if (obj_n >= 40 and obj_n <= 48) --OBJ_CUPIDS_BOW_AND_ARROWS, OBJ_BOW
|
||||
or obj_n == 129 --OBJ_WEED_SPRAYER
|
||||
or obj_n == 261 --OBJ_SPRAY_GUN
|
||||
or obj_n == 240 --OBJ_HEAT_RAY_GUN
|
||||
or obj_n == 241 --OBJ_FREEZE_RAY_GUN
|
||||
then
|
||||
is_ranged_attack = true
|
||||
end
|
||||
|
||||
local damage
|
||||
if weapon.luatype == "actor" then
|
||||
damage = actor_get_damage(actor)
|
||||
if damage == nil then
|
||||
damage = 1
|
||||
end
|
||||
else
|
||||
damage = get_weapon_damage(weapon)
|
||||
if damage < 0 then
|
||||
damage = 1
|
||||
end
|
||||
end
|
||||
|
||||
local does_damage
|
||||
|
||||
local target = find_rockworm_actor(g_attack_target)
|
||||
if target ~= nil
|
||||
and target.luatype == "actor"
|
||||
and obj_n ~= 129 --OBJ_WEED_SPRAYER
|
||||
and obj_n ~= 261 then --OBJ_SPRAY_GUN
|
||||
does_damage = attack_dex_saving_throw(actor, target, weapon)
|
||||
end
|
||||
|
||||
if is_ranged_attack then
|
||||
fire_range_based_weapon(actor, target_x, target_y, weapon)
|
||||
end
|
||||
|
||||
target = find_rockworm_actor(g_attack_target)
|
||||
|
||||
if not is_ranged_attack and map_is_on_screen(actor.xyz) then
|
||||
play_md_sfx(0)
|
||||
end
|
||||
|
||||
if does_damage == nil then
|
||||
does_damage = true
|
||||
if target ~= nil
|
||||
and target.luatype == "actor"
|
||||
and obj_n ~= 129 --OBJ_WEED_SPRAYER
|
||||
and obj_n ~= 261 then --OBJ_SPRAY_GUN
|
||||
does_damage = attack_dex_saving_throw(actor, target, weapon)
|
||||
end
|
||||
end
|
||||
|
||||
if not does_damage then
|
||||
play_md_sfx(3)
|
||||
end
|
||||
|
||||
if does_damage
|
||||
and target ~= nil
|
||||
and (target.luatype == "obj" or target.actor_num ~= actor.actor_num) then
|
||||
if obj_n == 241 then --OBJ_FREEZE_RAY_GUN
|
||||
if target.obj_n == 160 and target.frame_n == 1 then
|
||||
printl("THE_WATER_FREEZES")
|
||||
target.frame_n = 2
|
||||
else
|
||||
if target.luatype == "actor" then
|
||||
attack_with_freezeray(actor, target, damage)
|
||||
end
|
||||
end
|
||||
elseif obj_n == 129 or obj_n == 261 then --OBJ_WEED_SPRAYER, OBJ_SPRAY_GUN
|
||||
if weapon.quality ~= 0 then
|
||||
if target.luatype == "actor" and target.obj_n == 145 then --OBJ_MONSTER_FOOTPRINTS
|
||||
target.obj_n = 364 --OBJ_PROTO_MARTIAN
|
||||
printfl("BECOMES_VISIBLE", target.name)
|
||||
elseif target.luatype == "obj" and target.invisible then
|
||||
target.invisible = false
|
||||
printfl("BECOMES_VISIBLE", target.name)
|
||||
else
|
||||
printl("IT_HAS_NO_EFFECT")
|
||||
end
|
||||
else
|
||||
if actor_tbl[target.obj_n] ~= nil
|
||||
and not is_actor_stat_bit_set(target.obj_n, 14)
|
||||
and is_actor_stat_bit_set(target.obj_n, 7) then
|
||||
actor_take_hit(actor, target, damage, 2)
|
||||
else
|
||||
printl("IT_HAS_NO_EFFECT")
|
||||
end
|
||||
end
|
||||
elseif obj_n == 40 then --OBJ_CUPIDS_BOW_AND_ARROWS
|
||||
if target.luatype == "actor" and target.align ~= ALIGNMENT_GOOD then
|
||||
target.old_align = target.align
|
||||
target.align = ALIGNMENT_GOOD
|
||||
target.charmed = true
|
||||
printfl("ACTOR_CHARMED", target.name)
|
||||
end
|
||||
else
|
||||
actor_take_hit(actor, target, damage, damage_mode)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
if var_12 ~= 0 then
|
||||
spread_weapon_damage(actor, target_x, target_y, weapon)
|
||||
end
|
||||
|
||||
return 0
|
||||
end
|
||||
|
||||
local spread_weapon_sfx_tbl = {
|
||||
[0x2b]=8,
|
||||
[0x2d]=8,
|
||||
[0xf0]=0xa,
|
||||
[0xf1]=0xa,
|
||||
}
|
||||
local spread_weapon_tile_num_tbl = {
|
||||
[0x2b]=0x106,
|
||||
[0x2d]=0x106,
|
||||
[0xf0]=0x14e,
|
||||
[0xf1]=0x14f,
|
||||
}
|
||||
local spread_weapon_damage_tbl = {
|
||||
[0x2b]=0x14,
|
||||
[0x2d]=0x14,
|
||||
[0xf0]=0x19,
|
||||
[0xf1]=0xa,
|
||||
}
|
||||
|
||||
function spread_weapon_damage(actor, target_x, target_y, weapon)
|
||||
if spread_weapon_sfx_tbl[weapon.obj_n] ~= nil then
|
||||
play_md_sfx(spread_weapon_sfx_tbl[weapon.obj_n])
|
||||
end
|
||||
|
||||
--FIXME spread weapon anim here.
|
||||
local hit_items = projectile_anim_multi (spread_weapon_tile_num_tbl[weapon.obj_n], actor.x, actor.y, {{x=target_x, y=target_y, z=actor.z}, {x=target_x+1, y=target_y-1, z=actor.z}}, 2, 1, 0)
|
||||
|
||||
local k, v
|
||||
for k,v in pairs(hit_items) do
|
||||
if weapon.obj_n == 241 then --OBJ_FREEZE_RAY_GUN
|
||||
if v.obj_n == 160 and v.frame_n == 1 then --OBJ_EMPTY_BUCKET
|
||||
printl("THE_WATER_FREEZES")
|
||||
v.frame_n = 2
|
||||
elseif v.luatype == "actor" then
|
||||
if math.random(1, 0x2d) > actor_dex_adj(v) then
|
||||
attack_with_freezeray(actor, v, 10)
|
||||
else
|
||||
printfl("ACTOR_DODGES", v.name)
|
||||
play_md_sfx(3)
|
||||
end
|
||||
end
|
||||
elseif v.luatype == "obj" or math.random(1, 0x2d) > actor_dex_adj(v) then
|
||||
local dmg_mode = 0
|
||||
if weapon.obj_n == 240 then --OBJ_HEAT_RAY_GUN
|
||||
dmg_mode = 3
|
||||
end
|
||||
actor_take_hit(actor, v, spread_weapon_damage_tbl[weapon.obj_n], dmg_mode)
|
||||
else
|
||||
printfl("ACTOR_DODGES", v.name)
|
||||
play_md_sfx(3)
|
||||
end
|
||||
end
|
||||
|
||||
if weapon.obj_n == 43 or weapon.obj_n == 45 then --OBJ_SHOTGUN, OBJ_BELGIAN_COMBINE
|
||||
Actor.inv_remove_obj_qty(actor, 58, 1) --OBJ_SHOTGUN_SHELL
|
||||
else
|
||||
weapon.qty = weapon.qty - 4
|
||||
if weapon.qty < 0 then
|
||||
weapon.qty = 0
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local projectile_tbl = {
|
||||
[41]={tile_num=0x103, sfx_id=7, ammo_obj_n=57},
|
||||
[42]={tile_num=0x103, sfx_id=7, ammo_obj_n=57},
|
||||
[44]={tile_num=0x103, sfx_id=8, ammo_obj_n=59},
|
||||
[45]={tile_num=0x103, sfx_id=8, ammo_obj_n=59},
|
||||
[46]={tile_num=0x103, sfx_id=8, ammo_obj_n=60},
|
||||
[47]={tile_num=0x23E, sfx_id=6, ammo_obj_n=63},
|
||||
[48]={tile_num=0x23F, sfx_id=6, ammo_obj_n=64},
|
||||
[40]={tile_num=0x23F, sfx_id=6, ammo_obj_n=-3},
|
||||
[240]={tile_num=0x16B, sfx_id=10, ammo_obj_n=-2},
|
||||
[241]={tile_num=0x16A, sfx_id=10, ammo_obj_n=-2},
|
||||
[129]={tile_num=0x10A, sfx_id=6, ammo_obj_n=-2},
|
||||
[261]={tile_num=0x10A, sfx_id=6, ammo_obj_n=-2},
|
||||
[313]={tile_num=0x10B, sfx_id=50, ammo_obj_n=-3},
|
||||
[366]={tile_num=0x16F, sfx_id=34, ammo_obj_n=-3},
|
||||
[386]={tile_num=0x16C, sfx_id=34, ammo_obj_n=-3},
|
||||
[364]={tile_num=0x16D, sfx_id=6, ammo_obj_n=-3},
|
||||
[384]={tile_num=0x16E, sfx_id=6, ammo_obj_n=-3},
|
||||
}
|
||||
|
||||
function fire_range_based_weapon(attacker, target_x, target_y, weapon)
|
||||
local projectile_info = projectile_tbl[weapon.obj_n]
|
||||
if projectile_info == nil then
|
||||
projectile_info = {tile_num=weapon.tile_num, sfx_id=0, ammo_obj_n=-1 }
|
||||
end
|
||||
|
||||
play_md_sfx(projectile_info.sfx_id)
|
||||
|
||||
projectile_anim(projectile_info.tile_num, attacker.x, attacker.y, target_x, target_y, 4, false, 0)
|
||||
|
||||
if projectile_info.ammo_obj_n > 0 then
|
||||
Actor.inv_remove_obj_qty(attacker, projectile_info.ammo_obj_n, 1)
|
||||
elseif projectile_info.ammo_obj_n == -2 then
|
||||
weapon.qty = weapon.qty - 1
|
||||
elseif projectile_info.ammo_obj_n == -1 and actor_get_combat_range(attacker, target_x, target_y) > 1 then
|
||||
if is_open_water_at_loc(target_x, target_y, attacker.z) then
|
||||
Obj.removeFromEngine(weapon)
|
||||
else
|
||||
Obj.moveToMap(weapon, target_x, target_y, attacker.z)
|
||||
end
|
||||
--FIXME original updated readied weapons here. We might also need to do that.
|
||||
end
|
||||
end
|
||||
292
devtools/create_ultima/files/ultima6/scripts/md/dreamworld.lua
Normal file
292
devtools/create_ultima/files/ultima6/scripts/md/dreamworld.lua
Normal file
@@ -0,0 +1,292 @@
|
||||
function finish_dream_quest(actor)
|
||||
local schedule = Actor.get_schedule(actor, 0)
|
||||
|
||||
Actor.move(actor, schedule.x, schedule.y, schedule.z)
|
||||
|
||||
local obj = map_get_obj(schedule.x, schedule.y, schedule.z, 461) --OBJ_DREAM_TELEPORTER
|
||||
Obj.removeFromEngine(obj)
|
||||
obj = map_get_obj(schedule.x, schedule.y-1, schedule.z, 292) --OBJ_OBELISK
|
||||
Obj.removeFromEngine(obj)
|
||||
Actor.set_talk_flag(actor, 7)
|
||||
|
||||
if Actor.get_talk_flag(0x56, 7)
|
||||
and Actor.get_talk_flag(0x54, 7)
|
||||
and Actor.get_talk_flag(0x52, 7)
|
||||
and Actor.get_talk_flag(0x55, 7) then
|
||||
Actor.set_talk_flag(0x60, 4)
|
||||
end
|
||||
|
||||
if Actor.get_talk_flag(0x50, 7)
|
||||
and Actor.get_talk_flag(0x51, 7)
|
||||
and Actor.get_talk_flag(0x52, 7)
|
||||
and Actor.get_talk_flag(0x53, 7)
|
||||
and Actor.get_talk_flag(0x54, 7)
|
||||
and Actor.get_talk_flag(0x55, 7)
|
||||
and Actor.get_talk_flag(0x56, 7)
|
||||
and Actor.get_talk_flag(0x57, 7) then
|
||||
Actor.set_talk_flag(0x20, 4)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function wake_from_dream()
|
||||
--FIXME dreamworld_cleanup_state() The original calls this with actor zero as an argument.
|
||||
g_objlist_1d22_unk = 0
|
||||
local minutes = 60 - clock_get_minute()
|
||||
local current_hour = clock_get_hour()
|
||||
current_hour = current_hour + 1
|
||||
if current_hour >= 8 then
|
||||
minutes = minutes + (24 - current_hour + 8) * 60
|
||||
else
|
||||
minutes = minutes + (8 - current_hour) * 60
|
||||
end
|
||||
clock_inc(minutes)
|
||||
--FIXME reset walk_direction_modifier
|
||||
|
||||
for actor in party_members() do
|
||||
actor_clear_berry_counters(actor.actor_num)
|
||||
if actor.poisoned then
|
||||
if actor.hp <= 30 then
|
||||
if actor.hp <= 10 then
|
||||
actor.hp = 1
|
||||
else
|
||||
actor.hp = math.random(1, 10)
|
||||
end
|
||||
else
|
||||
actor.hp = math.random(24, 30)
|
||||
end
|
||||
end
|
||||
end
|
||||
local dream_actor = Actor.get(0)
|
||||
party_set_in_vehicle(false)
|
||||
dream_actor.visible = false
|
||||
party_show_all()
|
||||
party_update_leader()
|
||||
party_set_combat_mode(false)
|
||||
g_in_dream_mode = false
|
||||
map_enable_temp_actor_cleaning(true)
|
||||
printl("YOU_WAKE_UP")
|
||||
unlock_inventory_view()
|
||||
--remove dream actor's inventory
|
||||
for obj in actor_inventory(dream_actor, true) do
|
||||
Obj.removeFromEngine(obj)
|
||||
end
|
||||
local avatar = Actor.get(1)
|
||||
avatar.mpts = avatar.dex
|
||||
avatar.wt = WT_PLAYER
|
||||
end
|
||||
|
||||
|
||||
function actor_use_dream_machine(actor, dream_quality)
|
||||
if actor.actor_num ~= 1 then
|
||||
--FIXME advance time till dawn.
|
||||
printfl("ACTOR_DREAMS_UNTIL_DAWN_WHILE_THE_PARTY_WAITS", actor.name)
|
||||
actor.asleep = true
|
||||
g_party_is_warm = true
|
||||
advance_time(60 - clock_get_minute())
|
||||
while clock_get_hour() ~= 8 do
|
||||
advance_time(20)
|
||||
script_wait(100)
|
||||
end
|
||||
g_party_is_warm = false
|
||||
else
|
||||
play_midgame_sequence(4)
|
||||
party_set_party_mode()
|
||||
local dream_actor = Actor.get(0)
|
||||
|
||||
local dream_x, dream_y
|
||||
if dream_quality == 1 then
|
||||
dream_x, dream_y = 0x64, 0x3b
|
||||
else
|
||||
dream_x, dream_y = 0x93, 0x34
|
||||
end
|
||||
|
||||
--FIXME need to copy over more data from avatar actor.
|
||||
dream_actor.obj_n = actor.obj_n
|
||||
dream_actor.frame_n = actor.frame_n
|
||||
dream_actor.base_obj_n = actor.base_obj_n
|
||||
dream_actor.wt = WT_PLAYER
|
||||
dream_actor.visible = true
|
||||
dream_actor.hp = actor.max_hp
|
||||
|
||||
Actor.move(dream_actor, dream_x, dream_y, 2)
|
||||
player_set_actor(dream_actor)
|
||||
party_set_in_vehicle(true)
|
||||
party_hide_all()
|
||||
g_in_dream_mode = true
|
||||
map_enable_temp_actor_cleaning(false)
|
||||
g_prev_player_x = 0
|
||||
g_prev_player_y = 0
|
||||
g_current_dream_stage = 0
|
||||
lock_inventory_view(Actor.get(0))
|
||||
end
|
||||
end
|
||||
|
||||
function cleanup_cliff_fall()
|
||||
local dream_actor = Actor.get(0)
|
||||
local avatar = Actor.get(1)
|
||||
dream_actor.obj_n = avatar.base_obj_n
|
||||
dream_actor.frame_n = 9
|
||||
end
|
||||
|
||||
local dreamworld_cleanup_tbl = {
|
||||
[5]=function() end,
|
||||
[0x20]=function() end,
|
||||
[0x40]=cleanup_cliff_fall,
|
||||
[0x44]=function() end,
|
||||
[0xa0]=function() end,
|
||||
}
|
||||
|
||||
function fall_from_cliff()
|
||||
printl("YOU_FALL_OFF_THE_CLIFF")
|
||||
local dream_actor = Actor.get(0)
|
||||
if player_get_gender() == 0 then
|
||||
dream_actor.obj_n = 0x126
|
||||
else
|
||||
dream_actor.obj_n = 0x127
|
||||
end
|
||||
dream_actor.frame_n = 0
|
||||
|
||||
for y=dream_actor.y-8,dream_actor.y do
|
||||
local actor = map_get_actor(dream_actor.x, y, dream_actor.z)
|
||||
if actor ~= nil and actor.obj_n == 391 then --OBJ_YOUR_MOTHER
|
||||
Actor.kill(actor, false)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
local dreamworld_unk_tbl = {
|
||||
[0x4]=function() end,
|
||||
[0x40]=fall_from_cliff,
|
||||
[0x85]=function() end,
|
||||
[0xA1]=function() end,
|
||||
[0xA4]=function() end,
|
||||
[0xC0]=function() end,
|
||||
[0xC1]=function() end,
|
||||
[0xC4]=function() end,
|
||||
[0xC5]=function() end,
|
||||
[0xE0]=function() end,
|
||||
}
|
||||
|
||||
function spawn_your_mother()
|
||||
local player_loc = player_get_location()
|
||||
local mother = Actor.new(391, player_loc.x, player_loc.y-1,player_loc.z)
|
||||
actor_init(mother)
|
||||
mother.wt = 0x15
|
||||
mother.combat_mode = 0x15
|
||||
mother.visible = true
|
||||
Actor.move(mother, player_loc.x, player_loc.y-1,player_loc.z)
|
||||
end
|
||||
|
||||
function create_pitcher(x, y, z)
|
||||
local obj = Obj.new(217, math.floor(math.random(0, 5) / 2))
|
||||
obj.qty = 3
|
||||
Obj.moveToMap(obj, x, y, z)
|
||||
end
|
||||
|
||||
function setup_tiffany_stage()
|
||||
local tiffany = Actor.get(0x54)
|
||||
|
||||
Actor.clear_talk_flag(tiffany, 0)
|
||||
Actor.clear_talk_flag(tiffany, 6)
|
||||
|
||||
local player_loc = player_get_location()
|
||||
local z = player_loc.z
|
||||
for obj in find_obj_from_area(0x21, 0x33, z, 0x1c, 0x10) do
|
||||
local obj_n = obj.obj_n
|
||||
--OBJ_RED_THROW_RUG, OBJ_RED_CAPE, OBJ_GLASS_PITCHER, OBJ_BROKEN_CRYSTAL, OBJ_MINOTAUR
|
||||
if obj_n == 161 or obj_n == 162 or obj_n == 217 or obj_n == 218 or obj_n == 398 then
|
||||
Obj.removeFromEngine(obj)
|
||||
end
|
||||
end
|
||||
local rug = Obj.new(161) --OBJ_RED_THROW_RUG
|
||||
Obj.moveToMap(rug, 0x24, 0x36, z)
|
||||
|
||||
for i=57,65 do
|
||||
if i ~= 0x3e then
|
||||
create_pitcher(0x37, i, z)
|
||||
end
|
||||
if i > 0x3a and i ~= 0x40 then
|
||||
create_pitcher(0x39, i, z)
|
||||
end
|
||||
create_pitcher(0x3b, i, z)
|
||||
end
|
||||
|
||||
create_pitcher(0x38, 0x39, z)
|
||||
create_pitcher(0x38, 0x41, z)
|
||||
create_pitcher(0x3a, 0x39, z)
|
||||
create_pitcher(0x3a, 0x41, z)
|
||||
|
||||
local minotaur = Actor.new(398, 0x3b, 0x41, z)
|
||||
|
||||
actor_init(minotaur)
|
||||
Actor.move(minotaur, 0x3b, 0x41, z)
|
||||
minotaur.wt = 0x16
|
||||
|
||||
end
|
||||
|
||||
function complete_tiffany_stage()
|
||||
local tiffany = Actor.get(0x54)
|
||||
finish_dream_quest(tiffany)
|
||||
Actor.set_talk_flag(tiffany, 1)
|
||||
Actor.talk(tiffany)
|
||||
wake_from_dream()
|
||||
end
|
||||
|
||||
local dreamworld_init_tbl = {
|
||||
[0x5]=function() end,
|
||||
[0x20]=function() end,
|
||||
[0x25]=spawn_your_mother,
|
||||
[0x44]=setup_tiffany_stage,
|
||||
[0x60]=function() end,
|
||||
[0xA5]=function() end,
|
||||
[0xC0]=function() end,
|
||||
[0xC4]=function() end,
|
||||
[0xC5]=function() end,
|
||||
}
|
||||
|
||||
function dreamworld_cleanup_state(obj)
|
||||
local dream_actor = Actor.get(0)
|
||||
local new_stage = bit32.band(obj.status, 0xe5)
|
||||
if g_current_dream_stage ~= 0 and new_stage ~= 0xa5 and new_stage ~= 0xe5 then
|
||||
if dreamworld_cleanup_tbl[g_current_dream_stage] ~= nil then
|
||||
dreamworld_cleanup_tbl[g_current_dream_stage]()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- print("new stage="..new_stage.."\n")
|
||||
|
||||
if new_stage == 1 then
|
||||
g_current_dream_stage = 0
|
||||
return
|
||||
elseif new_stage == 0x24 then
|
||||
wake_from_dream()
|
||||
return
|
||||
elseif g_current_dream_stage ~= 0 and dreamworld_unk_tbl[new_stage] ~= nil then
|
||||
dreamworld_unk_tbl[new_stage]()
|
||||
end
|
||||
|
||||
if new_stage ~= 0xa5 then
|
||||
--FIXME clean up temp objects
|
||||
g_objlist_1d22_unk = 0
|
||||
end
|
||||
|
||||
actor_clear_berry_counters(dream_actor.actor_num)
|
||||
local player_loc = player_get_location()
|
||||
player_move(obj.quality, obj.qty, player_loc.z)
|
||||
|
||||
if new_stage == 0xe5 then
|
||||
if not Actor.get_talk_flag(0x66, 3) then
|
||||
g_objlist_1d22_unk = 6
|
||||
end
|
||||
else
|
||||
if dreamworld_init_tbl[new_stage] ~= nil then
|
||||
dreamworld_init_tbl[new_stage]()
|
||||
end
|
||||
|
||||
g_current_dream_stage = new_stage
|
||||
end
|
||||
|
||||
end
|
||||
220
devtools/create_ultima/files/ultima6/scripts/md/ending.lua
Normal file
220
devtools/create_ultima/files/ultima6/scripts/md/ending.lua
Normal file
@@ -0,0 +1,220 @@
|
||||
local lua_file = nil
|
||||
|
||||
--load common functions
|
||||
lua_file = nuvie_load("common/intro_common.lua"); lua_file();
|
||||
|
||||
function play()
|
||||
local gender = player_get_gender()
|
||||
local g_img_tbl = image_load_all("endgame.lzc")
|
||||
local text_tbl = text_load("scenetxt.lzc", 3)
|
||||
local text = sprite_new(nil, 0, 160, true)
|
||||
text.text_color = 4
|
||||
text.text = text_tbl[0]
|
||||
text.text_align = 2
|
||||
|
||||
local bg = sprite_new(g_img_tbl[0][0], 0, 24, true)
|
||||
local jack = sprite_new(g_img_tbl[0][gender+1], 155, 151, true)
|
||||
|
||||
canvas_set_palette("md_title.pal", 0)
|
||||
canvas_set_opacity(0xff);
|
||||
mouse_cursor_visible(false)
|
||||
canvas_set_update_interval(25)
|
||||
|
||||
music_play("mdd_mus.lzc", 11)
|
||||
fade_in()
|
||||
|
||||
poll_for_key_or_button(150)
|
||||
if should_exit() then return end
|
||||
|
||||
text.text = text_tbl[1]
|
||||
|
||||
poll_for_key_or_button(150)
|
||||
if should_exit() then return end
|
||||
|
||||
--space capsule rockets away from mars
|
||||
|
||||
jack.visible = false
|
||||
text.text = text_tbl[2]
|
||||
|
||||
bg.image = g_img_tbl[1][0]
|
||||
|
||||
local capsule = create_sprite(g_img_tbl[1][1], 105, 112)
|
||||
capsule.visible = false
|
||||
local smoke = sprite_new(g_img_tbl[1][2], 105, 112, false)
|
||||
|
||||
local i
|
||||
for i=-1,39 do
|
||||
bg.y = 23 + ((i + 3) % 4)
|
||||
bg.x = ((i + 2) % 5) - 2
|
||||
|
||||
if i > -1 and i < 13 then
|
||||
capsule.visible = true
|
||||
capsule.x = 105 + (i * i * 2) / 3
|
||||
capsule.y = 112 - i * i
|
||||
capsule.image.scale = (i * i) + 16
|
||||
|
||||
smoke.image = g_img_tbl[1][2 + math.floor(i/2)]
|
||||
smoke.visible = true
|
||||
else
|
||||
capsule.visible = false
|
||||
smoke.visible = false
|
||||
end
|
||||
|
||||
poll_for_key_or_button(3)
|
||||
if should_exit() then return end
|
||||
end
|
||||
|
||||
--capsule lands in the ocean.
|
||||
bg.image = g_img_tbl[2][0]
|
||||
bg.x = 0
|
||||
bg.y = 24
|
||||
|
||||
capsule.visible = true
|
||||
capsule.x = 170
|
||||
capsule.y = 150
|
||||
|
||||
text.text = text_tbl[3]
|
||||
|
||||
for i=0,9 do
|
||||
local j
|
||||
for j=0,3 do
|
||||
capsule.image = g_img_tbl[2][math.abs(2 - j) + 1]
|
||||
if i == 5 then
|
||||
text.text = text_tbl[4]
|
||||
end
|
||||
poll_for_key_or_button(8)
|
||||
if should_exit() then return end
|
||||
end
|
||||
end
|
||||
|
||||
--ticket tape parade
|
||||
canvas_set_opacity(0);
|
||||
capsule.visible = false
|
||||
|
||||
bg.image = g_img_tbl[3][0]
|
||||
local spector = sprite_new(g_img_tbl[3][gender+1], 190, 151, true)
|
||||
text.text = text_tbl[5]
|
||||
|
||||
fade_in(6)
|
||||
|
||||
poll_for_key_or_button(150)
|
||||
if should_exit() then return end
|
||||
|
||||
|
||||
--group photo.
|
||||
canvas_set_opacity(0);
|
||||
spector.visible = false
|
||||
|
||||
bg.image = g_img_tbl[4][0]
|
||||
|
||||
local moongate_tbl = image_load_all("moongate.lzc")
|
||||
local moongate = sprite_new(moongate_tbl[1][0], 35, 135, true)
|
||||
local group = sprite_new(g_img_tbl[4][gender+1], 195, 151, true)
|
||||
|
||||
local photographer = sprite_new(g_img_tbl[4][3], 75, 151, true)
|
||||
|
||||
text.text = text_tbl[6]
|
||||
|
||||
fade_in(6)
|
||||
|
||||
for i=0,79 do
|
||||
if i == 40 then
|
||||
moongate.visible = false
|
||||
group.visible = false
|
||||
photographer.visible = false
|
||||
bg.image = g_img_tbl[4][5]
|
||||
poll_for_key_or_button(2)
|
||||
fade_out(6)
|
||||
bg.image = g_img_tbl[4][0]
|
||||
moongate.visible = true
|
||||
group.visible = true
|
||||
photographer.visible = true
|
||||
canvas_set_opacity(0xff);
|
||||
else
|
||||
moongate.image = moongate_tbl[1][i % 8]
|
||||
if i >= 38 and i <= 42 then
|
||||
photographer.image = g_img_tbl[4][4]
|
||||
else
|
||||
photographer.image = g_img_tbl[4][3]
|
||||
end
|
||||
if i == 41 then
|
||||
text.text = text_tbl[7]
|
||||
end
|
||||
|
||||
poll_for_key_or_button(3)
|
||||
if should_exit() then return end
|
||||
end
|
||||
end
|
||||
|
||||
--mars dust storm
|
||||
|
||||
moongate.visible = false
|
||||
group.visible = false
|
||||
photographer.visible = false
|
||||
|
||||
bg.image = g_img_tbl[5]
|
||||
|
||||
local sand = sprite_new(nil, 240, 140, true)
|
||||
local tree = sprite_new(nil, 0, 140, true)
|
||||
|
||||
local dust = create_sprite(g_img_tbl[6], 0, 24)
|
||||
local dust1 = create_sprite(g_img_tbl[6], 0, 24)
|
||||
local dust2 = create_sprite(g_img_tbl[6], 0, 24)
|
||||
local dust3 = create_sprite(g_img_tbl[6], 0, 24)
|
||||
local dust4 = create_sprite(g_img_tbl[6], 0, 24)
|
||||
|
||||
dust.visible = true
|
||||
dust1.visible = true
|
||||
dust2.visible = true
|
||||
dust3.visible = true
|
||||
dust4.visible = true
|
||||
|
||||
text.text = text_tbl[8]
|
||||
|
||||
for i=0,63 do
|
||||
if math.floor(i / 8) > 4 then
|
||||
sand.image = g_img_tbl[7][4]
|
||||
else
|
||||
sand.image = g_img_tbl[7][math.floor(i / 8)]
|
||||
end
|
||||
if i < 56 then
|
||||
if i - 50 < 0 then
|
||||
tree.image = g_img_tbl[8][0]
|
||||
else
|
||||
tree.image = g_img_tbl[8][i - 50]
|
||||
end
|
||||
else
|
||||
tree.visible = false
|
||||
end
|
||||
|
||||
dust.x = 340 - (i * 10) - math.random(0, 19)
|
||||
dust.y = 24 - math.random(0, 9)
|
||||
|
||||
dust1.x = 420 - (i * 20) - math.random(0, 19)
|
||||
dust1.y = 24 - math.random(0, 9)
|
||||
|
||||
dust2.x = 500 - (i * 30) - math.random(0, 19)
|
||||
dust2.y = 24 - math.random(0, 9)
|
||||
|
||||
dust3.x = 580 - (i * 30) - math.random(0, 19)
|
||||
dust3.y = 24 - math.random(0, 9)
|
||||
|
||||
dust4.x = 660 - (i * 20) - math.random(0, 19)
|
||||
dust4.y = 24 - math.random(0, 9)
|
||||
|
||||
if i == 62 then
|
||||
text.text = text_tbl[9]
|
||||
end
|
||||
|
||||
poll_for_key_or_button(2)
|
||||
if should_exit() then return end
|
||||
end
|
||||
|
||||
poll_for_key_or_button(150)
|
||||
if should_exit() then return end
|
||||
|
||||
about_martian_dreams()
|
||||
end
|
||||
|
||||
|
||||
play()
|
||||
440
devtools/create_ultima/files/ultima6/scripts/md/init.lua
Normal file
440
devtools/create_ultima/files/ultima6/scripts/md/init.lua
Normal file
@@ -0,0 +1,440 @@
|
||||
local lua_file = nil
|
||||
|
||||
--load common functions
|
||||
lua_file = nuvie_load("common/common.lua"); lua_file();
|
||||
|
||||
OBJLIST_OFFSET_HOURS_TILL_NEXT_HEALING = 0x1cf2
|
||||
OBJLIST_OFFSET_PREV_PLAYER_X = 0x1d03
|
||||
OBJLIST_OFFSET_PREV_PLAYER_Y = 0x1d04
|
||||
OBJLIST_OFFSET_1D22_UNK = 0x1d22
|
||||
OBJLIST_OFFSET_DREAM_MODE_FLAG = 0x1d29
|
||||
|
||||
OBJLIST_OFFSET_BERRY_COUNTERS = 0x1d2f
|
||||
OBJLIST_OFFSET_DREAM_STAGE = 0x1d53
|
||||
|
||||
function dbg(msg_string)
|
||||
--io.stderr:write(msg_string)
|
||||
end
|
||||
|
||||
g_hours_till_next_healing = 0
|
||||
g_in_dream_mode = false
|
||||
|
||||
local g_selected_obj
|
||||
local g_attack_target
|
||||
|
||||
function update_watch_tile()
|
||||
local anim_index = get_anim_index_for_tile(616) --616 = watch tile
|
||||
if anim_index ~= nil then
|
||||
local new_watch_tile = 416 + clock_get_hour() % 12
|
||||
anim_set_first_frame(anim_index, new_watch_tile)
|
||||
end
|
||||
end
|
||||
|
||||
function load_game()
|
||||
g_selected_obj = nil
|
||||
g_attack_target = nil
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_HOURS_TILL_NEXT_HEALING)
|
||||
g_hours_till_next_healing = objlist_read1()
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_DREAM_MODE_FLAG)
|
||||
g_in_dream_mode = bit32.btest(objlist_read2(), 0x10)
|
||||
map_enable_temp_actor_cleaning(not g_in_dream_mode)
|
||||
|
||||
if g_in_dream_mode then
|
||||
lock_inventory_view(Actor.get(0))
|
||||
end
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_DREAM_STAGE)
|
||||
g_current_dream_stage = objlist_read2()
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_PREV_PLAYER_X)
|
||||
g_prev_player_x = objlist_read1()
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_PREV_PLAYER_Y)
|
||||
g_prev_player_y = objlist_read1()
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_1D22_UNK)
|
||||
g_objlist_1d22_unk = objlist_read1()
|
||||
|
||||
update_watch_tile()
|
||||
end
|
||||
|
||||
function save_game()
|
||||
objlist_seek(OBJLIST_OFFSET_HOURS_TILL_NEXT_HEALING)
|
||||
objlist_write1(g_hours_till_next_healing)
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_DREAM_MODE_FLAG)
|
||||
local bytes = objlist_read2()
|
||||
if g_in_dream_mode then
|
||||
bytes = bit32.bor(bytes, 0x10)
|
||||
else
|
||||
bytes = bit32.band(bytes, 0xFFEF)
|
||||
end
|
||||
objlist_seek(OBJLIST_OFFSET_DREAM_MODE_FLAG)
|
||||
objlist_write2(bytes)
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_DREAM_STAGE)
|
||||
objlist_write2(g_current_dream_stage)
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_PREV_PLAYER_X)
|
||||
objlist_write1(g_prev_player_x)
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_PREV_PLAYER_Y)
|
||||
objlist_write1(g_prev_player_y)
|
||||
|
||||
objlist_seek(OBJLIST_OFFSET_1D22_UNK)
|
||||
objlist_write1(g_objlist_1d22_unk)
|
||||
end
|
||||
|
||||
|
||||
|
||||
local g_container_obj_tbl = {
|
||||
[80]=1, [81]=1, [82]=1,
|
||||
[83]=1, [85]=1, [86]=1,
|
||||
[87]=1, [89]=1,[304]=1,
|
||||
[139]=1,[341]=1,[257]=1,
|
||||
[104]=1,[284]=1,[285]=1
|
||||
}
|
||||
|
||||
function is_blood(obj_num)
|
||||
if obj_num == 334 or obj_num == 335 or obj_num == 336 then --OBJ_BLOOD, OBJ_ICHOR, OBJ_SAP
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function is_container_obj(obj_num)
|
||||
if g_container_obj_tbl[obj_num] ~= nil then
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--OBJ_CLOSED_DOOR, OBJ_GLOW_WORM, OBJ_DEVIL_POD, OBJ_DEVIL_PLANT, OBJ_GLASS_PITCHER
|
||||
local attackable_obj_tbl = {
|
||||
[0xB3]=1,
|
||||
[0x184]=1,
|
||||
[0x133]=1,
|
||||
[0x12C]=1,
|
||||
[0xD9]=1,
|
||||
}
|
||||
|
||||
function is_obj_attackable(obj)
|
||||
return attackable_obj_tbl[obj.obj_n] ~= nil
|
||||
end
|
||||
|
||||
--OBJ_VINE, OBJ_TREE, OBJ_PORCUPOD, OBJ_FLOWER, OBJ_HARD_SHELLED_PLANT
|
||||
--OBJ_DEVIL_PLANT, OBJ_DEVIL_POD, OBJ_HEDGE
|
||||
local plant_obj_tbl = {
|
||||
[0xCD]=1,
|
||||
[0x198]=1,
|
||||
[0xA8]=1,
|
||||
[0xAA]=1,
|
||||
[0xAB]=1,
|
||||
[0x12C]=1,
|
||||
[0x133]=1,
|
||||
[0x12B]=1,
|
||||
}
|
||||
|
||||
function is_plant_obj(obj)
|
||||
return plant_obj_tbl[obj.obj_n] ~= nil
|
||||
end
|
||||
|
||||
--OBJ_DOLLAR, OBJ_RUBLE, OBJ_PHOTOGRAPH, OBJ_THREAD, OBJ_BOX_OF_CIGARS
|
||||
--OBJ_MATCH, OBJ_BOOK, OBJ_MAP, OBJ_NOTE, OBJ_WORMSBANE_SEED
|
||||
--OBJ_SCROLL, OBJ_LIVE_MARTIAN_SEED, OBJ_PILE_OF_COAL
|
||||
--OBJ_HUGE_LUMP_OF_COAL, OBJ_CHUNK_OF_ICE
|
||||
local burnable_obj_tbl = {
|
||||
[0x18]=1,
|
||||
[0x84]=1,
|
||||
[0x0B9]=1,
|
||||
[0x3E]=1,
|
||||
[0x65]=1,
|
||||
[0x6B]=1,
|
||||
[0x94]=1,
|
||||
[0x96]=1,
|
||||
[0x97]=1,
|
||||
[0x9E]=1,
|
||||
[0x0F3]=1,
|
||||
[0x0FC]=1,
|
||||
[0x1BC]=1,
|
||||
[0x1BF]=1,
|
||||
[0x100]=1,
|
||||
}
|
||||
|
||||
function is_obj_burnable(obj)
|
||||
return burnable_obj_tbl[obj.obj_n] ~= nil
|
||||
end
|
||||
|
||||
function is_open_water_at_loc(x, y, z)
|
||||
local tile_num = map_get_tile_num(x, y, z)
|
||||
local is_water = tile_get_flag(tile_num, 1, 0)
|
||||
if not is_water then
|
||||
return false
|
||||
end
|
||||
|
||||
if not tile_get_flag(tile_num, 1, 1) then -- not blocked
|
||||
return false
|
||||
end
|
||||
|
||||
for obj in objs_at_loc(location) do
|
||||
tile_num = obj.tile_num
|
||||
--FIXME original does this too
|
||||
-- sub ax, word_40FA2
|
||||
if tile_get_flag(tile_num, 3, 1) or tile_get_flag(tile_num, 3, 2) then --SUPPORT_OBJECT or FORCE_PASSABLE
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function search(obj)
|
||||
if obj.on_map == false then
|
||||
return
|
||||
end
|
||||
|
||||
local found_obj = false
|
||||
local child
|
||||
local first_loop = true
|
||||
local prev_obj = nil
|
||||
for child in container_objs(obj) do
|
||||
if prev_obj ~= nil then
|
||||
printfl("SEARCH_NEXT_OBJ", prev_obj.look_string)
|
||||
Obj.moveToMap(prev_obj, obj.x, obj.y, obj.z)
|
||||
end
|
||||
|
||||
if first_loop == true then
|
||||
found_obj = true
|
||||
printfl("SEARCHING_HERE_YOU_FIND", child.look_string)
|
||||
Obj.moveToMap(child, obj.x, obj.y, obj.z)
|
||||
else
|
||||
prev_obj = child
|
||||
end
|
||||
|
||||
script_wait(50)
|
||||
first_loop = false
|
||||
end
|
||||
|
||||
if prev_obj ~= nil then
|
||||
printfl("SEARCH_LAST_OBJ", prev_obj.look_string)
|
||||
Obj.moveToMap(prev_obj, obj.x, obj.y, obj.z)
|
||||
end
|
||||
|
||||
if found_obj == false then
|
||||
printl("SEARCHING_HERE_YOU_FIND_NOTHING")
|
||||
else
|
||||
print(".\n")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--tile_num, readied location
|
||||
local g_readiable_objs_tbl = {
|
||||
-- 0 = head
|
||||
[512] = 0, --cap
|
||||
[513] = 0, --cowboy hat
|
||||
[514] = 0, --pith hat
|
||||
[515] = 0, --military hat
|
||||
[516] = 0, --derby
|
||||
-- 1 = neck
|
||||
[517] = 1, --kerchief
|
||||
[518] = 1, --silk scarf
|
||||
[519] = 1, --muffler
|
||||
[1048] = 1, --martian jewelry
|
||||
[1049] = 1, --martian jewelry
|
||||
[1050] = 1, --martian jewelry
|
||||
[1051] = 1, --martian jewelry
|
||||
[1052] = 1, --martian jewelry
|
||||
[1053] = 1, --martian jewelry
|
||||
[1054] = 1, --martian jewelry
|
||||
[1055] = 1, --martian jewelry
|
||||
-- 3 = 1 handed
|
||||
[527] = 3, --bloody saber
|
||||
[552] = 3, --derringer
|
||||
[553] = 3, --revolver
|
||||
[560] = 3, --hatchet
|
||||
[561] = 3, --axe
|
||||
[562] = 3, --ball-peen hammer
|
||||
[565] = 3, --knife
|
||||
[566] = 3, --machete
|
||||
[567] = 3, --saber
|
||||
[622] = 3, --pry bar
|
||||
[650] = 3, --weed sprayer
|
||||
[667] = 3, --tongs
|
||||
[1068] = 3, --martian ritual pod knife
|
||||
-- 2 = torso
|
||||
[528] = 2, --cloth jacket
|
||||
[529] = 2, --wool sweater
|
||||
[530] = 2, --cape
|
||||
[531] = 2, --duster
|
||||
[532] = 2, --wool overcoat
|
||||
[533] = 2, --sheepskin jacket
|
||||
[534] = 2, --arctic parka
|
||||
[608] = 2, --electric belt
|
||||
-- 3 = shield hand
|
||||
[630] = 3, --torch
|
||||
[631] = 3, --lit torch
|
||||
[632] = 3, --candlestick
|
||||
[633] = 3, --lit candlestick
|
||||
[634] = 3, --candelabra
|
||||
[635] = 3, --lit candelabra
|
||||
[636] = 3, --oil lamp
|
||||
[637] = 3, --lit oil lamp
|
||||
[638] = 3, --lantern
|
||||
[639] = 3, --lit lantern
|
||||
-- 6 = UNK pants or dress FIXME: putting this here for now
|
||||
[536] = 6, --cotton pants
|
||||
[537] = 6, --cotton dress
|
||||
[538] = 6, --denim jeans
|
||||
[539] = 6, --wool pants
|
||||
[540] = 6, --wool dress
|
||||
[541] = 6, --chaps and jeans
|
||||
-- 7 = feet
|
||||
[520] = 7, --man's shoes
|
||||
[521] = 7, --woman's shoes
|
||||
[522] = 7, --riding boots
|
||||
[523] = 7, --ruby slippers
|
||||
[524] = 7, --thigh boots
|
||||
[525] = 7, --hip boots
|
||||
[526] = 7, --winged shoes
|
||||
[542] = 7, --man's shoes
|
||||
-- 4 = two handed
|
||||
[551] = 4, --Cupid's bow and arrows
|
||||
[554] = 4, --shotgun
|
||||
[555] = 4, --rifle
|
||||
[556] = 4, --Belgian combine
|
||||
[557] = 4, --elephant gun
|
||||
[558] = 4, --sling
|
||||
[559] = 4, --bow
|
||||
[563] = 4, --sledge hammer
|
||||
[576] = 4, --pick
|
||||
[577] = 4, --shovel
|
||||
[578] = 4, --hoe
|
||||
[579] = 4, --rake
|
||||
[580] = 4, --pitchfork
|
||||
[581] = 4, --cultivator
|
||||
[582] = 4, --scythe
|
||||
[583] = 4, --saw
|
||||
[717] = 4, --throw rug
|
||||
[718] = 4, --red cape
|
||||
[1066] = 4, --heat ray gun
|
||||
[1067] = 4, --freeze ray gun
|
||||
[1093] = 4, --spray gun
|
||||
[1095] = 4, --martian hoe (couldn't be equipped in original)
|
||||
[1096] = 4, --martian scythe (couldn't be equipped in original)
|
||||
[1097] = 4, --martian pitchfork (couldn't be equipped in original)
|
||||
[1098] = 4, --martian rake (couldn't be equipped in original)
|
||||
[1099] = 4, --martian shovel (couldn't be equipped in original)
|
||||
[1188] = 4, --M60 machine gun
|
||||
[1206] = 4, --martian pick (couldn't be equipped in original)
|
||||
[1897] = 4, --pool cue
|
||||
-- 5 = finger gloves and bracelets FIXME: putting this here for now
|
||||
[544] = 5, --lady's silk gloves
|
||||
[545] = 5, --driving gloves
|
||||
[546] = 5, --cotton work gloves
|
||||
[547] = 5, --work gloves
|
||||
[548] = 5, --wool mittens
|
||||
[549] = 5, --rubber gloves
|
||||
[550] = 5 --welding gloves
|
||||
}
|
||||
|
||||
function wrap_coord(coord, level)
|
||||
local map_stride = 1024
|
||||
if level ~= 0 then
|
||||
map_stride = 256
|
||||
end
|
||||
|
||||
if coord < 0 then
|
||||
return map_stride + coord
|
||||
end
|
||||
|
||||
return coord % map_stride
|
||||
end
|
||||
|
||||
function can_move_obj(obj, rel_x, rel_y)
|
||||
local z = obj.z
|
||||
return map_can_put_obj(wrap_coord(obj.x+rel_x,z), wrap_coord(obj.y+rel_y,z), z)
|
||||
end
|
||||
|
||||
function obj_get_readiable_location(obj)
|
||||
if g_readiable_objs_tbl[obj.tile_num] ~= nil then
|
||||
return g_readiable_objs_tbl[obj.tile_num]
|
||||
end
|
||||
|
||||
return -1
|
||||
end
|
||||
|
||||
function update_lamp_posts()
|
||||
--Turn lamps on/off if we have power and it is dark.
|
||||
local frame_n = 3
|
||||
local hour = clock_get_hour()
|
||||
if Actor.get_talk_flag(0x73, 4) and (hour < 6 or hour > 17) then
|
||||
frame_n = 7
|
||||
end
|
||||
|
||||
local loc = player_get_location()
|
||||
for obj in find_obj(loc.z, 228) do --OBJ_LAMP_POST
|
||||
if obj ~= nil then
|
||||
obj.frame_n = frame_n
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local PLAY_ASYNC = true
|
||||
function play_md_sfx(sfx_id, play_async)
|
||||
--FIXME
|
||||
end
|
||||
|
||||
function play_door_sfx()
|
||||
--FIXME
|
||||
end
|
||||
|
||||
function create_object_needs_quan(obj_n)
|
||||
-- obj.stackable is already checked
|
||||
if obj_n == 196 or obj_n == 311 or obj_n == 312 then --OBJ_LEVER, OBJ_SWITCH, OBJ_SWITCH1
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
function input_select_obj_qty(obj)
|
||||
if not obj.stackable then
|
||||
return 1
|
||||
end
|
||||
|
||||
printl("HOW_MANY")
|
||||
local qty = input_select_integer("0123456789", true)
|
||||
if qty > obj.qty then
|
||||
return obj.qty
|
||||
end
|
||||
return qty
|
||||
end
|
||||
|
||||
--load actor functions
|
||||
local actor_load = nuvie_load("md/actor.lua");
|
||||
if type(actor_load) == "function" then
|
||||
actor_load()
|
||||
else
|
||||
if type(actor_load) == "string" then
|
||||
--io.stderr:write(actor_load);
|
||||
end
|
||||
end
|
||||
|
||||
look_init = nuvie_load("md/look.lua"); look_init();
|
||||
|
||||
combat_init = nuvie_load("md/combat.lua"); combat_init();
|
||||
|
||||
-- init usecode
|
||||
usecode_init = nuvie_load("md/usecode.lua"); usecode_init();
|
||||
|
||||
talk_init = nuvie_load("md/talk.lua"); talk_init();
|
||||
|
||||
player_init = nuvie_load("md/player.lua"); player_init();
|
||||
|
||||
worktype_init = nuvie_load("md/worktype.lua"); worktype_init();
|
||||
|
||||
dreamworld_init = nuvie_load("md/dreamworld.lua"); dreamworld_init();
|
||||
2046
devtools/create_ultima/files/ultima6/scripts/md/intro.lua
Normal file
2046
devtools/create_ultima/files/ultima6/scripts/md/intro.lua
Normal file
File diff suppressed because it is too large
Load Diff
264
devtools/create_ultima/files/ultima6/scripts/md/lang/en/game.lua
Normal file
264
devtools/create_ultima/files/ultima6/scripts/md/lang/en/game.lua
Normal file
@@ -0,0 +1,264 @@
|
||||
return {
|
||||
PASS="Pass!\n",
|
||||
YOU_SEE="you see %s",
|
||||
ON="On - ",
|
||||
TO="To - ",
|
||||
NOTHING="nothing!\n",
|
||||
NO_EFFECT="\nNo effect\n",
|
||||
AARGH="Aargh!\n",
|
||||
BLOCKED="Blocked!\n",
|
||||
HOW_MANY="How many? ",
|
||||
YOU_ARE_CARRYING_TOO_MUCH_ALREADY="You are carrying too much already.\n",
|
||||
YOU_PRIED_THE_NAILS_OUT_OF_THE_CRATE="You pried the nails out of the crate.\n",
|
||||
YOU_NAIL_THE_CRATE_SHUT="You nail the crate shut.\n",
|
||||
IT_HAS_NO_EFFECT="It has no effect.\n",
|
||||
IT_IS_NAILED_SHUT="It is nailed shut.\n",
|
||||
IT_IS_LOCKED="It is locked.\n",
|
||||
IS_NOT_STRONG_ENOUGH="%s is not strong enough.\n",
|
||||
NOT_WHILE_UNDERGROUND="Not while underground.\n",
|
||||
YOU_ARE_SOMEWHERE_NEAR="You are somewhere near",
|
||||
YOU_CANT_DIG_ANY_DEEPER="You can't dig any deeper.\n",
|
||||
IT_IS_STUCK="It is stuck.\n",
|
||||
THE_CONTROL_PANEL_OPERATES_THE_DREAM_MACHINE="The control panel operates the dream machine.\n",
|
||||
YOU_NEED_TO_USE_PLIERS_TO_ATTACH_THE_CABLE="You need to use pliers to attach the cable.",
|
||||
YOU_WILL_CHEW_IT_INSTINCTIVELY="You will chew it instinctively.\n",
|
||||
THE_PLATE_IN_THE_CAMERA_HAS_ALREADY_BEEN_EXPOSED="The plate in the camera has already been exposed.\n",
|
||||
YOU_MUST_USE_A_SHOVEL_TO_MOVE_THAT="You must use a shovel to move that.\n",
|
||||
YOU_CANT_DETERMINE_HOW_TO_READ_THE_TIME="You can't determine how to read the time.\n",
|
||||
THE_BERRIES_ARE_NOT_EDIBLE="The berries are not edible.\n",
|
||||
YOU_DONT_KNOW_HOW_IT_WORKS="You don't know how it works.\n",
|
||||
THE_GROUND_IS_NOT_CLEAR_FOR_DIGGING="The ground is not clear for digging.\n",
|
||||
YOU_CANT_DIG_HERE="You can't dig here.\n",
|
||||
YOU_FILLED_IN_THE_HOLE="You filled in the hole.\n",
|
||||
YOU_MAY_USE_THE_RUBY_SLIPPERS_TO_GO_HOME="You may use the ruby slippers to go home. If you choose to, you may now view the Grand Finale.\n\n*Afterwards, you will exit to DOS. You will be able to resume play from your last saved game.\n\n*Would you like to see the Grand Finale now? If so, press Y. To resume play now, hit N: (Y N)\n",
|
||||
CLICK="Click.\n",
|
||||
NOT_WHILE_IN_SOLO_MODE="Not while in solo mode!\n",
|
||||
SOMETHING="something",
|
||||
SEARCHING_HERE_YOU_FIND="Searching here, you find %s",
|
||||
SEARCHING_HERE_YOU_FIND_NOTHING="Searching here, you find nothing.\n",
|
||||
SEARCH_NEXT_OBJ=", %s",
|
||||
SEARCH_LAST_OBJ=" and %s",
|
||||
YOU_CANT_SLEEP_IN_A_DREAM="You can't sleep in a dream.\n",
|
||||
TENT_OBJ_IN_THE_WAY="The %s is in the way.\n",
|
||||
THE_GROUND_IS_NOT_FLAT_ENOUGH="The ground is not flat enough.\n",
|
||||
REST="Rest",
|
||||
NOT_WHILE_IN_COMBAT_MODE="Not while in combat mode!\n",
|
||||
NOT_WHILE_FOES_ARE_NEAR=" - Not while foes are near!\n",
|
||||
IS_TOO_NEAR_TO_SETUP_CAMP=" - %s is too near to set up camp.\n",
|
||||
IS_POISONED="\n%s is poisoned!",
|
||||
DO_YOU_REALLY_WANT_TO_SLEEP="\nDo you really want to sleep anyway? ",
|
||||
REST_UNTIL="\nRest until %s?",
|
||||
SUNRISE="sunrise",
|
||||
SUNSET="sunset",
|
||||
HOW_MANY_HOURS="\nHow many hours? ",
|
||||
HAS_A_DREAM="\n%s has a dream...\n\n",
|
||||
SEES_THREE_STONE_OBELISKS="%s sees three stone obelisks, one inscribed with a book, one a heart, and one a sword.\n\n*",
|
||||
FEELS_DRAWN_TO_ONE_OF_THE_OBELISKS="%s feels drawn to one of the obelisks.\n\n",
|
||||
DOES_TOUCH_THE_OBELISK="Does %s touch the obelisk with the @book, the @heart, or the @sword?\n",
|
||||
WHICH_BHS="Which (B H S):\n",
|
||||
FEELS_BETTER="%s feels better.\n",
|
||||
THE_TONGS_WILL_NOW_PROTECT_YOUR_HANDS="The tongs will now protect your hands.\n",
|
||||
THEY_WONT_COME_OFF="They won't come off!\n",
|
||||
OUCH_IT_IS_VERY_HOT="OUCH. It is very hot.\n",
|
||||
COMPLAINS_OF_TOO_MUCH_LIGHT_AND_INANIMATE="\n%s complains of too much light and inanimate things keep talking.*\n",
|
||||
COMPLAINS_OF_INANIMATE_THINGS_TALKING="\n%s complains of inanimate things talking.*\n",
|
||||
COMPLAINS_OF_TOO_MUCH_LIGHT="\n%s complains of too much light.*\n",
|
||||
YOU_CANT_SLEEP="\nYou can't sleep.\n",
|
||||
NOBODY_CAN_SLEEP="\nNobody can sleep.\n",
|
||||
A_MECHANICAL_PERSON_CANT_EAT_BERRIES="A mechanical person can't eat berries!\n",
|
||||
YOU_EAT_A_MARTIAN_BERRY_YOU_FEEL_AN_INCREASE_IN_THE_STRANGE="You eat a Martian berry. You feel an increase in the strange ",
|
||||
YOU_EAT_A_MARTIAN_BERRY_YOU_FEEL_A_STRANGE="You eat a Martian berry. You feel a strange ",
|
||||
RELATIONSHIP_WITH_THINGS_AROUND_YOU="relationship with things around you.\n",
|
||||
SENSITIVITY_TO_THE_FEELINGS_OF_OBJECTS_AROUND_YOU="sensitivity to the feelings of objects around you.\n",
|
||||
SENSE_OF_YOUR_SPATIAL_LOCATION="sense of your spatial location.\n",
|
||||
SUDDEN_FLUSH_DIZZINESS_AND_NAUSEA="sudden flush, dizziness, and nausea.\n",
|
||||
BREATHES_EASIER="%s breathes easier!\n",
|
||||
GASPS_FOR_AIR="%s gasps for air!\n",
|
||||
THE_IS_OUT_OF_FUEL="The %s is out of fuel.\n",
|
||||
WENT_OUT="%s went out.\n",
|
||||
FEELS_WARMER="%s feels warmer!\n",
|
||||
IS_FREEZING="%s is freezing!\n",
|
||||
A_PSYCHIC_POWER_FADES="A psychic power fades...\n",
|
||||
SOME_ICE_HAS_MELTED="Some ice has melted.\n",
|
||||
THE_ICE_IS_MELTING="The ice is melting.\n",
|
||||
THAT_WOULD_BE_A_WASTE_OUTSIDE_OF_COMBAT="That would be a waste outside of combat.\n",
|
||||
ENTERS_A_BATTLE_FRENZY="%s enters a battle frenzy!\n",
|
||||
YOU_SPIT_INTO_THE_SPITTOON="You spit into the spittoon.\n",
|
||||
YOUR_MOUTH_IS_TOO_DRY="Your mouth is too dry.\n",
|
||||
CHING="Ching!\n",
|
||||
SHING="Shing!\n",
|
||||
WHEEEEZE="Wheeeeze\n",
|
||||
THUMP_THUMP="Thump! Thump!\n",
|
||||
GONG="GONG!!!!\n",
|
||||
YOU_PLAY_THE="You play the %s.\n",
|
||||
THE_TIME_IS="\n\nThe time is ",
|
||||
TIME_AM="%d:%02d A.M.\n",
|
||||
TIME_PM="%d:%02d P.M.\n",
|
||||
THE_CANNON_WILL_FIRE_STEEL_CANNON_BALLS="The cannon will fire steel cannon balls.\n",
|
||||
IT_IS_EMPTY="It is empty.\n",
|
||||
DIRT="dirt",
|
||||
ROCK="rock",
|
||||
IRON_ORE="iron ore",
|
||||
COAL="coal",
|
||||
IT_HAS_1_LOAD_OF="It has 1 load of %s.\n",
|
||||
IT_HAS_N_LOADS_OF="It has %d loads of %s.\n",
|
||||
IT_HAS_A_HEARTSTONE="It has a heartstone.\n",
|
||||
IT_IS_GROWING="It is growing.\n",
|
||||
IT_IS_RIPE="It is ripe.\n",
|
||||
IT_IS_NOT_GROWING="It is not growing.\n",
|
||||
IT_IS_READY_TO_USE="It is ready to use.\n",
|
||||
THE_RUBBER_IN_THE_SPRAYER_SYSTEM_IS_NOT_FLESH_COLORED="The rubber in the sprayer system is not flesh-colored.\n",
|
||||
THERE_IS_NO_RUBBER_IN_THE_SPRAYER_SYSTEM="There is no rubber in the sprayer system.\n",
|
||||
IT_IS_ALSO_NOT_FLESH_COLORED="It is also not flesh-colored.\n",
|
||||
CABINET_1="It appears to control a mechanical system.\n",
|
||||
CABINET_2="It appears to control a valve system.\n",
|
||||
CABINET_3="It appears to control an electrical system.\n",
|
||||
CABINET_4="It appears to control this dream machine.\n",
|
||||
CABINET_5="It appears to control this spray system.\n",
|
||||
CABINET_6="It appears to control the ruby lens system.\n",
|
||||
CABINET_7="It appears to control the cistern valves.\n",
|
||||
YOU_CANNOT_DECIPHER_WHAT_IT_CONTROLS="You cannot decipher what it controls.\n",
|
||||
IT_APPEARS_TO_BE_LOOSE="It appears to be loose.\n",
|
||||
IT_APPEARS_TO_BE_BROKEN="It appears to be broken.\n",
|
||||
THESE_APPEAR_TO_BE_MECHANICAL_CONTROLS="These appear to be mechanical controls.\n",
|
||||
THESE_APPEAR_TO_BE_VALVE_CONTROLS="These appear to be valve controls.\n",
|
||||
THESE_APPEAR_TO_BE_ELECTRICAL_CONTROLS="These appear to be electrical controls.\n",
|
||||
IT_APPEARS_TO_CONTROL_A_DREAM_MACHINE="It appears to control a dream machine.\n",
|
||||
IT_APPEARS_TO_CONTROL_A_SPRAY_SYSTEM="It appears to control a spray system.\n",
|
||||
IT_APPEARS_TO_CONTROL_THE_RUBY_LENS_SYSTEM="It appears to control the ruby lens system.\n",
|
||||
IT_APPEARS_TO_CONTROL_THE_CISTERN_VALVES="It appears to control the cistern valves.\n",
|
||||
YOU_CANNOT_DECIPHER_ITS_PURPOSE="You cannot decipher its purpose.\n",
|
||||
THE_PANEL_IS_LOOSE="The panel is loose.\n",
|
||||
THE_PANEL_IS_BROKEN="The panel is broken.\n",
|
||||
THE_PANEL_IS_NOT_INSTALLED="The panel is not installed.\n",
|
||||
IT_IS_LOADED_WITH="It's loaded with %s",
|
||||
AND_HAS_1_CHARGE_LEFT=", and has 1 charge left.\n",
|
||||
AND_HAS_N_CHARGES_LEFT=", and has %d charges left.\n",
|
||||
COMBINATION="Combination",
|
||||
RIFLE="Rifle",
|
||||
SHOTGUN="Shotgun",
|
||||
IT_IS_SET_TO="It is set to '%s'",
|
||||
IT_SEEMS_TO_BE_LOOSE="\nIt seems to be loose.\n",
|
||||
IT_IS_NOT_INSTALLED="\nIt is not installed.\n",
|
||||
PLENTY_OF="\nPlenty of ",
|
||||
IT_HAS_N_MORE_MINUTES_OF="\nIt has %d more minutes of ",
|
||||
ITS_ALMOST_OUT_OF="\nIt's almost out of \n",
|
||||
NO="\nNo ",
|
||||
FUEL="fuel.\n",
|
||||
WICK="wick.\n",
|
||||
IT_IS_APPARENTLY_RUSTED_SHUT="It is apparently rusted shut.\n",
|
||||
IT_IS_APPARENTLY_LOCKED="It is apparently locked.\n",
|
||||
THE_SWITCH_IS_FASTENED="The switch is fastened.\n",
|
||||
THIS_SWITCH_CANNOT_BE_FIXED="This switch cannot be fixed.\n",
|
||||
THE_SWITCH_IS_LOOSE="The switch is loose.\n",
|
||||
THE_DRILL_MUST_BE_INSTALLED_ONTO_A_DRILL_CART="The drill must be installed onto a drill cart.\n",
|
||||
THE_DRILLS_POWER_IS_CONNECTED="The drill's power is connected.\n",
|
||||
IT_MUST_BE_REPAIRED_FIRST="It must be repaired first.\n",
|
||||
PANELS_ARE_ONLY_INSTALLED_ONTO_CABINETS="Panels are only installed onto cabinets.\n",
|
||||
THIS_CABINET_REQUIRES_A_DIFFERENT_TYPE_OF_PANEL="This cabinet requires a different type of panel.\n",
|
||||
THE_PANEL_IS_FASTENED="The panel is fastened.\n",
|
||||
YOU_GET_TWO_HANDFULS_OF_OXIUM_FROM_THE_BIN="You get two handfuls of oxium from the bin.\n",
|
||||
WHICH_SECTION_OF_RAIL_NEEDS_FIXING="Which section of rail needs fixing -\n",
|
||||
THE_WORK_IS_TO_PRECISE_TO_PERFORM_TELEKINETICALLY="The work is too precise to perform telekinetically.\n",
|
||||
THE_CABLE_DOES_NOT_NEED_REPLACEMENT="The cable does not need replacement.\n",
|
||||
OUT_OF_AMMUNITION="Out of ammunition!\n",
|
||||
OUT_OF_ARROWS="Out of arrows!\n",
|
||||
OVERCOME_BY_YOUR_WOUNDS_YOU_FALL_UNCONSCIOUS="\nOvercome by your wounds, you fall unconscious..... \n",
|
||||
YOU_AWAKEN_BACK_AT_FEELING_RESTORED="\n....You awaken back at %s, feeling restored.\n",
|
||||
THE_SPACE_CAPSULE="the space capsule",
|
||||
THE_OLYMPUS_MINE="the Olympus mine",
|
||||
IT_WONT_GO_IN_THAT_DIRECTION="It won't go in that direction!\n",
|
||||
IT_TURNS_LOOSELY="It turns loosely.\n",
|
||||
THERE_IS_NOTHING_TO_DRILL_INTO="There is nothing to drill into.\n",
|
||||
THERE_IS_NO_ROOM_LEFT_FOR_THE_ORE="There is no room left for the ore.\n",
|
||||
YOU_PUT_THE_ORE_INTO_THE_WHEELBARROW="You put the %s into the wheelbarrow.\n",
|
||||
YOU_PUT_THE_ORE_INTO_THE_RAIL_CAR="You put the %s into the rail car.\n",
|
||||
THERE_IS_NO_MORE_ROOM="There is no more room.\n",
|
||||
YOU_CANT_MIX_DIFFERENT_THINGS_IN_THE_SAME_LOAD="You can't mix different things in the same load!\n",
|
||||
THERE_IS_NOTHING_TO_UNLOAD="There is nothing to unload.\n",
|
||||
THE_COAL_BEGINS_MOVING_DOWN_THE_BELT="The coal begins moving down the belt.\n",
|
||||
OOOPS_THESE_ROLLERS_CAN_NEVER_BE_FIXED="Ooops. These rollers can never be fixed!\n",
|
||||
STOKERS_PATH_IS_BLOCKED="Stoker's path is blocked!\n",
|
||||
THE_CONVEYOR_BELT_STOPS="The conveyor belt stops.\n",
|
||||
ACTOR_DIVIDES="%s divides!\n",
|
||||
ACTOR_CRITICAL="`%s critical!\n",
|
||||
ACTOR_HEAVILY_WOUNDED="`%s heavily wounded.\n",
|
||||
MAN="man",
|
||||
WOMAN="woman",
|
||||
HOW_DARE_YOU_YOUNG_PERSON="How dare you, young %s!\n",
|
||||
ACTOR_GRAZED="`%s grazed.\n",
|
||||
ACTOR_ATTACKS="`%s attacks!\n",
|
||||
ACTOR_PARALYZED="`%s paralyzed!\n",
|
||||
ACTOR_CHARMED="%s charmed!\n",
|
||||
ACTOR_DODGES="%s dodges!\n",
|
||||
BECOMES_VISIBLE="`%s becomes visible!\n",
|
||||
HEAVILY="heavily",
|
||||
LIGHTLY="lightly",
|
||||
BARELY="barely",
|
||||
DAMAGED="damaged",
|
||||
WOUNDED="wounded",
|
||||
ACTOR_HIT_MESSAGE="`%s %s %s.\n",
|
||||
OUT_OF_RANGE="Out of range!\n",
|
||||
YOUR_HANDS_ARE_FULL="\nYour hands are full.\n",
|
||||
WONT_BUDGE="Won't budge !\n",
|
||||
THE_TOTAL_IS_TOO_HEAVY="\nThe total is too heavy.\n",
|
||||
THAT_IS_NOT_POSSIBLE="That is not possible.\n",
|
||||
AFFIDAVIT="--Affidavit--\n\nThe undersigned do hereby vouch for the trust-\nworthiness of %s, who bears this chit, commending same to the members of the Olympus Mons outpost.\n\n*Signed:\n%s\n*",
|
||||
YOU_CANT_READ_IT="You can't read it.\n",
|
||||
YOU_NEED_A_POOL_CUE="You need a cue stick in your hands.\n",
|
||||
GOOD_SHOT_OLD_BEAN="Good shot, old bean!\n",
|
||||
THE_ROBOT_ALREADY_HAS_A_HEARTSTONE="The robot already has a heartstone.\n",
|
||||
THE_HEARTSTONE_IS_INSTALLED="The heartstone is installed.\n",
|
||||
THE_ALIEN_DEVICE_DOESNT_SEEM_TO_BE_FUNCTIONING="The alien device doesn't seem to be functioning.\n",
|
||||
NOTHING_APPEARS_TO_HAPPEN="Nothing appears to happen.\n",
|
||||
YOU_MUST_BE_IN_PARTY_MODE_TO_ENTER="You must be in party mode to enter.\n",
|
||||
YOU_MUST_BE_IN_PARTY_MODE_TO_LEAVE="You must be in party mode to leave.\n",
|
||||
THIS_DOOR_IS_NOT_RUSTED="This door is not rusted.\n",
|
||||
THE_DOOR_IS_UNSTUCK="The door is unstuck.\n",
|
||||
YOU_SEE_YOURSELF="You see yourself.\n",
|
||||
YOU_RECEIVE_A_MOMENTARY_IMPRESSION="You receive a momentary impression of a house falling on you.\n",
|
||||
THIS_WAS_WORN_LAST_BY_A_DYING_MAN="This was worn last by a dying man.\n",
|
||||
THIS_WAS_USED_BY_A_MARTIAN_MEASURING_TIME="This was used by a Martian whose entire life focussed on measuring time.\n",
|
||||
THIS_JEWELRY_WAS_WORN_BY="This jewelry was worn by a distinguished Martian, a mayor or \"Agrarian&.\n",
|
||||
THESE_FOOTBAGS_WERE_WORN_BY="These footbags were worn by an elderly, distinguished Martian whose job, \"Gatherer&, has no human analog - a combination of undertaker, dustman, and treasurer.\n",
|
||||
THIS_SAW_WAS_USED_BY="This saw was used by a Martian doctor, or \"Arborist&, for surgery.\n",
|
||||
THIS_DEVICE_WAS_USED_BY="This device was used by a Martian doctor, or \"Arborist&, on patients.\n",
|
||||
THIS_SCULPTURE_HAD_GREAT_RITUAL_OR_RELIGIOUS_SIGNIFICANCE="This sculpture had great ritual or religious significance to a city, or \"Grove&, of Martians. The image is of \"very proud soil&.",
|
||||
YOU_RECIEVE_NO_PSYCHIC_IMPRESSIONS="You receive no psychic impressions.\n",
|
||||
THE_RADIUM_HAS_BEEN_INSTALLED="The radium has been installed.\n",
|
||||
RADIUM_HAS_ALREADY_BEEN_INSTALLED="Radium has already been installed.\n",
|
||||
THE_OBJ_IS_FULLY_CHARGED="The %s is fully charged.\n",
|
||||
THE_OBJ_ONLY_NEEDED_N_RADIUM_BLOCKS="The %s only needed %d radium blocks.\n",
|
||||
THE_HEADGEAR_IS_INSTALLED="The headgear is installed.\n",
|
||||
YOU_ARE_COMPLETELY_UNSURE_WHAT_YOU_JUST_DID="You are completely unsure what you just did.\n",
|
||||
LIGHTS_FLASH_AND_CHANGE_COLOR_BUT_NOTHING_ELSE_HAPPENS="Lights flash and change color but nothing else happens.\n",
|
||||
STATUS_LIGHTS_CHANGE_BUT_YOU_SEE_NO_OTHER_EFFECT="Status lights change but you see no other effect.\n",
|
||||
YOU_ACTUATE_THE_MECHANISM_TO_NO_APPARENT_EFFECT="You actuate the mechanism to no apparent effect.\n",
|
||||
THE_DREAM_MACHINES_SEEM_TO_HAVE_CEASED_FUNCTIONING="The dream machines seem to have ceased functioning.\n",
|
||||
THE_MACHINE_DOES_NOT_WORK="The machine does not work.\n",
|
||||
THERE_IS_NOBODY_SITTING_IN_THE_MACHINE="There is nobody sitting in the machine.\n",
|
||||
ACTOR_DREAMS_UNTIL_DAWN_WHILE_THE_PARTY_WAITS="%s dreams until dawn while the party waits.\n",
|
||||
YOU_TRY_TO_WAKE_YOURSELF_UP="You try to wake yourself up.\n",
|
||||
YOU_WAKE_UP="You wake up.\n",
|
||||
YOU_ARENT_YET_THAT_INSANE="You aren't yet that insane.\n",
|
||||
NO_BACKTALK_FROM_YOU_YOUNG_MAN="No backtalk from you, young man!\n",
|
||||
NO_BACKTALK_FROM_YOU_YOUNG_WOMAN="No backtalk from you, young man!\n",
|
||||
YOU_FALL_OFF_THE_CLIFF="You fall off the cliff!\n",
|
||||
YOU_SHAKE_YOURSELF_AWAKE_FROM_THE_NIGHTMARE="You shake yourself awake from the nightmare.\n",
|
||||
YOU_FEEL_YOUR_DREAM_CONSCIOUSNESS_RETURNING="You feel your dream consciousness returning.\n",
|
||||
WHAT_AN_ODD_LEVER="What an odd lever!\n",
|
||||
STRANGELY_NOTHING_HAPPENS="Strangely, nothing happens.\n",
|
||||
STRANGELY_IT_DOESNT_MOVE="Strangely, it doesn't move.\n",
|
||||
THE_POD_SPLITS_OPEN="The pod splits open!\n",
|
||||
THE_ICE_THAWS="The ice thaws.\n",
|
||||
THE_WATER_FREEZES="The water freezes.\n",
|
||||
ATTACK_WITH_BARE_HANDS="Attack with bare hands-",
|
||||
ATTACK_WITH_WEAPON="Attack with %s-",
|
||||
FASTER="...faster!\n",
|
||||
YOU_IMAGINE="You imagine ",
|
||||
SPRAY_GUN_GREEN_PAINT="The spray gun now contains 20 charges of green paint.\n",
|
||||
SPRAY_GUN_WEED_KILLER="The spray gun now contains 10 charges of weed killer.\n",
|
||||
SPRAY_GUN_10_MORE_CHARGES="The spray gun has 10 more charges.\n",
|
||||
THERE_IS_NOTHING_IN_THE_GUN="There is nothing in the gun.\n",
|
||||
YOU_KILLED_THE_PLANT="You killed the plant.\n",
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
YOU_SEE="guardare %s",
|
||||
ON="Su - ",
|
||||
TO="A - ",
|
||||
NOTHING="nessuna cosa!\n",
|
||||
NO_EFFECT="\nNessun effetto\n",
|
||||
IT_IS_STUCK="Si e bloccato.\n"
|
||||
}
|
||||
405
devtools/create_ultima/files/ultima6/scripts/md/look.lua
Normal file
405
devtools/create_ultima/files/ultima6/scripts/md/look.lua
Normal file
@@ -0,0 +1,405 @@
|
||||
function look_pocketwatch(obj)
|
||||
printl("THE_TIME_IS")
|
||||
local am = true
|
||||
local hour = clock_get_hour()
|
||||
local minute = clock_get_minute()
|
||||
if hour >= 12 then
|
||||
am = false
|
||||
end
|
||||
if hour > 12 then
|
||||
hour = hour - 12
|
||||
end
|
||||
local time = "TIME_AM"
|
||||
if am == false then
|
||||
time = "TIME_PM"
|
||||
end
|
||||
|
||||
printfl(time, hour, minute)
|
||||
end
|
||||
|
||||
function look_cannon(obj)
|
||||
if obj.quality ~= 0 then
|
||||
printl("THE_CANNON_WILL_FIRE_STEEL_CANNON_BALLS")
|
||||
end
|
||||
end
|
||||
|
||||
function look_barrow(obj)
|
||||
if obj.qty == 0 then
|
||||
printl("IT_IS_EMPTY")
|
||||
return
|
||||
end
|
||||
|
||||
local quality = obj.quality
|
||||
local material
|
||||
if quality == 1 then
|
||||
material = i18n("DIRT")
|
||||
elseif quality == 2 then
|
||||
material = i18n("ROCK")
|
||||
elseif quality == 3 then
|
||||
material = i18n("IRON_ORE")
|
||||
elseif quality == 4 then
|
||||
material = i18n("COAL")
|
||||
end
|
||||
|
||||
if obj.qty == 1 then
|
||||
printfl("IT_HAS_1_LOAD_OF", material)
|
||||
else
|
||||
printfl("IT_HAS_N_LOADS_OF", obj.qty, material)
|
||||
end
|
||||
end
|
||||
|
||||
function get_lat_long_string(x, y)
|
||||
local lat_str = "N"
|
||||
local long_str = "W"
|
||||
|
||||
local lat = math.modf(((y - 512) * 240) / 1024)
|
||||
local long = math.modf(((x - 512) * 360) / 1024)
|
||||
|
||||
if lat > 0 then
|
||||
lat_str = "S"
|
||||
else
|
||||
if lat == 0 then
|
||||
lat_str = " "
|
||||
end
|
||||
end
|
||||
|
||||
if long == 180 or long == -180 or long == 0 then
|
||||
long_str = " "
|
||||
else
|
||||
if long < 0 then
|
||||
long_str = "E"
|
||||
end
|
||||
end
|
||||
|
||||
lat = math.abs(lat)
|
||||
long = 180 - math.abs(long)
|
||||
|
||||
return lat..lat_str.." "..long..long_str
|
||||
end
|
||||
|
||||
function look_marker_flag(obj)
|
||||
local names = {
|
||||
[1]="Coprates Chasma",
|
||||
[2]="Arsia Mons",
|
||||
[3]="Pavonis Mons",
|
||||
[4]="Ascraeus Mons",
|
||||
[5]="Alber Tholus",
|
||||
[6]="Elysium Mons",
|
||||
[7]="Hecates Tholus",
|
||||
[8]="Terra Sirenum",
|
||||
[9]="Noctis Labyrinthus",
|
||||
[10]="Deuteronicus Mensae",
|
||||
[11]="Syrtis Major Planum",
|
||||
[12]="Olympus Mons",
|
||||
}
|
||||
|
||||
if obj.z == 0 then
|
||||
if obj.quality <= 12 then
|
||||
if obj.quality ~= 0 then
|
||||
print(names[obj.quality])
|
||||
print(" "..get_lat_long_string(obj.x,obj.y).."\n")
|
||||
end
|
||||
else
|
||||
printl("AARGH")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function look_broken_strap(obj)
|
||||
local spector = Actor.get(2)
|
||||
Actor.set_talk_flag(spector, 6)
|
||||
Actor.talk(spector)
|
||||
end
|
||||
|
||||
function look_metal_woman(obj)
|
||||
if obj.quality ~= 0 then
|
||||
printl("IT_HAS_A_HEARTSTONE")
|
||||
end
|
||||
end
|
||||
|
||||
function look_covered_martian_seed(obj)
|
||||
if obj.frame_n < 4 then
|
||||
local quality = obj.quality
|
||||
if quality == 15 then
|
||||
printl("IT_IS_GROWING")
|
||||
elseif quality == 16 then
|
||||
printl("IT_IS_RIPE")
|
||||
else
|
||||
printl("IT_IS_NOT_GROWING")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function look_sprayer_system(obj)
|
||||
local quality = obj.quality
|
||||
|
||||
if bit32.btest(quality, 1) then
|
||||
local actor = Actor.get(0x3e)
|
||||
if Actor.get_talk_flag(actor, 5) == true then
|
||||
if bit32.btest(quality, 2) then
|
||||
printl("IT_IS_READY_TO_USE")
|
||||
else
|
||||
printl("THE_RUBBER_IN_THE_SPRAYER_SYSTEM_IS_NOT_FLESH_COLORED")
|
||||
end
|
||||
else
|
||||
printl("IT_IS_READY_TO_USE")
|
||||
end
|
||||
else
|
||||
printl("THERE_IS_NO_RUBBER_IN_THE_SPRAYER_SYSTEM")
|
||||
if Actor.get_talk_flag(actor, 5) == true and bit32.btest(quality, 2) == false then
|
||||
printl("IT_IS_ALSO_NOT_FLESH_COLORED")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function look_cabinet(obj)
|
||||
local quality = obj.quality
|
||||
if quality == 0 or quality > 7 then
|
||||
printl("YOU_CANNOT_DECIPHER_WHAT_IT_CONTROLS")
|
||||
else
|
||||
printl("CABINET_"..quality)
|
||||
end
|
||||
end
|
||||
|
||||
function look_tracking_motor(obj)
|
||||
local quality = obj.quality
|
||||
|
||||
if bit32.btest(quality, 1) and obj.on_map == true then
|
||||
printl("IT_APPEARS_TO_BE_LOOSE")
|
||||
end
|
||||
|
||||
if bit32.btest(quality, 2) then
|
||||
printl("IT_APPEARS_TO_BE_BROKEN")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function look_panel(obj)
|
||||
local qty = obj.qty
|
||||
if qty == 0 then
|
||||
local frame_n = obj.frame_n
|
||||
if frame_n == 0 then
|
||||
printl("THESE_APPEAR_TO_BE_MECHANICAL_CONTROLS")
|
||||
elseif frame_n == 1 then
|
||||
printl("THESE_APPEAR_TO_BE_VALVE_CONTROLS")
|
||||
elseif frame_n == 2 then
|
||||
printl("THESE_APPEAR_TO_BE_ELECTRICAL_CONTROLS")
|
||||
end
|
||||
elseif qty == 4 then
|
||||
printl("IT_APPEARS_TO_CONTROL_A_DREAM_MACHINE")
|
||||
elseif qty == 5 then
|
||||
printl("IT_APPEARS_TO_CONTROL_A_SPRAY_SYSTEM")
|
||||
elseif qty == 6 then
|
||||
printl("IT_APPEARS_TO_CONTROL_THE_RUBY_LENS_SYSTEM")
|
||||
elseif qty == 7 then
|
||||
printl("IT_APPEARS_TO_CONTROL_THE_CISTERN_VALVES")
|
||||
else
|
||||
printl("YOU_CANNOT_DECIPHER_ITS_PURPOSE")
|
||||
end
|
||||
|
||||
local quality = obj.quality
|
||||
if bit32.btest(quality, 1) and obj.on_map == true then
|
||||
printl("THE_PANEL_IS_LOOSE")
|
||||
end
|
||||
|
||||
if bit32.btest(quality, 2) then
|
||||
printl("THE_PANEL_IS_BROKEN")
|
||||
end
|
||||
end
|
||||
|
||||
function print_number_of_charges(qty)
|
||||
if qty == 1 then
|
||||
printl("AND_HAS_1_CHARGE_LEFT")
|
||||
else
|
||||
printfl("AND_HAS_N_CHARGES_LEFT", qty)
|
||||
end
|
||||
end
|
||||
|
||||
function look_portable_sprayer(obj)
|
||||
local contents
|
||||
if obj.quality == 0 then
|
||||
contents = tile_get_description(649)
|
||||
else
|
||||
contents = tile_get_description(640)
|
||||
end
|
||||
|
||||
printfl("IT_IS_LOADED_WITH", contents)
|
||||
print_number_of_charges(obj.qty)
|
||||
end
|
||||
|
||||
function get_weapon_mode_string(obj)
|
||||
local mode
|
||||
local quality = obj.quality
|
||||
if quality == 0 then
|
||||
mode = i18n("COMBINATION")
|
||||
elseif quality == 1 then
|
||||
mode = i18n("RIFLE")
|
||||
else
|
||||
mode = i18n("SHOTGUN")
|
||||
end
|
||||
|
||||
return mode
|
||||
end
|
||||
|
||||
function look_ray_gun(obj)
|
||||
printfl("IT_IS_SET_TO", get_weapon_mode_string(obj))
|
||||
print_number_of_charges(obj.qty)
|
||||
end
|
||||
|
||||
function look_belgian_combine(obj)
|
||||
printfl("IT_IS_SET_TO", get_weapon_mode_string(obj))
|
||||
print(".\n")
|
||||
end
|
||||
|
||||
function look_switch_bar(obj)
|
||||
local quality = obj.quality
|
||||
if quality == 1 then
|
||||
printl("IT_SEEMS_TO_BE_LOOSE")
|
||||
elseif quality == 2 then
|
||||
printl("IT_IS_NOT_INSTALLED")
|
||||
end
|
||||
end
|
||||
|
||||
function look_light_source(obj)
|
||||
local obj_n = obj.obj_n
|
||||
local qty = obj.qty
|
||||
local quality = obj.quality
|
||||
|
||||
if (obj_n == 109 or obj_n == 110) and qty > 1 then
|
||||
return
|
||||
end
|
||||
|
||||
if quality > 30 then
|
||||
printl("PLENTY_OF")
|
||||
elseif quality > 6 and quality <= 30 then
|
||||
printfl("IT_HAS_N_MORE_MINUTES_OF", quality)
|
||||
elseif quality > 0 and quality <= 6 then
|
||||
printl("ITS_ALMOST_OUT_OF")
|
||||
elseif obj_n == 115 or obj_n == 117 or obj_n == 116 or obj_n == 118 then
|
||||
printl("NO")
|
||||
else
|
||||
printl("PLENTY_OF")
|
||||
end
|
||||
|
||||
if obj_n == 115 or obj_n == 117 or obj_n == 116 or obj_n == 118 then
|
||||
printl("FUEL")
|
||||
else
|
||||
printl("WICK")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function look_door(obj)
|
||||
local quality = obj.quality
|
||||
if quality >= 128 then
|
||||
quality = quality - 128
|
||||
if quality >= 64 then
|
||||
printl("IT_IS_APPARENTLY_RUSTED_SHUT")
|
||||
else
|
||||
printl("IT_IS_APPARENTLY_LOCKED")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function look_obelisk(obj)
|
||||
if obj.quality == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local ui_style = game_get_ui_style()
|
||||
|
||||
canvas_show()
|
||||
canvas_hide_all_sprites()
|
||||
canvas_set_opacity(0xff);
|
||||
canvas_set_update_interval(25)
|
||||
canvas_rotate_game_palette(true)
|
||||
|
||||
local obelisk = sprite_new(nil, 184, 0, true)
|
||||
|
||||
local text_sprite
|
||||
--local text_sprite_bg
|
||||
|
||||
if ui_style == UI_STYLE_ORIG then
|
||||
canvas_set_solid_bg(false)
|
||||
else
|
||||
text_sprite = sprite_new(nil, 8, 164, true)
|
||||
text_sprite.text_align = 2
|
||||
text_sprite.text_color = 15
|
||||
text_sprite.text = "Obelisk."
|
||||
obelisk.x = 96
|
||||
obelisk.y = 41
|
||||
end
|
||||
|
||||
obelisk.image = image_load("mdream.lzc", obj.quality-1)
|
||||
|
||||
local input = nil
|
||||
while input == nil do
|
||||
canvas_update()
|
||||
input = input_poll()
|
||||
if input ~= nil then
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
canvas_set_solid_bg(true)
|
||||
canvas_rotate_game_palette(false)
|
||||
canvas_hide()
|
||||
end
|
||||
|
||||
local look_usecode = {
|
||||
[45]=look_belgian_combine,
|
||||
[91]=look_pocketwatch,
|
||||
[98]=look_pocketwatch,
|
||||
[109]=look_light_source, -- OBJ_TORCH
|
||||
[110]=look_light_source, -- OBJ_LIT_TORCH
|
||||
[111]=look_light_source, -- OBJ_CANDLESTICK
|
||||
[112]=look_light_source, -- OBJ_LIT_CANDLE
|
||||
[113]=look_light_source, -- OBJ_CANDELABRA
|
||||
[114]=look_light_source, -- OBJ_LIT_CANDELABRA
|
||||
[115]=look_light_source, -- OBJ_OIL_LAMP
|
||||
[116]=look_light_source, -- OBJ_LIT_OIL_LAMP
|
||||
[117]=look_light_source, -- OBJ_LANTERN
|
||||
[118]=look_light_source, -- OBJ_LIT_LANTERN
|
||||
[129]=look_portable_sprayer, --OBJ_WEED_SPRAYER
|
||||
[172]=look_marker_flag,
|
||||
[179]=look_door, --OBJ_CLOSED_DOOR
|
||||
[227]=look_door, --OBJ_DOOR3
|
||||
[240]=look_ray_gun, --OBJ_HEAT_RAY_GUN
|
||||
[241]=look_ray_gun, --OBJ_FREEZE_RAY_GUN
|
||||
[251]=look_covered_martian_seed,
|
||||
[261]=look_portable_sprayer, --OBJ_SPRAY_GUN
|
||||
[268]=look_barrow, --OBJ_MARTIAN_WHEEL_BARROW
|
||||
[276]=look_sprayer_system,
|
||||
[287]=look_metal_woman,
|
||||
[292]=look_obelisk,
|
||||
[314]=look_tracking_motor,
|
||||
[333]=look_cannon,
|
||||
[410]=look_barrow, --OBJ_RAIL_CAR
|
||||
[411]=look_switch_bar,
|
||||
[457]=look_cabinet,
|
||||
[458]=look_panel,
|
||||
[460]=look_broken_strap,
|
||||
}
|
||||
|
||||
function look_obj(obj)
|
||||
printfl("YOU_SEE", obj.look_string);
|
||||
|
||||
--FIXME usecode look description should be lua code.
|
||||
if usecode_look(obj) then
|
||||
print("\n")
|
||||
return false
|
||||
end
|
||||
|
||||
print(".\n\n");
|
||||
|
||||
if look_usecode[obj.obj_n] ~= nil then
|
||||
look_usecode[obj.obj_n](obj)
|
||||
print("\n")
|
||||
end
|
||||
|
||||
if is_container_obj(obj.obj_n) then
|
||||
search(obj)
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
349
devtools/create_ultima/files/ultima6/scripts/md/player.lua
Normal file
349
devtools/create_ultima/files/ultima6/scripts/md/player.lua
Normal file
@@ -0,0 +1,349 @@
|
||||
local PLAYER_CAN_MOVE = 0
|
||||
local PLAYER_BLOCKED = 1
|
||||
local PLAYER_FORCE_MOVE = 2
|
||||
|
||||
local map_entrance_tbl = {
|
||||
{x=0x43, y=0x51, z=0x1},
|
||||
{x=0x80, y=0x8D, z=0x0},
|
||||
{x=0x76, y=0x0F2, z=0x3},
|
||||
{x=0x7A, y=0x0C, z=0x3},
|
||||
{x=0x9A, y=0x41, z=0x4},
|
||||
{x=0x2B2, y=0x1CC, z=0x0},
|
||||
{x=0x73, y=0x40, z=0x4},
|
||||
{x=0x29D, y=0x1CE, z=0x0},
|
||||
{x=0x0B3, y=0x0E1, z=0x4},
|
||||
{x=0x27B, y=0x1F1, z=0x0},
|
||||
{x=0x0C3, y=0x70, z=0x1},
|
||||
{x=0x0CB, y=0x1D1, z=0x0},
|
||||
{x=0x24, y=0x0F1, z=0x1},
|
||||
{x=0x31A, y=0x232, z=0x0},
|
||||
{x=0x5C, y=0x0F1, z=0x1},
|
||||
{x=0x34C, y=0x25A, z=0x0},
|
||||
{x=0x7C, y=0x28, z=0x4},
|
||||
{x=0x13E, y=0x118, z=0x0},
|
||||
{x=0x0A, y=0x61, z=0x5},
|
||||
{x=0x3B7, y=0x1C4, z=0x0},
|
||||
{x=0x5C, y=0x0B1, z=0x5},
|
||||
{x=0x3DC, y=0x1DD, z=0x0},
|
||||
{x=0x5E, y=0x29, z=0x4},
|
||||
{x=0x227, y=0x1ab, z=0x0}
|
||||
}
|
||||
|
||||
local pod_teleport_tbl = {
|
||||
{x=0xCA, y=0x295},
|
||||
{x=0x34D, y=0x295},
|
||||
{x=0x13A, y=0x17A},
|
||||
{x=0x2CD, y=0x1FA}
|
||||
}
|
||||
|
||||
function player_pass()
|
||||
printl("PASS")
|
||||
update_conveyor_belt(true)
|
||||
end
|
||||
|
||||
--returns true if the player can move to rel_x, rel_y
|
||||
function player_before_move_action(rel_x, rel_y)
|
||||
if rel_x ~= 0 and rel_y ~= 0 then
|
||||
return PLAYER_CAN_MOVE
|
||||
end
|
||||
|
||||
local player_loc = player_get_location()
|
||||
|
||||
if rel_x == 0 and rel_y == 1 then
|
||||
local tile_num = map_get_tile_num(player_loc)
|
||||
-- Fall off cliff logic
|
||||
if tile_num >= 384 and tile_num <= 387 then
|
||||
return PLAYER_FORCE_MOVE
|
||||
end
|
||||
end
|
||||
|
||||
local z = player_loc.z
|
||||
local x = wrap_coord(player_loc.x+rel_x,z)
|
||||
local y = wrap_coord(player_loc.y+rel_y,z)
|
||||
|
||||
for obj in objs_at_loc(x, y, z) do
|
||||
local obj_n = obj.obj_n
|
||||
if obj_n == 268 then --wheelbarrow
|
||||
move_wheelbarrow(obj, rel_x, rel_y)
|
||||
if can_move_obj(obj, rel_x, rel_y) then
|
||||
obj.x = obj.x + rel_x
|
||||
obj.y = obj.y + rel_y
|
||||
end
|
||||
elseif obj_n == 410 and can_move_obj(obj, rel_x, rel_y) then --railcar
|
||||
move_rail_cart(obj, rel_x, rel_y)
|
||||
elseif obj_n == 441 then --assembled drill
|
||||
move_drill(obj, rel_x, rel_y) --update drill direction
|
||||
if can_move_drill(obj, rel_x, rel_y) then
|
||||
obj.x = obj.x + rel_x
|
||||
obj.y = obj.y + rel_y
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return PLAYER_CAN_MOVE
|
||||
end
|
||||
|
||||
function update_objects_around_party()
|
||||
local loc = player_get_location()
|
||||
for obj in find_obj_from_area(wrap_coord(loc.x - 5, loc.z), wrap_coord(loc.y - 5, loc.z), loc.z, 11, 11) do
|
||||
local obj_n = obj.obj_n
|
||||
if (obj_n == 227 and Actor.get_talk_flag(0x73, 2)) or --OBJ_DOOR3
|
||||
(obj_n == 179 and Actor.get_talk_flag(0x73, 4)) then --OBJ_CLOSED_DOOR
|
||||
if bit32.band(obj.quality, 0x80) == 0 then -- check if the door is stuck
|
||||
local base_frame = bit32.band(obj.frame_n, 2)
|
||||
local actor = map_get_actor(obj.xyz)
|
||||
if actor ~= nil then
|
||||
if map_is_on_screen(obj.xyz) then
|
||||
play_door_sfx()
|
||||
end
|
||||
obj.frame_n = base_frame + 9
|
||||
else
|
||||
actor = map_get_actor(obj.x + movement_offset_x_tbl[base_frame + 1], obj.y + movement_offset_y_tbl[base_frame + 1], obj.z)
|
||||
if actor == nil then
|
||||
actor = map_get_actor(obj.x + movement_offset_x_tbl[base_frame + 4 + 1], obj.y + movement_offset_y_tbl[base_frame + 4 + 1], obj.z)
|
||||
end
|
||||
|
||||
if actor ~= nil and map_is_on_screen(obj.xyz) then
|
||||
play_door_sfx()
|
||||
if obj.frame_n < 4 then
|
||||
obj.frame_n = (base_frame) + 5
|
||||
elseif obj.frame_n < 8 then
|
||||
obj.frame_n = (base_frame) + 1
|
||||
else
|
||||
obj.frame_n = (base_frame) + 5
|
||||
end
|
||||
else
|
||||
if obj.frame_n == 5 then
|
||||
obj.frame_n = 1
|
||||
elseif obj.frame_n == 7 then
|
||||
obj.frame_n = 3
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
elseif obj_n == 301 then --OBJ_REFLECTIVE_SURFACE
|
||||
if obj.frame_n < 3 then
|
||||
local actor = map_get_actor(obj.x, obj.y + 1, obj.z)
|
||||
if actor ~= nil then
|
||||
local actor_num = actor.actor_num
|
||||
if actor_num >= 0x70 or actor_num == 0x5d or (actor_num >= 0x6a and actor_num <= 0x6c) then
|
||||
obj.frame_n = 0
|
||||
elseif (actor_num < 0x20 and actor_num ~= 6)
|
||||
or (actor_num >= 0x2a and actor_num <= 0x5c)
|
||||
or actor_num == 0x60 or actor_num == 0x69 or actor_num == 0x6d then
|
||||
obj.frame_n = 1
|
||||
else
|
||||
obj.frame_n = 2
|
||||
end
|
||||
else
|
||||
obj.frame_n = 0
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function player_post_move_action(did_move)
|
||||
local player_loc = player_get_location()
|
||||
|
||||
if did_move then
|
||||
if map_get_tile_num(player_loc, true) == 0x6f then
|
||||
printl("FASTER")
|
||||
--FIXME update falling brick animation speed here.
|
||||
end
|
||||
|
||||
update_conveyor_belt(true)
|
||||
update_objects_around_party()
|
||||
|
||||
for obj in objs_at_loc(player_loc) do
|
||||
local obj_n = obj.obj_n
|
||||
if (obj_n == 175 or obj_n == 163 or obj_n == 180 or obj_n == 178 or (obj_n == 197 and obj.frame_n == 3) or obj_n == 210) then
|
||||
if player_is_in_solo_mode() then
|
||||
if obj_n == 163 or obj_n == 178 then
|
||||
printl("YOU_MUST_BE_IN_PARTY_MODE_TO_LEAVE")
|
||||
else
|
||||
printl("YOU_MUST_BE_IN_PARTY_MODE_TO_ENTER")
|
||||
end
|
||||
return
|
||||
end
|
||||
if obj_n == 175 then --Mine entry
|
||||
for transfer_obj in objs_at_loc(player_loc.x, player_loc.y-1, player_loc.z) do
|
||||
transfer_obj.x = map_entrance_tbl[obj.quality].x
|
||||
transfer_obj.y = map_entrance_tbl[obj.quality].y-1
|
||||
transfer_obj.z = map_entrance_tbl[obj.quality].z
|
||||
end
|
||||
elseif obj_n == 163 then --Mine exit
|
||||
for transfer_obj in objs_at_loc(player_loc.x, player_loc.y+1, player_loc.z) do
|
||||
transfer_obj.x = map_entrance_tbl[obj.quality].x
|
||||
transfer_obj.y = map_entrance_tbl[obj.quality].y+2
|
||||
transfer_obj.z = map_entrance_tbl[obj.quality].z
|
||||
end
|
||||
elseif obj_n == 197 then
|
||||
if Actor.get_talk_flag(0x73, 4) then
|
||||
if obj.quality == 0 then
|
||||
printl("NOTHING_APPEARS_TO_HAPPEN")
|
||||
elseif obj.quality <= 4 then
|
||||
local pod_exit = pod_teleport_tbl[obj.quality]
|
||||
advance_time(0)
|
||||
party_use_entrance(player_loc.x, player_loc.y, player_loc.z, pod_exit.x, pod_exit.y, 0)
|
||||
end
|
||||
else
|
||||
printl("THE_ALIEN_DEVICE_DOESNT_SEEM_TO_BE_FUNCTIONING")
|
||||
end
|
||||
return
|
||||
end
|
||||
advance_time(0)
|
||||
party_use_entrance(player_loc.x, player_loc.y, player_loc.z, map_entrance_tbl[obj.quality])
|
||||
elseif obj_n == 461 then --OBJ_DREAM_TELEPORTER
|
||||
--FIXME add logic here.
|
||||
local obelisk = map_get_obj(player_loc.x, player_loc.y - 1, player_loc.z, 292, true)
|
||||
if obelisk ~= nil then
|
||||
--FIXME fade here.
|
||||
end
|
||||
local dream_actor = Actor.get(0)
|
||||
if bit32.band(obj.status, 0xe5) ~= 0xa5 or dream_actor.hp > 4 then
|
||||
if bit32.band(obj.status, 0xe5) == 0 then
|
||||
player_move(obj.quality, obj.qty, player_loc.z)
|
||||
advance_time(0)
|
||||
else
|
||||
dreamworld_cleanup_state(obj)
|
||||
end
|
||||
|
||||
end
|
||||
elseif obj_n == 462 then --OBJ_DREAM_TELEPORTER1 Walk on walls object
|
||||
local dream_actor = Actor.get(0)
|
||||
if obj.quality == 0 then
|
||||
dream_actor.frame_n = dream_actor.old_frame_n
|
||||
dream_actor.obj_n = dream_actor.base_obj_n
|
||||
else
|
||||
dream_actor.frame_n = 0
|
||||
if player_get_gender() == 0 then
|
||||
dream_actor.obj_n = 318
|
||||
else
|
||||
dream_actor.obj_n = 319
|
||||
end
|
||||
end
|
||||
elseif obj_n == 465 then --direction control modifier
|
||||
--FIXME
|
||||
end
|
||||
end
|
||||
else
|
||||
actor_map_dmg(Actor.get_player_actor(), player_loc.x, player_loc.y, player_loc.z)
|
||||
play_md_sfx(0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function can_move_drill(drill, rel_x, rel_y)
|
||||
if can_move_obj(drill, rel_x, rel_y) then
|
||||
return true
|
||||
end
|
||||
|
||||
local z = drill.z
|
||||
local x = wrap_coord(drill.x+rel_x,z)
|
||||
local y = wrap_coord(drill.y+rel_y,z)
|
||||
|
||||
if map_get_obj(x, y, z, 175, true) == nil then --mine entrance
|
||||
return false
|
||||
end
|
||||
|
||||
for obj in objs_at_loc(x, y, z) do
|
||||
if is_blood(obj.obj_n) == false then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
local player_readied_weapons
|
||||
function weapon_select()
|
||||
player_readied_weapons = {}
|
||||
local player = Actor.get_player_actor()
|
||||
for obj in actor_inventory(player) do
|
||||
if obj.readied and get_weapon_damage(obj) > 0 then
|
||||
player_readied_weapons[#player_readied_weapons+1] = obj
|
||||
end
|
||||
end
|
||||
|
||||
if #player_readied_weapons == 0 then
|
||||
printl("ATTACK_WITH_BARE_HANDS")
|
||||
return player
|
||||
else
|
||||
local weapon = player_readied_weapons[1]
|
||||
table.remove(player_readied_weapons, 1)
|
||||
printfl("ATTACK_WITH_WEAPON", weapon.name)
|
||||
return weapon
|
||||
end
|
||||
end
|
||||
|
||||
function select_next_weapon()
|
||||
if #player_readied_weapons == 0 then
|
||||
return nil
|
||||
end
|
||||
|
||||
local weapon = player_readied_weapons[1]
|
||||
table.remove(player_readied_weapons, 1)
|
||||
if weapon ~= nil then
|
||||
print("\n")
|
||||
printfl("ATTACK_WITH_WEAPON", weapon.name)
|
||||
end
|
||||
return weapon
|
||||
end
|
||||
|
||||
function select_attack_target()
|
||||
local target_loc = get_target()
|
||||
g_selected_obj = get_actor_or_obj_from_loc(target_loc)
|
||||
|
||||
local name
|
||||
if g_selected_obj ~= nil then
|
||||
name = g_selected_obj.name
|
||||
else
|
||||
name = tile_get_description(map_get_tile_num(target_loc))
|
||||
end
|
||||
print(name..".\n")
|
||||
|
||||
return target_loc
|
||||
end
|
||||
|
||||
function player_attack()
|
||||
local weapon = weapon_select()
|
||||
|
||||
repeat
|
||||
local target_loc = select_attack_target()
|
||||
if target_loc == nil then
|
||||
printl("WHAT")
|
||||
return
|
||||
end
|
||||
|
||||
player_attack_with_weapon(weapon, target_loc)
|
||||
weapon = select_next_weapon()
|
||||
until weapon == nil
|
||||
end
|
||||
|
||||
function player_attack_with_weapon(weapon, target_loc)
|
||||
local player = Actor.get_player_actor()
|
||||
local obj_n = weapon.obj_n
|
||||
|
||||
if out_of_ammo(player, weapon, true) then
|
||||
return
|
||||
end
|
||||
|
||||
if obj_n == 313 then --OBJ_M60_MACHINE_GUN
|
||||
--FIXME MACHINE GUN LOGIC HERE
|
||||
else
|
||||
local result = attack_target_with_weapon(player, target_loc.x, target_loc.y, weapon)
|
||||
if result == 2 then
|
||||
printl("OUT_OF_RANGE")
|
||||
play_md_sfx(5)
|
||||
elseif result == 3 then
|
||||
printl("THAT_IS_NOT_POSSIBLE")
|
||||
play_md_sfx(5)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
184
devtools/create_ultima/files/ultima6/scripts/md/talk.lua
Normal file
184
devtools/create_ultima/files/ultima6/scripts/md/talk.lua
Normal file
@@ -0,0 +1,184 @@
|
||||
function open_gates_at_olympus_mons()
|
||||
local gate = map_get_obj(0x2c3, 0x1f3, 0, 181) -- OBJ_GATE
|
||||
if gate ~= nil then
|
||||
gate.x = 0x2c2
|
||||
gate.frame_n = 3
|
||||
else
|
||||
printl("AARGH")
|
||||
end
|
||||
|
||||
gate = map_get_obj(0x2c4, 0x1f3, 0, 181) -- OBJ_GATE
|
||||
if gate ~= nil then
|
||||
gate.frame_n = 7
|
||||
else
|
||||
printl("AARGH")
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function open_dream_machine_door()
|
||||
local door = map_get_obj(0x2c7, 0x1dc, 0, 152) --OBJ_DOOR
|
||||
if door ~= nil then
|
||||
door.frame_n = 7
|
||||
end
|
||||
end
|
||||
|
||||
function talk_script_fix_panels()
|
||||
local numPanels = 0
|
||||
for actor in party_members() do
|
||||
for obj in actor_inventory(actor) do
|
||||
if obj.obj_n == 458 then --OBJ_PANEL
|
||||
numPanels = numPanels + 1
|
||||
play_md_sfx(4)
|
||||
obj.quality = bit32.band(obj.quality, 0xfd)
|
||||
obj.qty = 4
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if numPanels <= 1 then
|
||||
Actor.clear_talk_flag(0x39, 3)
|
||||
else
|
||||
Actor.set_talk_flag(0x39, 3)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function talk_script_spawn_monster_footprints()
|
||||
g_objlist_1d22_unk = 0
|
||||
local player_loc = player_get_location()
|
||||
for i=0,5 do
|
||||
local monster = Actor.new(145, player_loc.x, player_loc.y, player_loc.z) --OBJ_MONSTER_FOOTPRINTS
|
||||
|
||||
actor_init(monster)
|
||||
toss_actor(monster, player_loc.x, player_loc.y, player_loc.z, 0)
|
||||
monster.wt = 0x8
|
||||
g_objlist_1d22_unk = g_objlist_1d22_unk + 1
|
||||
end
|
||||
end
|
||||
|
||||
local talk_script_tbl = {
|
||||
[1]=talk_script_fix_panels,
|
||||
[6]=open_gates_at_olympus_mons,
|
||||
[7]=open_dream_machine_door,
|
||||
[9]=function() talk_script_status = 9 end,
|
||||
[0xA]=function() talk_script_status = 0xA end,
|
||||
[0x35]=talk_script_spawn_monster_footprints,
|
||||
}
|
||||
|
||||
function talk_script(script_number)
|
||||
if talk_script_tbl[script_number] ~= nil then
|
||||
talk_script_tbl[script_number]()
|
||||
else
|
||||
print("Attempting to run talk script #"..script_number.."\n")
|
||||
end
|
||||
end
|
||||
|
||||
local talk_script_status = -1
|
||||
|
||||
local talk_script_post_action_tbl = {
|
||||
[0x9]=function() play_end_sequence() end,
|
||||
[0xA]=function() end,
|
||||
[0x34]=wake_from_dream,
|
||||
[0x36]=wake_from_dream,
|
||||
[0x38]=function() end,
|
||||
[0x65]=function() end,
|
||||
[0x66]=function() end,
|
||||
[0x67]=function() end,
|
||||
[0x68]=function() end,
|
||||
[0x69]=function() end,
|
||||
}
|
||||
|
||||
function talk_to_actor(actor)
|
||||
local actor_num = actor.actor_num
|
||||
|
||||
if actor_num < 2 then
|
||||
if g_in_dream_mode then
|
||||
printl("YOU_TRY_TO_WAKE_YOURSELF_UP")
|
||||
local player_loc = player_get_location()
|
||||
if player_loc.z ~= 3 then
|
||||
wake_from_dream()
|
||||
end
|
||||
elseif player_is_in_solo_mode() then
|
||||
printl("NOT_WHILE_IN_SOLO_MODE")
|
||||
else
|
||||
printl("YOU_ARENT_YET_THAT_INSANE")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
if actor.obj_n == 391 then --your mother
|
||||
if player_get_gender() == 0 then
|
||||
printl("NO_BACKTALK_FROM_YOU_YOUNG_MAN")
|
||||
else
|
||||
printl("NO_BACKTALK_FROM_YOU_YOUNG_WOMAN")
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
print(actor.name.."\n")
|
||||
Actor.talk(actor_num)
|
||||
print("\n")
|
||||
|
||||
if talk_script_post_action_tbl[talk_script_status] ~= nil then
|
||||
talk_script_post_action_tbl[talk_script_status]()
|
||||
end
|
||||
talk_script_status = -1
|
||||
|
||||
return true
|
||||
end
|
||||
|
||||
function talk_conveyor()
|
||||
talk_to_actor(Actor.get(0x72))
|
||||
end
|
||||
|
||||
function talk_tower()
|
||||
talk_to_actor(Actor.get(0x73))
|
||||
end
|
||||
|
||||
function talk_dream_machine()
|
||||
talk_to_actor(Actor.get(0x74))
|
||||
end
|
||||
|
||||
local talk_obj_tbl = {
|
||||
[0xC] = function() printl("YOU_RECEIVE_A_MOMENTARY_IMPRESSION") end,
|
||||
[0x5C] = function() printl("THIS_WAS_WORN_LAST_BY_A_DYING_MAN") end,
|
||||
[0x64] = talk_dream_machine,
|
||||
[0xBC] = talk_conveyor,
|
||||
[0xBF] = talk_conveyor,
|
||||
[0xC0] = talk_conveyor,
|
||||
[0xC8] = talk_tower,
|
||||
[0xC9] = talk_tower,
|
||||
[0xD6] = talk_tower,
|
||||
[0xD7] = talk_tower,
|
||||
[0xE7] = function() printl("THIS_WAS_USED_BY_A_MARTIAN_MEASURING_TIME") end,
|
||||
[0xEA] = function() printl("THIS_JEWELRY_WAS_WORN_BY") end,
|
||||
[0xF6] = function() printl("THESE_FOOTBAGS_WERE_WORN_BY") end,
|
||||
[0xF7] = function() printl("THIS_SAW_WAS_USED_BY") end,
|
||||
[0xF9] = function() printl("THIS_DEVICE_WAS_USED_BY") end,
|
||||
[0x113] = function() printl("THIS_SCULPTURE_HAD_GREAT_RITUAL_OR_RELIGIOUS_SIGNIFICANCE") end,
|
||||
[0x120] = talk_dream_machine,
|
||||
[0x121] = talk_dream_machine,
|
||||
[0x122] = talk_dream_machine,
|
||||
|
||||
}
|
||||
|
||||
function talk_to_obj(obj)
|
||||
|
||||
local player = Actor.get_player_actor()
|
||||
if actor_is_affected_by_green_berries(player.actor_num) then
|
||||
if bit32.band(obj.status, 1) == 1 then
|
||||
local talk_function = talk_obj_tbl[obj.obj_n]
|
||||
if talk_function ~= nil then
|
||||
talk_function()
|
||||
return true
|
||||
end
|
||||
else
|
||||
printl("YOU_RECIEVE_NO_PSYCHIC_IMPRESSIONS")
|
||||
end
|
||||
else
|
||||
printl("NOTHING")
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
2460
devtools/create_ultima/files/ultima6/scripts/md/usecode.lua
Normal file
2460
devtools/create_ultima/files/ultima6/scripts/md/usecode.lua
Normal file
File diff suppressed because it is too large
Load Diff
259
devtools/create_ultima/files/ultima6/scripts/md/worktype.lua
Normal file
259
devtools/create_ultima/files/ultima6/scripts/md/worktype.lua
Normal file
@@ -0,0 +1,259 @@
|
||||
function select_target_actor(src_actor)
|
||||
local var_10 = 0x7fff
|
||||
local target_actor
|
||||
for i=0,0xff do
|
||||
local actor = Actor.get(i)
|
||||
local actor_align = actor.align
|
||||
local actor_obj_n = actor.obj_n
|
||||
local src_actor_align = src_actor.align
|
||||
local src_actor_obj_n = src_actor.obj_n
|
||||
if actor_obj_n ~= 0 and actor.alive and actor.visible and actor.actor_num ~= src_actor.actor_num and actor_obj_n ~= 381 then --OBJ_DUST_DEVIL
|
||||
if src_actor_align ~= ALIGNMENT_NEUTRAL or actor_align ~= ALIGNMENT_NEUTRAL then
|
||||
if src_actor_align ~= ALIGNMENT_CHAOTIC or (src_actor_obj_n ~= actor_obj_n
|
||||
and (src_actor_obj_n ~= 372 or (actor_obj_n ~= 370 and actor_obj_n ~= 371))
|
||||
and ((src_actor_obj_n ~= 362 and src_actor_obj_n ~= 373 and src_actor_obj_n ~= 254)
|
||||
or (actor_obj_n ~= 362 and actor_obj_n ~= 373 and actor_obj_n ~= 254)))
|
||||
and (src_actor_align ~= ALIGNMENT_GOOD or actor_align == ALIGNMENT_EVIL or actor_align == ALIGNMENT_CHAOTIC)
|
||||
and (src_actor_align ~= ALIGNMENT_EVIL or actor_align == ALIGNMENT_GOOD or actor_align == ALIGNMENT_CHAOTIC)
|
||||
and actor_find_max_wrapped_xy_distance(src_actor, actor.x, actor.y) <= 0xb
|
||||
and (actor.wt ~= 7 or actor_find_max_wrapped_xy_distance(Actor.get_player_actor(), actor.x, actor.y) <= 5)
|
||||
then
|
||||
local var_C = get_wrapped_dist(actor.x, src_actor.x)^2 + get_wrapped_dist(actor.y, src_actor.y)^2
|
||||
if var_C < var_10
|
||||
or (var_C == var_10 and actor_get_damage(actor) > actor_get_damage(target_actor)) then
|
||||
var_10 = var_C
|
||||
target_actor = actor
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return target_actor
|
||||
end
|
||||
|
||||
function worktype_8_combat_attack(actor)
|
||||
g_selected_obj = select_target_actor(actor)
|
||||
|
||||
end
|
||||
|
||||
function worktype_15_your_mother(actor)
|
||||
if actor_move(actor, DIR_SOUTH) == false then
|
||||
local target_actor = select_target_actor(actor)
|
||||
if target_actor ~= nil then
|
||||
--FIXME do combat range check. sub_1B305
|
||||
actor_take_hit(actor, target_actor, 6, 0)
|
||||
end
|
||||
end
|
||||
subtract_movement_pts(actor, 3)
|
||||
end
|
||||
|
||||
function worktype_stomp_around(actor)
|
||||
subtract_movement_pts(actor, 5)
|
||||
if actor.obj_n == 398 and g_current_dream_stage == 0x44 then
|
||||
if math.random(0, 1) == 0 then
|
||||
play_md_sfx(0, true)
|
||||
quake_start(1,50)
|
||||
else
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local direction = math.random(0, 3)
|
||||
actor_move(actor, direction, 0)
|
||||
for obj in objs_at_loc(actor.xyz) do
|
||||
actor_hit(obj, math.random(0, 0xa) + math.random(0, 0xa), 0)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function worktype_16_minotaur(actor)
|
||||
if g_current_dream_stage == 0x60 then
|
||||
Actor.kill(actor)
|
||||
return
|
||||
end
|
||||
|
||||
local dream_actor = Actor.get(0)
|
||||
local target
|
||||
if Actor.inv_has_obj_n(dream_actor, 162) then --OBJ_RED_CAPE
|
||||
target = dream_actor
|
||||
g_selected_obj = target
|
||||
else
|
||||
for obj in find_obj_from_area(0x21, 0x33, 2, 0x1c, 0x10) do
|
||||
if obj.obj_n == 162 then --OBJ_RED_CAPE
|
||||
target = obj
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if target == nil then
|
||||
worktype_stomp_around(actor)
|
||||
return
|
||||
end
|
||||
|
||||
if actor_get_combat_range(actor, target.x, target.y) <= 1 then
|
||||
if target.luatype == "actor" then
|
||||
attack_target_with_weapon(actor, target.x, target.y, actor)
|
||||
subtract_movement_pts(actor, 0xa)
|
||||
return
|
||||
end
|
||||
|
||||
hit_target(target, RED_HIT_TILE)
|
||||
if not Actor.get_talk_flag(0x54, 6) and target.x >= 0x37 and target.y <= 0x37 then
|
||||
complete_tiffany_stage()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
actor_move_towards_loc(actor, target.x, target.y)
|
||||
play_md_sfx(0, true)
|
||||
quake_start(1,50)
|
||||
for obj in objs_at_loc(actor.xyz) do
|
||||
actor_hit(obj, math.random(1, 0xa) + math.random(1, 0xa), 0)
|
||||
end
|
||||
subtract_movement_pts(actor, 5)
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
function worktype_99_coker_move_to_coal_vein(actor)
|
||||
if actor_move(actor, DIR_NORTH) == false then
|
||||
local vein = map_get_obj(actor.x, actor.y-1, actor.z, 446) --OBJ_VEIN_OF_COAL FIXME should be -2 not -1 need to fix actor_move for coker.
|
||||
if vein ~= nil then
|
||||
if map_is_on_screen(actor.x, actor.y, actor.z) then
|
||||
play_md_sfx(0x10)
|
||||
end
|
||||
actor.wt = 0x9A
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function worktype_9A_coker_drop_coal(actor)
|
||||
local obj = map_get_obj(actor.x, actor.y+1, actor.z, 188) --OBJ_CONVEYOR_BELT
|
||||
if obj ~= nil then
|
||||
local coal = Obj.new(447) --OBJ_HUGE_LUMP_OF_COAL
|
||||
Obj.moveToMap(coal, actor.x, actor.y+1, actor.z)
|
||||
else
|
||||
obj = map_get_obj(actor.x, actor.y+1, actor.z, 192) --OBJ_BARE_ROLLERS
|
||||
if obj == nil then
|
||||
actor_move(actor, DIR_SOUTH)
|
||||
return
|
||||
end
|
||||
end
|
||||
actor.wt = 0x9B
|
||||
end
|
||||
|
||||
function worktype_9B_coker_wait_for_coal_to_move_away(actor)
|
||||
local obj = map_get_obj(actor.x, actor.y+1, actor.z, 447) --OBJ_HUGE_LUMP_OF_COAL
|
||||
if obj == nil then
|
||||
obj = map_get_obj(actor.x, actor.y+1, actor.z, 192) --OBJ_BARE_ROLLERS
|
||||
if obj == nil then
|
||||
actor.wt = 0x99
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function worktype_9D_stoker_wait_for_coal(actor)
|
||||
local coal
|
||||
coal = map_get_obj(actor.x, actor.y+1, actor.z, 447) --OBJ_HUGE_LUMP_OF_COAL
|
||||
|
||||
if coal ~= nil then
|
||||
while coal ~= nil do
|
||||
Obj.removeFromEngine(coal)
|
||||
coal = map_get_obj(actor.x, actor.y+1, actor.z, 447) --OBJ_HUGE_LUMP_OF_COAL
|
||||
end
|
||||
actor.wt = 0x9E
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function worktype_9E_stoker_walk_to_furnace(actor)
|
||||
if actor_move(actor, DIR_NORTH) == false then
|
||||
local furnace = map_get_obj(actor.x, actor.y-1, actor.z, 233)
|
||||
if furnace == nil then
|
||||
furnace = map_get_obj(actor.x+1, actor.y-1, actor.z, 233)
|
||||
end
|
||||
|
||||
if furnace ~= nil then
|
||||
if Actor.get_talk_flag(0x72, 2) == false then
|
||||
activate_power_system()
|
||||
else
|
||||
if Actor.get_talk_flag(0x73, 2) == false or Actor.get_talk_flag(0x71, 3) == true then
|
||||
if Actor.get_talk_flag(0x71, 3) == true then
|
||||
Actor.clear_talk_flag(0x73, 2)
|
||||
Actor.clear_talk_flag(0x71, 3)
|
||||
--FIXME sub_3F740
|
||||
end
|
||||
Actor.set_talk_flag(0x73, 2)
|
||||
activate_power_update_tiles()
|
||||
activate_tower_electricity()
|
||||
midgame_cutscene_2()
|
||||
end
|
||||
end
|
||||
actor.wt = 0x9C
|
||||
else
|
||||
stoker_blocked(actor)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function activate_tower_electricity()
|
||||
for obj in find_obj(0, 201) do --OBJ_TOWER_TOP
|
||||
if obj ~= nil then
|
||||
if obj.x >= 0x3d0 and obj.x <= 0x3f0 and obj.y >= 0x1d0 and obj.y <= 0x1e7 then
|
||||
local frame_n = obj.frame_n
|
||||
obj.frame_n = bit32.bor(frame_n, 4)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for obj in find_obj(0, 214) do --OBJ_POWER_CABLE
|
||||
if obj ~= nil then
|
||||
if obj.x >= 0x3d0 and obj.x <= 0x3f0 and obj.y >= 0x1d0 and obj.y <= 0x1e7 then
|
||||
obj.obj_n = 215 --OBJ_POWER_CABLE1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function stoker_blocked(stoker)
|
||||
if map_is_on_screen(stoker.x, stoker.y, stoker.z) then
|
||||
printl("STOKERS_PATH_IS_BLOCKED")
|
||||
play_md_sfx(0)
|
||||
end
|
||||
end
|
||||
|
||||
function worktype_9C_stoker_return_to_conveyor_belt(actor)
|
||||
if map_get_obj(actor.x, actor.y+2, actor.z, 191) == nil then --OBJ_CONVEYOR_BELT2
|
||||
if actor_move(actor, DIR_SOUTH) == false then
|
||||
stoker_blocked(actor)
|
||||
end
|
||||
else
|
||||
actor.wt = 0x9D
|
||||
end
|
||||
end
|
||||
|
||||
local worktype_tbl = {
|
||||
[0x15]=worktype_15_your_mother,
|
||||
[0x16]=worktype_16_minotaur,
|
||||
[0x99]=worktype_99_coker_move_to_coal_vein,
|
||||
[0x9a]=worktype_9A_coker_drop_coal,
|
||||
[0x9b]=worktype_9B_coker_wait_for_coal_to_move_away,
|
||||
[0x9c]=worktype_9C_stoker_return_to_conveyor_belt,
|
||||
[0x9d]=worktype_9D_stoker_wait_for_coal,
|
||||
[0x9e]=worktype_9E_stoker_walk_to_furnace,
|
||||
}
|
||||
|
||||
function perform_worktype(actor)
|
||||
--print("wt="..actor.wt.."\n")
|
||||
local mpts = actor.mpts
|
||||
if worktype_tbl[actor.wt] ~= nil then
|
||||
local func = worktype_tbl[actor.wt]
|
||||
func(actor)
|
||||
end
|
||||
|
||||
if mpts == actor.mpts then
|
||||
subtract_movement_pts(actor, 10)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user