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

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

Post by akroma222 »

Hey folks!
I have changed the name of this thread from Game Effects - life leech etc..... to Special / Magic Weapon Scripts Thread
... and now it has changed again... to include things and stuff.
I have made a few weapons scripts that will replicate the game effect of life leech (and energy leech) as well as included a script for weapons that have burst spell effects (LG's work)
Any Further weapon scripts will be added here.... and anyone else is welcome, of course, to improve/correct/add their own weapon scripts :D

NOTE - these scripts may well be outdated soon, if not already, by additions to asset definitions, Jkos Framework and Diarmuid's EXSP spell system.
These scripts do not utilize EXSP or Jkos Framework, but I will hopefully convert them over/make them simpler some stage soon

LIFE/ENERGY LEECH + BURST SPELL WEAPONS
This is the set up I have for life leech and burst spell weapons-

I place this in init.lua....
SpoilerShow

Code: Select all

cloneObject{
	name = "party",
	baseObject = "party",
	onAttack = function(champion, weapon)
		return attackingWeaponScripts.specialWeaponAttacks(champion, weapon, skill) 
			
	end
}

And place this into a script entity (attackingWeaponScripts) in your dungeon
(The specialWeaponAttacks function will "sort" which weapon is being used to attack and then call other functions based on that....)
SpoilerShow

Code: Select all

function specialWeaponAttacks(champion, weapon, skill)

  	if (weapon ~= nil) and (weapon.name == "psionic_blade") then
		return attackingWeaponScripts.PsionicBlade(champion, weapon, skill)
	end
	if (weapon ~= nil) and (weapon.name == "reaper_axe_empty") then
		return attackingWeaponScripts.ReaperAxe(champion,weapon,skill)
	end
	if (weapon ~= nil) and (weapon.name == "ice_sabre") then
		return attackingWeaponScripts.burstSpellAttacks(champion,weapon,skill)
	end
	if (weapon ~= nil) and (weapon.name == "brimstone_axe") then
		return attackingWeaponScripts.burstSpellAttacks(champion,weapon,skill)
	end
	if (weapon ~= nil) and (weapon.name == "vorpal_blade") then
		return attackingWeaponScripts.burstSpellAttacks(champion,weapon,skill)
	end
	if (weapon ~= nil) and (weapon.name == "shock_maul") then
		return attackingWeaponScripts.burstSpellAttacks(champion,weapon,skill)
	end
  	return true
end



monstersList = {"amber_slime","ancient_horde","ancient_warrior","bone_slime","crab","crowern","cube","dark_elf_temple_skeleton_archer","dark_elf_temple_skeleton_archer_patrol", "exotic_crab_purple",
			"dark_elf_temple_skeleton_warrior","dark_elf_temple_skeleton_patrol","goromorg","green_lizard","green_slime","herder","herder_big",
			"herder_small","herder_swarm","high_elf_temple_skeleton_archer","high_elf_temple_skeleton_archer_patrol","high_elf_temple_skeleton_warrior","high_elf_temple_skeleton_patrol",
			"ice_slime","isgardian","laguardian","liche","maggot_slime","ogre","red_slime","scavenger","scavenger_swarm","shrakk_torr","skeleton_archer","skeleton_archer_patrol","skeleton_patrol",
			"skeleton_warrior","slug","snail","spider","spider_dark_orange","spider_red","stone_slime05","stone_slime06","stone_slime10","stone_slime11","tentacles","trash_slime",
			"uggardian","urgardian","venom_wyvern","warden","warden_exploding","water_slime","wyvern"}
			
vamp_monster = ""

--------^^^Remember to edit your monstersList to reflect which monsters you are running in your dungeon.....


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

		
----------------------Vampric weapons------------------------------------------------
function ReaperAxe(champion,weapon,skill)
  local dx,dy = getForward(party.facing)
  vamp_champ = champion
  vamp_monster = whichMonster(party.level,party.x+dx,party.y+dy)
  if vamp_monster == "" then
    hudPrint("There's no monster here to drain...")
    return true
  end
  local skill = champion:getSkillLevel("axes")
  party:playScreenEffect("damage_screen")
  vamp_champ:modifyStat("health", (skill/3))
  return true
end

--------------------Syphon weapons---------------------------
function PsionicBlade(champion,weapon,skill)
  local dx,dy = getForward(party.facing)
  syph_champ = champion
  vamp_monster = whichMonster(party.level,party.x+dx,party.y+dy)
  if vamp_monster == "" then
    hudPrint("There's no monster here to drain...")
    return true
  end
  local skill = champion:getSkillLevel("swords")
  party:playScreenEffect("damage_screen_blue")
  syph_champ:modifyStat("energy", (skill/2))
  return true
end

---------------------------------------------------------------

function burstSpellAttacks(champion, weapon, skill)

	if (weapon ~= nil) and (weapon.name == "ice_sabre") then
		if party.facing == 0 then
			spawn("frostburst", party.level, party.x, party.y-1, party.facing)
		end
		if party.facing == 1 then
			spawn("frostburst", party.level, party.x+1, party.y, party.facing)
		end
		if party.facing == 2 then
			spawn("frostburst", party.level, party.x, party.y+1, party.facing)
		end
		if party.facing == 3 then
			spawn("frostburst", party.level, party.x-1, party.y, party.facing)
		end
	end
		if (weapon ~= nil) and (weapon.name == "vorpal_blade") then
		if party.facing == 0 then
			spawn("poison_cloud", party.level, party.x, party.y-1, party.facing)
		end
		if party.facing == 1 then
			spawn("poison_cloud", party.level, party.x+1, party.y, party.facing)
		end
		if party.facing == 2 then
			spawn("poison_cloud", party.level, party.x, party.y+1, party.facing)
		end
		if party.facing == 3 then
			spawn("poison_cloud", party.level, party.x-1, party.y, party.facing)
		end
	end
		if (weapon ~= nil) and (weapon.name == "shock_maul") then
		if party.facing == 0 then
			spawn("shockburst", party.level, party.x, party.y-1, party.facing)
		end
		if party.facing == 1 then
			spawn("shockburst", party.level, party.x+1, party.y, party.facing)
		end
		if party.facing == 2 then
			spawn("shockburst", party.level, party.x, party.y+1, party.facing)
		end
		if party.facing == 3 then
			spawn("shockburst", party.level, party.x-1, party.y, party.facing)
		end
	end	
		if (weapon ~= nil) and (weapon.name == "brimstone_axe") then
		if party.facing == 0 then
			spawn("darkburst", party.level, party.x, party.y-1, party.facing)
		end
		if party.facing == 1 then
			spawn("darkburst", party.level, party.x+1, party.y, party.facing)
		end
		if party.facing == 2 then
			spawn("darkburst", party.level, party.x, party.y+1, party.facing)
		end
		if party.facing == 3 then
			spawn("darkburst", party.level, party.x-1, party.y, party.facing)
		end
	end
^^^Remember to edit your monstersList to reflect which monsters you are running in your dungeon.....

Here are some particle effects that change the colour of the damage screen (you will need 'blue' for psionic blade)-
SpoilerShow

Code: Select all

defineParticleSystem{
	name = "damage_screen",
	emitters = {
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,1},
			boxMax = {0,0,1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/damage_screen.tga",
			lifetime = {0.4, 0.4},
			colorAnimation = false,
			color0 = {0.35, 0, 0},
			opacity = 0.45,
			fadeIn = 0.001,
			fadeOut = 0.3,
			size = {2.3, 2.3},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 0,
			blendMode = "Translucent",
			objectSpace = true,
		}
	}
}

defineParticleSystem{
	name = "damage_screen_blue",
	emitters = {
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,1},
			boxMax = {0,0,1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/damage_screen.tga",
			lifetime = {0.4, 0.4},
			colorAnimation = false,
			color0 = {0, 0, 0.40},
			opacity = 0.45,
			fadeIn = 0.001,
			fadeOut = 0.3,
			size = {2.3, 2.3},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 0,
			blendMode = "Translucent",
			objectSpace = true,
		}
	}
}

defineParticleSystem{
	name = "damage_screen_green",
	emitters = {
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,1},
			boxMax = {0,0,1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/damage_screen.tga",
			lifetime = {0.4, 0.4},
			colorAnimation = false,
			color0 = {0, 0.4, 0},
			opacity = 0.45,
			fadeIn = 0.001,
			fadeOut = 0.3,
			size = {2.3, 2.3},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 0,
			blendMode = "Translucent",
			objectSpace = true,
		}
	}
}

defineParticleSystem{
	name = "damage_screen_black",
	emitters = {
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,1},
			boxMax = {0,0,1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/damage_screen.tga",
			lifetime = {0.4, 0.4},
			colorAnimation = false,
			color0 = {-2, -2, -2},
			opacity = 0.45,
			fadeIn = 0.001,
			fadeOut = 0.3,
			size = {2.3, 2.3},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 0,
			blendMode = "Translucent",
			objectSpace = true,
		}
	}
}


defineParticleSystem{
	name = "damage_screen_pink",
	emitters = {
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,1},
			boxMax = {0,0,1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/damage_screen.tga",
			lifetime = {0.4, 0.4},
			colorAnimation = false,
			color0 = {1.3, 0.2, 0.8},
			opacity = 0.45,
			fadeIn = 0.001,
			fadeOut = 0.3,
			size = {2.3, 2.3},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 0,
			blendMode = "Translucent",
			objectSpace = true,
		}
	}
}
These scripts are based from Grimwold's old burn monster script (which monster/isInTable functions) and also with LordGarths script for the burst spell weapons.
Thank you again guys for your help here!! :D

-----------------------------------------------------------------------------------------------

if RACE/SKILL then BUFF STAT/TRAIT WEAPONS
Marble Mouth has provided us with a code that will not allow your guy to equip the weapon if they do not have the required skill (in maces here) - this will ensure that your guy is not penalised if they remove the mace after reaching the required skill for triggering effects. Further, Marble Mouth has used some tables here to also ensure that if your guy has a trait (like tough) to begin with, equips and unequips the mace, the trait they already had will not disappear!! Good times :D

This is a script for a weapon that will increase strength and add the 'tough' trait if held in hand (slot 7,8) by a Minotaur-
The idea for this weapon is credited to Drakkan and the tricky scripting work was kindly provided by Marble Mouth...

This in items.lua-
SpoilerShow

Code: Select all

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 in a a script entity ("specialWeaponScripts") in dungeon-
**although you can just as well add it to the script entity ("specialWeaponAttacks") provided above, just change it in the above item definition
SpoilerShow

Code: Select all

-------------Drakkan Minotaur Mace-------------------------

allTraits = { "aggressive" , "agile" , "athletic" , "aura" ,
 "cold_resistant" , "evasive" , "fire_resistant" ,
 "fist_fighter" , "head_hunter" , "healthy" , 
 "lightning_speed" , "natural_armor" , "poison_resistant" ,
 "skilled" , "strong_mind" , "tough" }

traitCounts = {}
--Keys are ordinals. Values are tables where:
   --Keys are trait names. Values are the count of how many
   --times that trait has been applied to that champion.
   
for i = 1,4 do
   local champion = party:getChampion(i)
   local currentTraits = {}
   for _ , trait in ipairs( allTraits ) do
      if champion:hasTrait( trait ) then
         currentTraits[trait] = 1
      end
   end
   traitCounts[champion:getOrdinal()] = currentTraits
end

function drakkanMaceEquip(champion, slot)
   local ordinal = champion:getOrdinal()
   local skill = champion:getSkillLevel("maces")
   local name1 = champion:getName()
   if slot == 7 or slot == 8 then
         if skill >= 5 then
               if champion:getRace() == "Minotaur" then
                       champion:modifyStatCapacity("strength", 5)
                       champion:modifyStat("strength", 5)
                       local oldCount = traitCounts[ordinal]["tough"] or 0
                       if oldCount == 0 then
                                champion:addTrait("tough")
                       end
                       traitCounts[ordinal]["tough"] = oldCount + 1
                       hudPrint(""..name1..":Ahh now... THIS is what I have been looking for!")
              end
              return true
      else
      champion:removeItem(slot)
      spawn( "drakkan_minotaur_mace" , party.level , party.x , party.y , party.facing )
      playSound("item_drop")
     end
   end
end

function drakkanMaceUnequip(champion, slot)
    local ordinal = champion:getOrdinal()
    local skill = champion:getSkillLevel("maces")
    local name1 = champion:getName()
    if slot == 7 or slot == 8 then
            if champion:getRace() == "Minotaur" then
                  if skill >= 5 then
                         champion:modifyStatCapacity("strength", -5)
                         champion:modifyStat("strength", -5)
                         traitCounts[ordinal]["tough"] = traitCounts[ordinal]["tough"] - 1
                         if traitCounts[ordinal]["tough"] == 0 then
                                 champion:removeTrait("tough")
                         end
                         hudPrint(""..name1..": Hey, what are you doing? That's my weapon!")
                  end
            end
       end
end
EDIT^^ a couple of slight adjustments made so that if your champ is not "race" they can still equip it if they have sufficient skill

ONLY "...NAME..." ITEMS
With just a slight alteration to the above script - an item/weapon that can only be equipped by a champion
with a specified name. Credits go to Drakkan for this very useful idea...
(Name set to 'Contar Stoneskull' for ease of testing)

For items.lua:
SpoilerShow

Code: Select all

cloneObject{
		name = "stoneskull_staff",
		baseObject = "whitewood_wand",
		uiName = "Contar Stoneskull's Staff",
		model = "assets/models/items/whitewood_wand.fbx",
		description = "A staff belonging to the dazzling and dangerous Contar Stoneskull.",
		gfxIndex = 56,
		energy = 20,
		coolDownTime = 4,
		attackMethod = "meleeAttack",
                attackSwipe = "vertical",
                attackSound = "swipe_heavy",
                impactSound = "impact_blade",
		weight = 3.5,
		onEquipItem = function(champion, slot)
      			return specialNameScripts.contarstaffEquip(champion, slot)
   		end,
	}
And this paste this into a script entity ("specialNameScripts") in your dungeon:
SpoilerShow

Code: Select all

function contarstaffEquip(champion, slot)
   local ordinal = champion:getOrdinal()
   local name1 = champion:getName()
   if slot == 7 or slot == 8 then
      if name1 == "Contar Stoneskull" then
         hudPrint(""..name1..":Ahh this does indeed belong to me!")
      else
      champion:removeItem(slot)
      spawn( "stoneskull_staff" , party.level , party.x , party.y , party.facing )
      playSound("item_drop")
	  hudPrint("Only Contar Stoneskull may weild this magical staff...")
     end
   end
end
CURSED ITEMS - cannot be removed
I am just providing a link here to Diarmuid's thread for items that cannot be removed (cursed if you will)
There is a version using the Jkos Framework and a version that does not.
All credits to Diarmuid :D
viewtopic.php?f=14&t=4637


UNARMED COMBAT WEAPONS
This is a solution for folks wanting to include custom equipment/weapons for the unarmed combat skill AND would like those items to be seen in hand and not just through the inventory.
These items actually serve as shields that you can attack with - granting an evasion bonus, an attack power bonus and also utilise the special moves learned through the unarmed combat skill.
An items.lua definition:
SpoilerShow

Code: Select all

defineObject{
		name = "brass_knuckles",
		class = "Item",
		uiName = "Brass Knuckles",
		model = "assets/models/items/pit_gauntlets.fbx",
		gfxIndex = 55,
		skill = "unarmed_combat",
		requiredLevel = 5,
		attackPower = 10,
		accuracy = 0,
		evasion = 2,
		coolDownTime = 4.0,
		attackMethod = "meleeAttack",
		attackSwipe = "horizontal",
		attackSound = "swipe_heavy",
		impactSound = "impact_blunt",
		weight = 1.5,
		description = "........................................",
		shield = true,
}
These items can be given certain conditional bonuses and also be given burstspell affects etc (as seen in the above weapon scripts).
**Even though you are attacking with unarmed skill, an onAttack hook that calls a function in your dungeon will still pass the item as a weapon (whereas attacking with nothing in hand passes weapon == nil)

The nagging issue remains that - if you create a spikey gauntlet you will still be able to have equipped another real gauntlet... which may not seem too possible...


WEAPONS/ARMOUR/ITEMS - MODELS/TEXTURES/ICONS

So here are a few of the custom items from the currently available half of Labyrinth of Lies.
Some of these will match up with the above weapon scripts. There are also pieces of armour, herbs and more....
There is a pic of all the available items here in inventory (follow the link for models and textrures). In game models are fairly accurate (except for katana :roll: )
Also available are both my current icon atlases... there are item icons here that are not yet included anywhere - feel free to use them at will
If anyone would like to make up some models for icons that have no models - I am all for it (just have not gotten around to it yet)

NEXUS DOWNLOAD - Akroma Assets 1.0
http://grimrock.nexusmods.com/mods/238

Inventory:

Accessories
-Amulet of Life
-Amulet of Growth
-Amulet of Rainbows

Weapons
-Star Bolter
-Death Star
-Gladiator Blade
-Precision Dagger
-Katana
-Vorpal Blade
-Reaper Axe
-Shock Maul
-Coil of the Serpent
-Monstrance

Armour
-Gauntlets of Might
-Dragon Slayer's Shield
-Leggings of Fire Resist
-Vest of Flameproof
-Boots of Speed
-Iron Crown
-Mage Mail

Herbs
-Gaia Bell
-Willow Thorn
-Bloodreed
-Frost Cap
-Night Bead
-Dewdrop Root

Here is the link for models/textures and icon atlas:
http://ge.tt/6m8wu9b

Here are the material.lua scripts:
SpoilerShow

Code: Select all


defineMaterial{
	name = "mage_mail",
	
        diffuseMap = "mod_assets/textures/mage_mail_dif.tga",
	
        specularMap = "assets/textures/items/chitin_mail_spec.tga",
	
        doubleSided = false,
	
        lighting = true,
	
        alphaTest = false,
	
        blendMode = "Opaque",
	
        textureAddressMode = "Wrap",
	
        glossiness = 20,
	
        depthBias = 0,
}

defineMaterial{
	
	name = "amulet_life",
	
	diffuseMap = "mod_assets/textures/amulet_life_dif.tga",
	
	specularMap = "assets/textures/items/spirit_mirror_pendant_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 40,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "amulet_growth",
	
	diffuseMap = "mod_assets/textures/amulet_growth_dif.tga",
	
	specularMap = "assets/textures/items/spirit_mirror_pendant_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 40,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "amulet_rainbows",
	
	diffuseMap = "mod_assets/textures/amulet_rainbows_dif.tga",
	
	specularMap = "assets/textures/items/spirit_mirror_pendant_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 40,
	
	depthBias = 0,

}


defineMaterial{
	
	name = "leggings_fire",
	
	diffuseMap = "mod_assets/textures/leggings_fire_dif.tga",
	
	specularMap = "assets/textures/items/peasant_clothes_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "boots_speed",
	
	diffuseMap = "mod_assets/textures/boots_speed_dif.tga",
	
	specularMap = "assets/textures/items/leather_boots_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 25,
	
	depthBias = 0,

}


defineMaterial{
	
	name = "vest_flameproof",
	
	diffuseMap = "mod_assets/textures/vest_flameproof_dif.tga",
	
	specularMap = "assets/textures/items/blue_clothes_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}


defineMaterial{
	
	name = "reaper_axe",
	
	diffuseMap = "mod_assets/textures/reaper_axe_dif.tga",
	
	specularMap = "assets/textures/items/ancient_axe_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 40,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "gladiator_blade",
	
	diffuseMap = "mod_assets/textures/gladiator_blade_dif.tga",
	
	specularMap = "assets/textures/items/machete_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}




defineMaterial{
	
	name = "vorpal_blade",
	
	diffuseMap = "mod_assets/textures/vorpal_blade_dif.tga",
	
	specularMap = "assets/textures/items/cutlass_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 30,
	
	depthBias = 0,

}




defineMaterial{
	
	name = "precision_dagger",
	
	diffuseMap = "mod_assets/textures/precision_dagger_dif.tga",
	
	specularMap = "assets/textures/items/dagger_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}




defineMaterial{
	
	name = "monstrance",
	
	diffuseMap = "mod_assets/textures/monstrance_dif.tga",
	
	specularMap = "assets/textures/items/whitewood_wand_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "coil_of_serpent",
	
	diffuseMap = "mod_assets/textures/coil_of_serpent_dif.tga",
	
	specularMap = "assets/textures/items/serpent_bracer_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 15,
	
	depthBias = 0,

}


defineMaterial{
	
	name = "death_star",
	
	diffuseMap = "mod_assets/textures/death_star_dif.tga",
	
	specularMap = "assets/textures/items/shuriken_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}


defineMaterial{
	
	name = "Star_bolter",
	
	diffuseMap = "mod_assets/textures/star_bolter_dif.tga",
	
	specularMap = "assets/textures/items/crossbow_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}







defineMaterial{
	
	name = "shock_maul",
	
	diffuseMap = "mod_assets/textures/shock_maul_dif.tga",
	
	specularMap = "assets/textures/items/warhammer_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 30,
	
	depthBias = 0,

}


defineMaterial{
	
	name = "katana",
	
	diffuseMap = "mod_assets/textures/katana_dif.tga",
	
	specularMap = "assets/textures/items/scimitar_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "dragon_slayer_shield",
	
	diffuseMap = "mod_assets/textures/dragon_slayer_shield_dif.tga",
	
	specularMap = "assets/textures/items/shield_valor_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 40,
	
	depthBias = 0,

}



defineMaterial{
	
	name = "night_bead",
	
	diffuseMap = "mod_assets/textures/night_bead_dif.tga",
	
	specularMap = "assets/textures/items/tar_bead_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}


defineMaterial{
	
	name = "willow_thorn",
	
	diffuseMap = "mod_assets/textures/willow_thorn_dif.tga",
	
	specularMap = "assets/textures/common/black.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "bloodreed",
	
	diffuseMap = "mod_assets/textures/bloodreed_dif.tga",
	
	specularMap = "assets/textures/items/milkreed_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "gaia_bell",
	
	diffuseMap = "mod_assets/textures/gaia_bell_dif.tga",
	
	specularMap = "assets/textures/items/slime_bell_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}






defineMaterial{
	
	name = "dewdrop_root",
	
	diffuseMap = "mod_assets/textures/dewdrop_root_dif.tga",
	
	specularMap = "assets/textures/items/blooddrop_blossom_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "iron_crown",
	
	diffuseMap = "mod_assets/textures/iron_crown_dif.tga",
	
	specularMap = "assets/textures/items/circlet_war_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "gauntlets_might",
	
	diffuseMap = "mod_assets/textures/gauntlets_might_dif.tga",
	
	specularMap = "assets/textures/items/plate_gauntlets_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 40,
	
	depthBias = 0,

}

defineMaterial{
	
	name = "frostcap",
	
	diffuseMap = "mod_assets/textures/frostcap_dif.tga",
	
	specularMap = "assets/textures/items/grimcap_spec.tga",
	
	doubleSided = false,
	
	lighting = true,
	
	alphaTest = false,
	
	blendMode = "Opaque",
	
	textureAddressMode = "Wrap",
	
	glossiness = 20,
	
	depthBias = 0,

}


Here are the item.lua scripts:
SpoilerShow

Code: Select all

cloneObject{
   name = "night_bead",
   baseObject = "tar_bead",
   uiName = "Night Bead",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 11,
   description = "An exotic herb known for the way it glimers with purple light at evening. Myth has it that if you find yourself surrounded by night beads, certain doom awaits you.",
   model = "mod_assets/models/night_bead.fbx",
   stackable = true,
   weight = 0.1,
}

cloneObject{
   name = "willow_thorn",
   baseObject = "cave_nettle",
   uiName = "Willow Thorn",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 13,
   description = "A rare herb used in only the most potent of mixtures designed to warp and trick the body and mind.",
   model = "mod_assets/models/willow_thorn.fbx",
   stackable = true,
   weight = 0.1,
}

cloneObject{
   name = "bloodreed",
   baseObject = "milkreed",
   uiName = "Bloodreed",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas_working.tga",
   gfxIndex = 18,
   description = "An extremely powerful healing herb, used only by the most experienced alchemists.",
   model = "mod_assets/models/bloodreed.fbx",
   stackable = true,
   weight = 0.1,
}

cloneObject{
   name = "gaia_bell",
   baseObject = "slime_bell",
   uiName = "Gaia Bell",
   description = "The shine from this exotic herb feels warm and prickly.",
   model = "mod_assets/models/gaia_bell.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 15,
   stackable = true,
   weight = 0.3,
}

cloneObject{
   name = "frost_cap",
   baseObject = "grim_cap",
   uiName = "Frost Cap",
   description = "A herb abundantly found in the Northern Wastes. Rare in practice, however, due to the Isgardian threat.",
   model = "mod_assets/models/frostcap.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas_working.tga",
   gfxIndex = 20,
   stackable = true,
   consumable = true,
   nutritionValue = 200,
   weight = 0.3,
}
cloneObject{
   name = "dewdrop_root",
   baseObject = "blooddrop_blossom",
   uiName = "Dewdrop Root",
   description = "One of most rare and exclusive herbs known in Amadacia. Rulers and powerful merchants would sometimes use this herb for recreational purposes in small amounts.",
   model = "mod_assets/models/dewdrop_root.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 19,
   stackable = true,
   weight = 0.3,
}
defineObject{
   name = "coil_of_the_serpent",
   class = "Item",
   uiName = "Coil of the Serpent",
   model = "mod_assets/models/coil_of_serpent.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 6,
   skill = "staves",
   requiredLevel = 30,
   attackPower = 45,
   strength = 2,
   accuracy = 10,
   willpower = 2,
   energy = 50,
   resistPoison = 20,
   coolDownTime = 3,
   attackMethod = "meleeAttack",
   attackSwipe = "vertical",
   attackSound = "swipe_special",
   impactSound = "impact_blunt",
   description = "A majestically crafted coil then unravels from the battlemage's wrist upon swinging, lashing out over a distance. Only in stories of myth and legends has such a weapon been thought of.",
   damageType = "poison",
   weight = 2.5,
   reachWeapon = true,
}

defineObject{
   name = "iron_crown",
   class = "Item",
   uiName = "Iron Crown",
   model = "mod_assets/models/iron_crown.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   slot = "Head",
   gfxIndex = 14,
   protection = 2,
   vitality = 2,
   strength = 2,
   resistCold = 20,
   description = "This crown, once worn by the fjord kings, is chilling to the touch.",
   weight = 2.0,
}

defineObject{
   name = "death_star",
   class = "Item",
   uiName = "Death star",
   model = "mod_assets/models/death_star.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 9,
   throwingWeapon = true,
   ammoType = "shuriken",
   skill = "throwing_weapons",
   requiredLevel = 12,
   attackPower = 25,
   damageType = "poison",
   attackMethod = "throwAttack",
   attackSound = "swipe",
   impactSound = "impact_blade",
   stackable = true,
   sharpProjectile = true,
   projectileRotationSpeed = 15,
   projectileRotationX = 90,
   projectileRotationY = -90,
   weight = 0.1,
   coolDownTime = 2.5,
   description = "Coated with a magical venomous aura, these rare weapons are the prize weapon of the true assassin.",
}   
cloneObject{
   name = "gauntlets_might",
   baseObject = "plate_gauntlets",
   uiName = "Gauntlets of Might",
   model = "mod_assets/models/gauntlets_might.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 22,
   armourSkill = "heavy_armour",
   slot = "Gauntlets",
   strength = 2,
   protection = 8,
   description = "Brutal gauntlets, gifteing the wearer with superior strength.",
}
defineObject{
   name = "star_bolter",
   class = "Item",
   uiName = "Star Bolter",
   model = "mod_assets/models/star_bolter.fbx",
   skill = "missile_weapons",
   requiredSkill = 22,
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 7,
   attackPower = 30,
   coolDownTime = 3.0,
   attackMethod = "rangedAttack",
   attackSound = "swipe_bow",
   impactSound = "impact_blunt",
   rangedWeapon = true,
   ammo = "shuriken",
   weight = 1.5,
   description = "A crossbow customised to shoot shurikens and other such projectiles... probably invented by quite the lazy ninja.",
}
cloneObject{
   name = "reaper_axe",
   baseObject = "ancient_axe",
   uiName = "Reaper Axe",
   model = "mod_assets/models/reaper_axe.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 27,
   skill = "axes",
   requiredLevel = 0,
   attackPower = 24,
   accuracy = 0,
   resistPoison = 20,
   strength = 2,
   coolDownTime = 4.0,
   attackMethod = "meleeAttack",
   attackSwipe = "vertical",
   attackSound = "swipe_heavy",
   impactSound = "impact_blade",
   weight = 4.5,
   description = "A horrific axe, bladed and hooked... the presence of it in your hand makes you feel like emptying your stomach.",
   gameEffect = "LifeLeech - successful hits will drain health from your target and heal you.",
}
defineObject{
   name = "shock_maul",
   class = "Item",
   uiName = "Shock Maul",
   model = "mod_assets/models/shock_maul.fbx",
   gfxAtlas = "mod_assets/textures/items_2-altered.tga",
   gfxIndex = 20,
   skill = "maces",
   requiredLevel = 22,
   attackPower = 30,
   dexterity = -2,
   accuracy = -25,
   coolDownTime = 5.5,
   resistCold = 20,
   damageType = "shock",
   attackMethod = "meleeAttack",
   attackSwipe = "vertical",
   attackSound = "swipe_heavy",
   impactSound = "impact_blunt",
   description = "An unweildly mace- fortunately, while its' swings often miss their target, it's electical powers never do.",
   weight = 7.5,
}

cloneObject{
   name = "gladiator_blade",
   baseObject = "machete",
   uiName = "Gladiator Blade",
   model = "mod_assets/models/gladiator_blade.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 20,
   attackPower = 16,
   coolDownTime = 3.5,
   strength = 1,
   dexterity = 1,
   vitality = 2,
   requiredLevel = 12,
   description = "A battle seasoned blade, old but empowering.",
}

cloneObject{
   name = "vorpal_blade",
   baseObject = "cutlass",
   uiName = "Vorpal Blade",
   model = "mod_assets/models/vorpal_blade.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas_working.tga",
   gfxIndex = 32,
   requiredLevel = 17,
   attackPower = 20,
   accuracy = 4,
   dexterity = 2,
   evasion = 2,
   coolDownTime = 3.3,
   damageType = "poison",
   description = "A sleek blade favoured by lizard folk. Venomous fumes eminate from the jewelled blade.",
}
cloneObject{
   name = "katana",
   baseObject = "nex_sword",
   uiName = "Katana",
   model = "mod_assets/models/katana.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 32,
   skill = "swords",
   requiredLevel = 18,
   attackPower = 20,
   attackSwipe = "horizontal", --{ {time=0, swipe="horizontal"}, {time=0.2, swipe="vertical"}, {time=0.4, swipe="horizontal"} },
   dexterity = 3,
   accuracy = 10,
   coolDownTime = 2.0,
   description = "The sword of the practiced swordsman- swift, nimble and deadly.",
}
cloneObject{
   name = "precision_dagger",
   baseObject = "dagger",
   uiName = "Precision Dagger",
   model = "mod_assets/models/precision_dagger.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas_working.tga",
   gfxIndex = 57,
   requiredLevel = 10,
   attackPower = 10,
   accuracy = 20,
   dexterity = 2,
   description = "A finely crafted dagger, almost always finding it's target off guard.",
}
defineObject{
   name = "monstrance",
   class = "Item",
   model = "mod_assets/models/monstrance.fbx",
   uiName = "Monstrance",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas_working.tga",
   gfxIndex = 24,
   skill = "staves",
   requiredLevel = 3,
   attackPower = 12,
   strength = 1,
   willPower = 1,
   accuracy = 0,
   energy = 20,
   coolDownTime = 4.0,
   description = "A long staff carried by mages who are building their arcane defensive skills.",
   attackMethod = "meleeAttack",
   attackSwipe = "vertical",
   impactSound = "impact_blunt",
   attackSound = "swipe_light",
   reachWeapon = true,
   weight = 3.5,
}
cloneObject{
   name = "amulet_life",
   baseObject = "spirit_mirror_pendant",
   uiName = "Amulet of Life",
   model = "mod_assets/models/amulet_life.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas_working.tga",
   gfxIndex = 42,
   vitality = 2,
   willpower = 2,
   description = "The jewel embedded within this amulet makes you feel an unfamiliar kind of relaxation.",
   gameEffect = "",
}
cloneObject{
   name = "amulet_growth",
   baseObject = "spirit_mirror_pendant",
   uiName = "Amulet of Growth",
   model = "mod_assets/models/amulet_growth.fbx",
   gfxAtlas = "mod_assets/textures/icon1.tga",
   gfxIndex = 74,
   vitality = 2,
   willpower = 2,
   description = "The jewel embedded within this amulet stirs a great creative and motivating feeling within you.",
}
cloneObject{
   name = "amulet_rainbows",
   baseObject = "spirit_mirror_pendant",
   uiName = "Amulet of Rainbows",
   model = "mod_assets/models/amulet_rainbows.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas_working.tga",
   gfxIndex = 43,
   resistFire = 5,
   resistCold = 5,
   resistPoison = 5,
   resistShock = 5,
   description = "The jewel within this amulet somehow amplifies and reflects the dim light around you, sending spinning colours over you and your party.",
   gameEffect = "",
}
defineObject{
   name = "mage_mail",
   class = "Item",
   baseObject = "chitin_mail",
   uiName = "Mage Mail",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 33,
   model = "mod_assets/models/mage_mail.fbx",
   slot = "Torso",
   skill = "staves",
   requiredLevel = 18,
   armorSkill = "light_armour",
   protection = 12,
   willpower = 2,
   energy = 30,
   resistFire = 10,
   resistPoison = 10,
   resistShock = 10,
   resistCold = 10,
   description = "An expertly crafted mail vest, infused with arcane magicks, allowing the wearer to cast spells with greater ease.",
   weight = 4.0,
}

cloneObject{
   name = "dragon_slayer's_shield",
   baseObject = "shield_valor",
   uiName = "Dragon Slayer's Shield",
   armourSkill = "heavy_armour",
   model = "mod_assets/models/dragon_slayer_shield.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 12,
   evasion = 14,
   strength = 2,
   resistFire = 40,
   description = "A legendary shield known by it's ability to ward off even the most terrible of fiery assaults.",
}


defineObject{
   name = "boots_of_speed",
   class = "Item",
   uiName = "Boots of Speed",
   model = "mod_assets/models/boots_speed.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 25,
   slot = "Feet",
   protection = 4,
   dexterity = 2,
   weight = 1.0,
   description = "Magical boots, allowing the wearer and those around them to evoke powers of incredible speed. Inconveniently, to activate the boots, the wearer must tap on the toes of the boots....",
}


cloneObject{
   name = "leggings_of_fire_resistance",
   baseObject = "peasant_breeches",
   uiName = "Leggings of Fire Resistance",
   model = "mod_assets/models/leggings_fire.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 5,
   resistFire = 20,
   protection = 3,
   description = "These pants are made from a strange fire retardant material.",
}

cloneObject{
   name = "vest_of_flameproof",
   baseObject = "doublet",
   uiName = "Vest of Flameproof",
   model = "mod_assets/models/vest_of_flameproof.fbx",
   gfxAtlas = "mod_assets/textures/akroma_icon_atlas.tga",
   gfxIndex = 28,
   protection = 4,
   resistFire = 60,
   description = "This garment is made of a magical material that completely dispells heat.",
   weight = 2.0,
}
NOTE** - for the amulets, I have spells stuck on them as they are (with their empty amulet definitions) - you will need to find the appropriate spells, or put some other spell on them, or alter the item definition so they do not have spells attached. Same for boots of speed.

Let me know if there are any dramas here, enjoy!! :D
*Mage Mail still equips regardless of skill - fixing soon
Last edited by akroma222 on Fri Apr 12, 2013 8:07 am, edited 32 times in total.
User avatar
Edsploration
Posts: 104
Joined: Wed Sep 19, 2012 4:32 pm

Re: Game Effects - shed some light?

Post by Edsploration »

The gameEffect parameter is only for adding text to the tooltip of the item (seen when you mouse-over the item in your inventory). It does not actually add the effect to the item.
As far as I know, unfortunately, all these effects (except for tomes) are hard-coded in the game and cannot be modified in the lua script. You should probably be able to cloneObject from the assassin_dagger, however, to keep that hard-coded effect. Something like:

Code: Select all

cloneObject{
	baseObject = "assassin_dagger",
	name = "my_axe",
	class = "Item",
	uiName = "Akroma222's Axe",
	model = "assets/models/items/battle_axe.fbx",
	description = "A custom axe with leach life!",
	skill = "axes",
	requiredLevel = 10,
	gfxIndex = 86,
	attackPower = 20,
	accuracy = 0,
	coolDownTime = 5.2,
	attackMethod = "meleeAttack",
	attackSwipe = "horizontal",
	attackSound = "swipe",
	impactSound = "impact_blade",
	gameEffect = "Life Leech: Successful hit drains life from target and heals you",
	weight = 4.0,
}
Open Project -> Community FrankenDungeon: viewtopic.php?f=14&t=4276
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Game Effects - shed some light?

Post by msyblade »

Use defineObject instead of cloneObject. define the dagger, but replace the UI name and the model/icon with the axe you want,and I THINK it will replace the assassins dagger in the game with your axe, and have the leech on it, but you won't have the dagger anymore.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
User avatar
crisman
Posts: 305
Joined: Sat Sep 22, 2012 9:23 pm
Location: Italy

Re: Game Effects - shed some light?

Post by crisman »

The only thing I managed to make is simulating Earthbound and Intense Fire for my custom spells...
I don't think something else can be be simulated for now.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Game Effects - shed some light?

Post by akroma222 »

Ah thanks for the pointers guys...

Unfortunately Edsploration, cloning the assassin dagger with new models/icon etc did not work (but thanks for your idea - seems like you should be able to that way right?), however, re defining the assassin dagger with different model/icon did work.... but you are right msyblade, I lost the assassin dagger (which I wish to keep) - but still handy to know!

Crisman, how did you manage to replicate the enhanced realm effects for your spells? curious....
User avatar
Komag
Posts: 3654
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Game Effects - shed some light?

Post by Komag »

Some of it you could hack with onAttack or maybe onUseItem, detect whether the weapon is the special one you created, then script in the effects you want. For leech life, you could script a certain percentage chance of doing some extra damage to the enemy and adding some hp to the player. It would be somewhat of a complex script, but I believe it is possible at least.
Finished Dungeons - complete mods to play
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Game Effects - shed some light?

Post by akroma222 »

Ahh Komag!! Yes yes, I could probably adapt LordGarth's script that fires off spells if a certain weapon is being attacked with.... let me try....
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Game Effects - shed some light?

Post by akroma222 »

OK, complex indeed... probably deluding myself if I thought I could manage this one solo..
What I have done so far (based from other scripts) is incomplete and bits I do not know how to do are [--like this--]
SpoilerShow

Code: Select all

cloneObject{
	name = "party",
	baseObject = "party",
	onAttack = function(champ, weapon)
		local heal_amount = math.random(2,4) /2	
		local character_to_heal = [--check for which champ has reaper axe--]	
		if (weapon ~= nil) and (weapon.name == "reaper_axe") and [--attack is successful--] then
			party:getChampion(character_to_heal):modifyStat("health", heal_amount)
		end
	end
}
Am I on the right track here? Really not sure on [--these--] bits.. :oops:
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: Game Effects - shed some light?

Post by akroma222 »

Ok, so I have finally got a 'vampric (life leeching) weapon' script up and running!
EDIT - new script that will not drain/leech when there is no monster in front has been added - pls update

I place this in init.lua....
SpoilerShow
cloneObject{
name = "party",
baseObject = "party",
onAttack = function(champion, weapon)
return attackingWeaponScripts.specialWeaponAttacks(champion, weapon, skill)

end
}

}
And place this into a script entity (vampricScript) in your dungeon....
SpoilerShow
function specialWeaponAttacks(champion, weapon, skill)

if (weapon ~= nil) and (weapon.name == "psionic_blade") then
return attackingWeaponScripts.PsionicBlade(champion, weapon, skill)
end
if (weapon ~= nil) and (weapon.name == "reaper_axe_empty") then
return attackingWeaponScripts.ReaperAxe(champion,weapon,skill)
end
return true
end

monstersList = {"amber_slime","ancient_horde","ancient_warrior","bone_slime","crab","crowern","cube","dark_elf_temple_skeleton_archer","dark_elf_temple_skeleton_archer_patrol","exotic_crab_purple","dark_elf_temple_skeleton_warrior","dark_elf_temple_skeleton_patrol","goromorg","green_lizard","green_slime","herder","herder_big","herder_small","herder_swarm","high_elf_temple_skeleton_archer","high_elf_temple_skeleton_archer_patrol","high_elf_temple_skeleton_warrior","high_elf_temple_skeleton_patrol","ice_slime","isgardian","laguardian","liche","maggot_slime","ogre","red_slime","scavenger","scavenger_swarm","shrakk_torr","skeleton_archer","skeleton_archer_patrol","skeleton_patrol","skeleton_warrior","slug","snail","spider","spider_dark_orange","spider_red","stone_slime05","stone_slime06","stone_slime10","stone_slime11","tentacles","trash_slime","uggardian","urgardian","venom_wyvern","warden","warden_exploding","water_slime","wyvern"}

----You will need to alter your monstersList to reflect only the monsters you are running in your mod-----

vamp_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

----------------------Vampric weapons------------------------------------------------
function ReaperAxe(champion,weapon,skill)
local dx,dy = getForward(party.facing)
vamp_champ = champion
vamp_monster = whichMonster(party.level,party.x+dx,party.y+dy)
if vamp_monster == "" then
hudPrint("There's no monster here to drain...")
return true
end
local skill = champion:getSkillLevel("axes")
party:playScreenEffect("damage_screen")
vamp_champ:modifyStat("health", (skill/3))
return true
end

--------------------Syphon weapons---------------------------
function PsionicBlade(champion,weapon,skill)
local dx,dy = getForward(party.facing)
syph_champ = champion
vamp_monster = whichMonster(party.level,party.x+dx,party.y+dy)
if vamp_monster == "" then
hudPrint("There's no monster here to drain...")
return true
end
local skill = champion:getSkillLevel("swords")
party:playScreenEffect("damage_screen_blue")
syph_champ:modifyStat("energy", (skill/2))
return true
end

---------------------------------------------------------------
This script is largely based from Grimwold's burn monster/(and Akroma's) smite undead/recharge item spell scripts...
Thank you again Grimwold... altering your script examples keeps me feeling like I'm half way descent at this ;)

EDIT - script changed (old version gained you health/energy regardless of whether you hit a monster) - new version works fine now (I hope)
Last edited by akroma222 on Tue Mar 12, 2013 11:46 am, edited 2 times in total.
User avatar
Komag
Posts: 3654
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: Game Effects - LifeLeech weapons sorted....

Post by Komag »

Nice to see you got this to work, congrats! :)
Finished Dungeons - complete mods to play
Post Reply