attack power

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: attack power

Post by bongobeat »

Isaac wrote:
Grimfan wrote:Unfortunately, a bonus to the character's attackPower is not something that can be added to the game through normal means (attackPower is only used for the weapons themselves). You cannot even create an item that directly adds to a character's attackPower since this is a statistic that cannot be directly modified (it's not like energy or protection in that way).
You're right (afaik), but it is possible to make a copy of a weapon with a different attackpower bonus; not one that you would ever place in the dungeon, but instead, you would equip it via script, and ensure that only those fighters with sufficient skill for the bonus ever get to use it.
I believe items like the loincloth have been hardcoded to provide their attackPower bonus. There are several hardcoded features like this in LoG1 that will be rectified or addressed in LoG2 (hopefully making it easier to get around these problems).
I wondered that myself; I think it likely is hard coded. The check would be to rename a pair of pants "loincloth", but I haven't tried.


@ Bongobeat:
Try this:
SpoilerShow
Party Hook: (in Objects.lua)

Code: Select all

defineObject{
	name = "party",
	class = "Party",
	editorIcon = 32,
	onDrawSkills = function(gui_context)
								if gui_context.mouseDown(0) then

									superAxeSkill.check()

								end
							end,
}
Item Definitions:

Code: Select all

defineObject{
          name = "super_axe",
          class = "Item",
          uiName = "Axe of Might",
		model = "assets/models/items/ancient_axe.fbx",
		description = "It's a super axe!",
		skill = "axes",
		gfxIndex = 158,
		attackPower = 36,
		accuracy = 0,
		coolDownTime = 6.3,
		attackMethod = "meleeAttack",
		attackSwipe = "horizontal",
		attackSound = "swipe_heavy",
		impactSound = "impact_blade",
		weight = 7.3,
    gameEffect = "Additional +30 to Attack Power for Figters proficient with Axe level 40.",
    onEquipItem = function(champion, slot)
						superAxeSkill.bonus(champion, slot) end
    }

	cloneObject{
		name = "super_axe_with_bonus",
		baseObject = "super_axe",
		uiName = "Axe of Might (+30!)",
		attackPower = 66,
		onEquipItem = function(champion, slot)end,
		onUnequipItem = function(champion, slot)
						setMouseItem()
						setMouseItem(spawn("super_axe"))
						end,
    }
Script object on map: Name the script "superAxeSkill" (no quotes)

Code: Select all

    -- This script applies the bonus as soon as the weapon skill is sufficient.

    alreadyQualified = {false,false,false,false}

    function check()
       for x = 1,4 do
		 if not alreadyQualified[x] then
             local champion = party:getChampion(x)    print(champion:getName())
             local weapon = champion:getItem(7)      print(weapon)
             local weapon2 = champion:getItem(8)      print(weapon)
             if weapon ~= nil and weapon.name == "super_axe" then
                bonus(champion, 7)
             elseif weapon2 ~= nil and weapon2.name == "super_axe" then
                bonus(champion, 8)
             end
          end
       end
    end

    function bonus(champion, slot)
          if  champion:getSkillLevel("axes") > 39 then
             alreadyQualified[1] = true
             champion:removeItem(slot)
             champion:insertItem(slot, spawn("super_axe_with_bonus"))
          end
    end
DAT File: https://www.dropbox.com/s/hj8hojxvuh8r1 ... gobeat.dat
well works fine! thanks :)

But I ve got this printing on the screen:
Image
could it be avoided?
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: attack power

Post by Isaac »

bongobeat wrote:...could it be avoided?
Yeah, I forgot about those. it's the print statements ~in the For loop ~in superAxeSkill script. Paste this corrected version into the script.
[It has yet another minor bug fix also.]

Script object on map: Name the script "superAxeSkill" (no quotes)

Code: Select all

    -- This script applies the bonus as soon as the weapon skill is sufficient.

    alreadyQualified = {false,false,false,false}

    function check()
       for x = 1,4 do
		 if not alreadyQualified[x] then
             local champion = party:getChampion(x)    
             local weapon = champion:getItem(7)     
             local weapon2 = champion:getItem(8)     
             if weapon ~= nil and weapon.name == "super_axe" then
                bonus(champion, 7)
             elseif weapon2 ~= nil and weapon2.name == "super_axe" then
                bonus(champion, 8)
             end
          end
       end
    end

    function bonus(champion, slot)
          if  champion:getSkillLevel("axes") > 39 then
             alreadyQualified[champion:getOrdinal()] = true
             champion:removeItem(slot)
             champion:insertItem(slot, spawn("super_axe_with_bonus"))
          end
    end
I also uploaded the Project Files: https://www.dropbox.com/sh/cjhppiy9jnva ... S1LQi5gU2a
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: attack power

Post by bongobeat »

thanks a lot :D
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Post Reply