custom weapon

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

custom weapon

Post by bongobeat »

Hi there,

I need some help plz

how can I attach a custom sound to a custom weapon?
it's a modified weapon of the venom edge, but I would like that every time It shots, it plays a custom sound

I have tried onUse command , but it doesnt work

Code: Select all

onUse = function()
	playSound("uraniumgun")
	end,
SpoilerShow

Code: Select all

defineObject{
	name = "uranium_gun",
	class = "Item",
	uiName = "Uranium Canon",
	model = "assets/models/items/machine_part/machine_part_south.fbx",
	gfxIndex = 99,
	description = "Unknown weapon. One trigger on one extremity, two pipes on the other",
--	skill = "missile_weapons",
--	requiredLevel = 0,
	attackPower = 100,
	coolDownTime = 0.5,
attackMethod = "castWandSpell",
spell = "poison_bolt",
wandPower = 150,
charges = 5,
--	attackMethod = "rangedAttack",
--	attackSound = "uraniumgun",
--	rangedWeapon = true,
--	ammo = "uranium_bullet",
	impactSound = "impact_blade",
	weight = 2.0,
	emptyItem = "damaged_uranium_gun",
	onUse = function()
	playSound("uraniumgun")
	end,
}
I tried to switch it as a ranged weapon, now the custom sound works, but I prefer a weapon with some charges.
Any idea?
Last edited by bongobeat on Sat Jul 13, 2013 7:59 pm, edited 1 time in total.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: custom weapon

Post by LordGarth »

Put this code into your weapon code.

attackSound = "swipe",

Chand swipe with whatever sound you have.

LordGarth
Dungeon Master and DOOM will live forever.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: custom weapon

Post by bongobeat »

that's what i did in the beginning

attackSound = "uraniumgun",

(because there was already a attack sound with the object.)
it worked, but because it was a ranged weapon

then after changing attackMethod = "rangedweapon" into "castWandSpell", with poison bolt spell, the poison bolt sound comes in priority, and I didnt hear the other sound.
Last edited by bongobeat on Sat Jul 13, 2013 8:37 pm, edited 1 time in total.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: custom weapon

Post by LordGarth »

That is probably because it is not attacking so no there is no attack sound it is only launch the spell until it runs out of charges.

I have a way to make melee weapons do there normal physical damage and a magic spell with it if you want.

G
Dungeon Master and DOOM will live forever.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: custom weapon

Post by bongobeat »

mhh, but that will not be a mellee weapon,
it's some kind of canon,

that's why i use a castWandSpell in attack, because it should act like a rands weapon, but without ammo, and with a limited number of charge.

Is there a way to modify the launch sour of the poison bolt?
like creating a new poson bolt spell and change the sound?
LordGarth wrote:That is probably because it is not attacking so no there is no attack sound it is only launch the spell until it runs out of charges.

I have a way to make melee weapons do there normal physical damage and a magic spell with it if you want.

G
Yes please, I want to see yours, maybe it can helps me on this one, or it can be useful for other weapon.
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: custom weapon

Post by LordGarth »

You could copy and paste the posion bolt code from the LOG assets and just change the name to poison bolt 1 and change the name of the launch sound.

LG
Dungeon Master and DOOM will live forever.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: custom weapon

Post by bongobeat »

here is what i ve done (what i have done?!) :D

the new spell
SpoilerShow

Code: Select all

defineSpell{
	name = "ugun",
	uiName = "U Shoot",
	skill = "spellcraft",
	runes = nil, 
	level = 0,
	manaCost = 0,
	onCast = function(caster, x, y, direction, skill)
	local dx,dy = getForward(party.facing)
	local x,y = party.x + dx, party.y + dy
	spawn("poison_bolt_hi", party.level, x, y, party.facing)
end
}
and the new object spawned
SpoilerShow

Code: Select all

defineObject{
	name = "poison_bolt_hi",
	class = "ProjectileSpell",
	particleSystem = "poison_bolt",
	hitParticleEffect = "poison_bolt_hit",
	lightColor = vec(0.25, 0.9, 0.2),
	lightBrightness = 4,
	lightRange = 4,
	lightHitBrightness = 4,
	lightHitRange = 5,
	launchSound = "uraniumgun",
	projectileSound = "poison_bolt",
	hitSound = "poison_bolt_hit",
	screenEffect = "poison_bolt_screen",
	projectileSpeed = 10.5,
	attackPower = 200,
	damageType = "physical",
	cameraShake = true,
	tags = { "spell" },
}
all works
spells, sounds combined with a weapon

just a minor issue, when I kill a monster with it, I don't have any xp

Please can you help for this?
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: custom weapon

Post by LordGarth »

I think there is an ongoing problem with splash damage not giving xp. This is for Almost Human to fix. I would guess that your spell's damage is falling under splash damage category.

LordGarth
Dungeon Master and DOOM will live forever.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: custom weapon

Post by bongobeat »

arhghh :(

You were talking about another way to do a melee weapon? Can you please explain it?
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
User avatar
LordGarth
Posts: 500
Joined: Mon Jun 18, 2012 5:07 pm
Location: Colorado USA

Re: custom weapon

Post by LordGarth »

This is the code I use. venom_edge can be replaced with any weapon name and poison_bolt1 can be replaced with any spell and when the weapon is used it will do physical damage and the spell will be launched as well.

The splash damage problem will most likely still be there though.

defineObject{
name = "party",
class = "Party",
editorIcon = 32,
onAttack = function(champ, weapon)
if (weapon ~= nil) and (weapon.name == "venom_edge") then

if party.facing == 0 then
spawn("poison_bolt1", party.level, party.x, party.y-1, party.facing)
end
if party.facing == 1 then
spawn("poison_bolt1", party.level, party.x+1, party.y, party.facing)
end
if party.facing == 2 then
spawn("poison_bolt1", party.level, party.x, party.y+1, party.facing)
end
if party.facing == 3 then
spawn("poison_bolt1", party.level, party.x-1, party.y, party.facing)
end

end
end
}

LordGarth
Last edited by LordGarth on Mon Jul 15, 2013 5:41 pm, edited 1 time in total.
Dungeon Master and DOOM will live forever.
Post Reply