Special Weapon Scripts + [ASSETS] weapons/armour/acc/herbs

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Special/Magic Weapon Scripts + [Assets] models/icons

Post by akroma222 »

Codes updated! Thanks again Marble Mouth, very helpful indeed :D

I have also posted up a few items from the available half of Labyrinth of Lies... weapons, armour, accessories and herbs...
There are links to the models/textures/icon atlas and also the scripts for materials and items.lua

Enjoy!!!
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by akroma222 »

There is now a NEXUS download for the asset package on the original post
Enjoy :-)
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by akroma222 »

Ok, so hopefully this is a simple fix... I have tried a few different ways but can't seem to get an unarmed skilled attack script working... I am sure there is a simpler way but this is what I have -

Items.lua
SpoilerShow

Code: Select all

defineObject{
		name = "iron_knuckles",
		class = "Item",
		uiName = "Iron Knuckles",
		model = "assets/models/items/pit_gauntlets.fbx",
                gfxIndex = 18,
		skill = "unarmed_combat",
                slot = "Gauntlet",
		requiredLevel = 5
                protection = 1,
                strength = 1,
		weight = 1.2,
	}
Party hook for init.lua (from original post)
SpoilerShow

Code: Select all

cloneObject{
	name = "party",
	baseObject = "party",
	onAttack = function(champion, weapon, skill)
		return attackingWeaponScripts.specialWeaponAttacks(champion, weapon, skill)
	end
}
this addition is made to the script outlined in the first post of this thread... checking - if no weapon then....
SpoilerShow

Code: Select all


function specialWeaponAttacks(champion, weapon, skill)
      --------------------------previous weapon checks------------------------
      --example------------------------------------------------------------------
      --if (weapon ~= nil) and (weapon.name == "shock_maul") then------
		--return attackingWeaponScripts.burstSpellAttacks(champion,weapon,skill)
	--end-----------------------------------------------------------------------
      ------------------------------------------------------------------------------
      if weapon == nil then
	  for slot = 9,10 do
      item = champion:getItem(slot)
      if item ~= nil then
      	if item.name == "iron_knuckles" then
		return unarmedScripts.unarmedAttacks(champion,item,skill)
	end
      end 
   end		
   return true
end
end
and then a lua script "unarmedAttackScripts"
SpoilerShow

Code: Select all


monstersList = {------------all monsters listed here-------------}
			
fist_monster = ""

function isInMonsterTable(table, element)
  for _,value in pairs(table) do
    if value == element then
      return true
    end
  end
  return false
end

function whichMonster(level,eggs,why)
  for i in entitiesAt(level,eggs,why) do
    if isInMonsterTable(monstersList,i.name) then
      return i.id
    end
  end
  return ""
end
                    
function unarmedAttacks(champion, item, skill)                      ----checks for which unarmed combat gauntlet it is--------
	local skill = champion:getSkillLevel("unarmed_combat")
	local fist_champ = champion
			
  	if item.name == "iron knuckles" then
		return unarmedScripts.ironKnuckles(champion, item, skill)
	end
	if item.name == "spiked_gauntlet" then
		return unarmedScripts.spikedGauntlet(champion, item, skill)
	end
	return true
end

function ironKnuckles(champion,item,skill)
  local dx,dy = getForward(party.facing)
  fist_champ = champion
  fist_monster = whichMonster(party.level,party.x+dx,party.y+dy)
  if fist_monster == "" then
    return true
  else
  local skill = champion:getSkillLevel("unarmed_combat")
  local damage = math.random(100,120)
  hudPrint("damage")
  damageTile(fist_monster.level,fist_monster.x,fist_monster.y,party.facing,0,"physical",damage)
  return true
end
end

So, hudPrint and damage tile will not happen... and I am puzzled.... the set up is long winded, but my weapon scripts in dungeon are set up to check weapons after the party attacks and then call other scripts
I want the unarmed weapon/gauntlet to just increase damage through a damage tile - not just increase strength for the same effect- and I obviously cant replicate the pit gauntlet game effect 4 or 5 times over....
Any assistance appreciated!!!
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by Drakkan »

Hi akroma, I have new request for special weapon.
I need weapon which could be used only by a particular defined character (based on name) - for example I need staff, which could be used only by hero called Amber. I already tried "curse" item, so when this character equip it, you cannot take it away. This is working fine, but it has few flaws (like it is not working for new party member, you fill the slot etc...)
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by akroma222 »

Hey Drakkan,
Cool - so a weapon that only be used by a champ with a certain name ("Amber" in this case?)
Shouldnt be too hard at all, I will sort it out in the next day or so :-)

I would be interested to see your cursed weapon script too... I am nutting out a script for a cursed weapon - when you equip it starts talking to you and being mean. If you unequip before the weapon has had its fill of killing monsters, it starts paralyzing/damaging/killing off party members.... until you re-equip it hehehe!! :twisted: (so evil)
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by Drakkan »

Hi, that curse thing is actually Diarmuid´s work, but I think you can add this to this thread when you credit him as well. check this link viewtopic.php?f=14&t=4637&p=48894&hilit=curse#p48894
Also having some scroll of "uncursing" should be fine for this matter :)
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by akroma222 »

Checked with Diarmuid - all good - the link is up on the original post, thanks for that Drakkan
And the scroll is a great idea :-) or an uncurse spell for light/dark magic ;-)

Your weapon script is also up on the original post as ONLY "..NAME.." ITEMS
Twas just a slight adjustment from one of the other scripts Marble Mouth and yourself devised...
I have actually used that kind of script for many items, checking for either Class / Race / Skill levels etc
A very useful scripting base for all kinds of special weapons ;)

EDIT- hmmmaybe we could have a script for items that can only be equipped if certain other items are equipped?
.... and that would have to drop off if that certain other item is unequipped... I will have a try :-)
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by akroma222 »

New script/item definition added to OP for custom equipment that uses the unarmed combat skill
These items serve as shields AND weapons (granting evasion bonus, attackpower and tapping special moves learned through the unarmed combat skill)

EDIT - oh man I get too excited about this stuff... sorry the unarmed attacks are being tricky, trying to sort it now.
The weapon works fine as it is... but I am having trouble when calling other functions involving the weapon.
And by trouble I mean crash.
Hopefully will have it sorted soon
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by Drakkan »

just tried the "name" script and it is working exactly as required. Many thanks Akroma !
Breath from the unpromising waters.
Eye of the Atlantis
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Special Weapon Scripts + [ASSETS] weapons/armour/acc/her

Post by akroma222 »

Good stuff Drakkan! 8-)
Post Reply