weapon script help pls

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

weapon script help pls

Post by Drakkan »

Hello, I need script axe which will have bonus to STR (or attack etc...) when used by minotaur and negative values when used by any other race. Model used should be Norja axe
could you help pls ?
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: weapon script help pls

Post by akroma222 »

Geez, this was from a while ago... have you figured this one out yet??
Im guessing to use a combo of onEquip item hooks and then champ:getRace... with appropriate bonuses
I will likely by scripting something up soon like this, let me know if you still want the code :)
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: weapon script help pls

Post by Drakkan »

akroma222 wrote:Geez, this was from a while ago... have you figured this one out yet??
Im guessing to use a combo of onEquip item hooks and then champ:getRace... with appropriate bonuses
I will likely by scripting something up soon like this, let me know if you still want the code :)
hi, yes still missing this script. here is Komag last advice-

have the onEquipItem and onUnequipItem do scripts/functions in the dungeon, such as axeScript.equipAxe(champ,slot) and axeScript.unequipAxe(champ,slot)
in those functions do a check first that the slot is 7 or 8, then check on the champ race to see if the champion is minotaur or not. Then if it's in slot 7 or 8 and if it's minotaur, do the stat adjust (strength)
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: weapon script help pls

Post by akroma222 »

Yup! That's pretty much the way to go....
I will have a crack at it and get back to ya ;)
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: weapon script help pls

Post by akroma222 »

OK, so I believe this will suffice for a weapon that:
-will give a bonus to a (Stat) and or add a (Trait)... IF
-the weapon is being held in hand (slot 7 or 8) AND the champion holding the weapon is of (Race)

This is the weapon definition for items.lua-
SpoilerShow
cloneObject{
name = "drakkan_minotaur_mace",
baseObject = "knoffer",
uiName = "Drakkan Minotaur Mace",
skill = "maces",
requiredLevel = 0,
attackPower = 30,
weight = 2.2,
onEquipItem = function(champion, slot)
return specialWeaponScripts.drakkanMaceEquip(champion, slot)
end,
onUnequipItem = function(champion, slot)
return specialWeaponScripts.drakkanMaceUnequip(champion, slot)
end,
description = "A mace forged by the greatly feared drakkan minotaurs of old.",
}
And this is for a script entity in dungeon called "specialWeaponScripts" -
SpoilerShow
-------------Drakkan Minotaur Mace-------------------------

function drakkanMaceEquip(champion, slot)
if champion:getRace() == "Minotaur" then
if slot == 7 or slot == 8 then
champion:modifyStatCapacity("strength", 5)
champion:modifyStat("strength", 5)
champion:addTrait("aggressive", false)
hudPrint("The mace feels invigorating for you to hold")
end
end
end

function drakkanMaceUnequip(champion, slot)
if champion:getRace() == "Minotaur" then
if slot == 7 or slot == 8 then
champion:modifyStatCapacity("strength", -5)
champion:modifyStat("strength", -5)
champion:removeTrait("aggressive", false)
hudPrint("You put the mace away...")
end
end
end
Drakkan, I may well create a special weapon scripts thread soon with these kinds of things included,
you don't mind if I include this 'if race > buff' type weapon script??

Let me know if you have any dramas...

EDIT - I have created the weapons script thread.... viewtopic.php?f=14&t=4088
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: weapon script help pls

Post by Drakkan »

akroma222 wrote:OK, so I believe this will suffice for a weapon that:
-will give a bonus to a (Stat) and or add a (Trait)... IF
-the weapon is being held in hand (slot 7 or 8) AND the champion holding the weapon is of (Race)

This is the weapon definition for items.lua-
SpoilerShow
cloneObject{
name = "drakkan_minotaur_mace",
baseObject = "knoffer",
uiName = "Drakkan Minotaur Mace",
skill = "maces",
requiredLevel = 0,
attackPower = 30,
weight = 2.2,
onEquipItem = function(champion, slot)
return specialWeaponScripts.drakkanMaceEquip(champion, slot)
end,
onUnequipItem = function(champion, slot)
return specialWeaponScripts.drakkanMaceUnequip(champion, slot)
end,
description = "A mace forged by the greatly feared drakkan minotaurs of old.",
}
And this is for a script entity in dungeon called "specialWeaponScripts" -
SpoilerShow
-------------Drakkan Minotaur Mace-------------------------

function drakkanMaceEquip(champion, slot)
if champion:getRace() == "Minotaur" then
if slot == 7 or slot == 8 then
champion:modifyStatCapacity("strength", 5)
champion:modifyStat("strength", 5)
champion:addTrait("aggressive", false)
hudPrint("The mace feels invigorating for you to hold")
end
end
end

function drakkanMaceUnequip(champion, slot)
if champion:getRace() == "Minotaur" then
if slot == 7 or slot == 8 then
champion:modifyStatCapacity("strength", -5)
champion:modifyStat("strength", -5)
champion:removeTrait("aggressive", false)
hudPrint("You put the mace away...")
end
end
end
Drakkan, I may well create a special weapon scripts thread soon with these kinds of things included,
you don't mind if I include this 'if race > buff' type weapon script??

Let me know if you have any dramas...

EDIT - I have created the weapons script thread.... viewtopic.php?f=14&t=4088
working perfect thanks a lot man. Will play with it a little.
you can create any special thread you like of course, np from my side
EDIT - this is more game desigh flaw then yours, but in case character does not have enough skill to use that weapon (for example axes:10), but that weapon is equiped, bonus from script still counts.
Also not tested case if character already have agresive trait, will he get "double" aggresive or just nothing will happens ?
Breath from the unpromising waters.
Eye of the Atlantis
Post Reply