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

attack power

Post by bongobeat »

Hello,

does anyone knows if it is possible that script a weapon which give +20 to attack power?
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 »

Do you mean differently than this?

Code: Select all

	defineObject{
		name = "machete",
		class = "Item",
		uiName = "Machete of Might",
		model = "assets/models/items/machete.fbx",
		skill = "swords",
		gfxIndex = 23,
		attackPower = 29,
		accuracy = 0,
		coolDownTime = 3.2,
		attackMethod = "meleeAttack",
		attackSwipe = "horizontal",
		attackSound = "swipe",
		impactSound = "impact_blade",
		weight = 2.2,
		gameEffect = "Enchanted +20 Attack power"
	}
	
User avatar
Doridion
Posts: 256
Joined: Tue Jun 10, 2014 9:23 pm

Re: attack power

Post by Doridion »

bongobeat, as Isaac shown you, you must add a "clone" the object on the "mod_assets\scripts\object.lua" file in your mod folder, not by the editor ;)
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: attack power

Post by bongobeat »

Doridion wrote:bongobeat, as Isaac shown you, you must add a "clone" the object on the "mod_assets\scripts\object.lua" file in your mod folder, not by the editor ;)
No problem I know, thanks ;)
Isaac wrote:Do you mean differently than this?

Code: Select all

	defineObject{
		name = "machete",
		class = "Item",
		uiName = "Machete of Might",
		model = "assets/models/items/machete.fbx",
		skill = "swords",
		gfxIndex = 23,
		attackPower = 29,
		accuracy = 0,
		coolDownTime = 3.2,
		attackMethod = "meleeAttack",
		attackSwipe = "horizontal",
		attackSound = "swipe",
		impactSound = "impact_blade",
		weight = 2.2,
		gameEffect = "Enchanted +20 Attack power"
	}
	
Sorry my request is not clear !
well I mean, a gameEffect like the loincloth gives, I don't know how to script it.
SpoilerShow

Code: Select all

gameEffect = "Attack Power +1",
but for a weapon, and if the champion has axe skills level 40 (in fact it is a second bonus, before the champion gets the existing bonus when he reach the axe level 50)
I ve started something based on your armor script, but for the attackPower… I really don't know
SpoilerShow

Code: Select all

   defineObject{
      name = "super_axe",
      class = "Item",
      uiName = "Axe of Might",
      model = "assets/models/items/axe.fbx",
      skill = "axe",
      gfxIndex = 23,
      attackPower = 29,
      accuracy = 0,
      coolDownTime = 3.2,
      attackMethod = "meleeAttack",
      attackSwipe = "horizontal",
      attackSound = "swipe",
      impactSound = "impact_blade",
      weight = 2.2,
gameEffect = "Additional +30 to Attack Power for Figters proficient with Axe level 40.",
onEquipItem = function(champion, slot)
   if champion:getClass() == "Fighter" and champion:getSkillLevel("axe") >39   then
      if ( slot == 7 ) or ( slot == 8 ) then
...
}
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: attack power

Post by Grimfan »

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). 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).

The best solution is to grant the character the aggressive trait while using a particular weapon.

Also, if you want to create an item which modifies a stat you need to write ("protection", 2) or ("willpower", -2). This would grant the person a +2 bonus to protection or a -2 to willpower. Also note that some items need to be changed to grant certain bonuses. For example a shield that is also a weapon would have the added line weapon = true (plus other appropriate changes).

Of course, if I have missed something vital or am completely wrong I'm sure much better modders like Isaac or Komag will correct me. ;)
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: attack power

Post by Isaac »

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: (updated to V1.01)
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)    
             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
DAT File: https://www.dropbox.com/s/d0d4k73lri8rn ... .01%29.dat
Project Files: https://www.dropbox.com/sh/cjhppiy9jnva ... S1LQi5gU2a
Last edited by Isaac on Sat Jun 28, 2014 7:18 pm, edited 9 times in total.
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: attack power

Post by Grimfan »

And this is why I mentioned Isaac. :D

I thought Isaac might be able to come up with a nifty weapon script on the fly, however if you have the axe equipped when you level up it won't register the addition to attack power until you take the axe off and reequip it. Also be aware that this script doesn't affect the character's overall attackPower, so it won't add to the attack rating of the weapon in the character's other hand.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: attack power

Post by Isaac »

Grimfan wrote:And this is why I mentioned Isaac. :D

I thought Isaac might be able to come up with a nifty weapon script on the fly, however if you have the axe equipped when you level up it won't register the addition to attack power until you take the axe off and reequip it. Also be aware that this script doesn't affect the character's overall attackPower, so it won't add to the attack rating of the weapon in the character's other hand.
There is a third file: a party hook for Object.lua, I forgot to include it first time around; I noticed when I was making the Dat.
*And a minor bug fix in superAxeSkill :oops:
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: attack power

Post by Grimfan »

I just snuck onto the editor to check out your work and the script functions perfectly. Well done! :)

I know who to turn to if I get into a pickle with my mod (which is coming along slowly but surely).
User avatar
maneus
Posts: 246
Joined: Mon Jun 17, 2013 10:42 pm
Location: Switzerland

Re: attack power

Post by maneus »

Why not give the Item a strength bonus and at the same time reduce the load to the normal load amount of a character?
So the player didn´t see the more strength effect in inventory but have more attack power. Would that be possible?
Post Reply