Re: Ask a simple question, get a simple answer
Posted: Sun Feb 19, 2017 12:36 pm
Isaac!
Many thanks!
Everything happened as planned!
Many thanks!
Everything happened as planned!
Official Legend of Grimrock Forums
http://grimrock.net/forum/
This didn't work for me either.Liam.Ducray wrote:1. Isn´t it possible to create a character-level requirement for weapons in the LUA file? Like i.e. Character must be at least level 4 to hold a Sabre.
I tried the command "requiredLevel = X," as written on the official page, but it does not work.
Code: Select all
onAttack = function(self,champion,slot)
if champion:getLevel < 3 then
champion:showAttackResult("Can't Use", "AccuracySymbol")
return false
end
end,
Only melee and firearm attacks have pierce.2. Isn´t it possible to give the parameters "knockback" and "pierce" to ranged weapons? As I tried, the editor spelled error messages upon testplay.
You can use the 'onAttack' and 'onPostAttack' hooks to modify the item based on the ammunition item currently held by the champion.3. Isn´t it possible to give Ammunition a "damageType" like i.e. fire ? I created my own Flaming Crossbow Bolts, and of course they are supposed to deal fire damage.
But again, the editor gave me the "invalid component property"-error messages upon testplay.
the full code is:items.lua:96: function arguments expected near '<'
Code: Select all
defineObject{
name = "sling",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/sling.fbx",
},
{
class = "Item",
uiName = "Sling",
description = "A primitive sling to accelerate rocks",
gfxIndex = 44,
impactSound = "impact_blunt",
weight = 0.5,
traits = { "missile_weapon" },
},
{
class = "RangedAttack",
attackPower = 7,
cooldown = 4,
damageType = "physical",
attackSound = "swipe",
ammo = "rock",
onAttack = function(self, champion, slot)
if champion:getLevel < 2 then
champion:showAttackResult("Can't Use", "AccuracySymbol")
return false
end
end,
},
},
tags = { "weapon", "weapon_missile" },
}
Code: Select all
if champion:getLevel < 2 then
Code: Select all
onAttack = function(self, champion, slot, chainIndex)
if champion:getHealth() < champion:getMaxHealth() then
hudPrint("User is wounded, cannot use this weapon")
return false
end
end,
onPostAttack = function(self, champion, slot)
champion:damage(20,"pure")
end
Code: Select all
{
class = "FirearmAttack",
name = "hellfire",
uiName = "Hellfire",
gameEffect = "Fires rapidly 4 concussive bullets filled with pure magma.",
energyCost = 25,
attackPower = 16,
cooldown = 6,
attackSound = "gun_shot_large",
ammo = "pellet",
knockback = true,
repeatCount = 4,
repeatDelay = 0.2,
damageType = "fire",
causeCondition = "burning",
conditionChance = 40,
},
Put a script entity called script_entity_1 in your dungeon.Liam.Ducray wrote:1. Isn´t it possible to create a character-level requirement for weapons in the LUA file? Like i.e. Character must be at least level 4 to hold a Sabre.
I tried the command "requiredLevel = X," as written on the official page, but it does not work.
Code: Select all
function removeItem(champion, slot)
local item_slot = party.party:getChampionByOrdinal(champion):getItem(slot)
local item_mouse = getMouseItem()
if (item_mouse == nil) then
-- there was no item in the slot when we equipped the sword
-- item_slot = sword
setMouseItem(item_slot)
party.party:getChampionByOrdinal(champion):removeItemFromSlot(slot)
else
-- there already was an item in the slot
-- item_slot = sword
-- item_mouse = old item
-- put the sword in the mouse cursor
setMouseItem(item_slot)
party.party:getChampionByOrdinal(champion):removeItemFromSlot(slot)
-- put the old item back in the champion's inventory
party.party:getChampionByOrdinal(champion):insertItem(slot, item_mouse)
end
end
Code: Select all
defineObject{
name = "fighters_long_sword",
baseObject = "base_item",
components = {
{
class = "Model",
model = "assets/models/items/long_sword.fbx",
},
{
class = "Item",
uiName = "Fighter's Longsword",
gfxIndex = 84,
gfxIndexPowerAttack = 430,
impactSound = "impact_blade",
weight = 3.2,
description = "This longsword is only for fighters.",
traits = { "light_weapon", "sword" },
onEquipItem = function(self, champion, slot)
if (slot == ItemSlot.Weapon) or (slot == ItemSlot.OffHand) then
if (champion:getClass() ~= "fighter") then
hudPrint("This longsword can only be equipped by fighters!")
delayedCall("script_entity_1", 0, "removeItem", champion:getOrdinal(), slot)
end
end
end
},
{
class = "MeleeAttack",
attackPower = 16,
accuracy = 0,
cooldown = 3.7,
swipe = "horizontal",
requirements = { "light_weapons", 1 },
powerAttackTemplate = "thrust",
},
},
tags = { "weapon" },
}
Artifacts of Mightzimberzimber wrote: 2) How do I make projectiles travel in a horizontal (or any other 1-89 degree angle from one of the main directions) path?