bugfix: use_item scripts must return a value

This commit is contained in:
Enno Rehling 2006-01-08 10:24:51 +00:00
parent 5b5026cefd
commit 77bc58aabd
3 changed files with 8 additions and 2 deletions

View file

@ -6,7 +6,9 @@ function use_seashell(u, amount)
local msg = message("msg_event") local msg = message("msg_event")
msg:set_string("string", tostring(u) .. " erzählt den Bewohnern von " .. r.name .. " von Muschelplateau, das seine Partei vor " .. turns .. " Wochen besucht hat." ) msg:set_string("string", tostring(u) .. " erzählt den Bewohnern von " .. r.name .. " von Muschelplateau, das seine Partei vor " .. turns .. " Wochen besucht hat." )
msg:send_region(u.region) msg:send_region(u.region)
return 0
end end
return -4
end end
function update_embassies() function update_embassies()

View file

@ -4,7 +4,9 @@ function use_snomwan(u, amount)
u.race = "snowman" u.race = "snowman"
u.number = amount u.number = amount
u:add_item("snowman", -amount) u:add_item("snowman", -amount)
return 0
end end
return -4
end end
function xmas2004() function xmas2004()

View file

@ -1,7 +1,7 @@
function usepotion_message(u, type) function usepotion_message(u, potion)
msg = message("usepotion") msg = message("usepotion")
msg:set_unit("unit", u) msg:set_unit("unit", u)
msg:set_resource("potion", type) msg:set_resource("potion", potion)
return msg return msg
end end
@ -11,6 +11,8 @@ function use_stardust(u, amount)
u.region:set_resource("peasant", p) u.region:set_resource("peasant", p)
local msg = usepotion_message(u, "stardust") local msg = usepotion_message(u, "stardust")
msg:send_region(u.region) msg:send_region(u.region)
u:add_item("stardust", -amount)
return 0
end end
function xmas2005() function xmas2005()