Page 5 of 21

Re: New Spells >> show them off here

Posted: Fri Oct 12, 2012 10:09 pm
by Merethif
Grimwold wrote:I've added a sound effect to the Push Monster Spell above... there's now also an Optional Particle Effect, which requires some particle definition code to be added to the lua files (I use a particles.lua file and add an import line in init.lua)
Your genius never cease to amaze me Great Spell Weaver :-D

Re: New Spells >> show them off here

Posted: Sun Oct 14, 2012 9:48 am
by Szragodesca
I have a suggestion that would help the new modders such as myself when it comes to the spells. I can read and understand them due to my past playing with scripting in various other games, but what I don't know is the Rune names. I've been looking in the AH resources, on the wiki page, and I've done a couple searches (here and on Google) but can't find any references to which rune coincides with which letter.
Note: I've sucked at finding things since I was an infant, so it's no surprise. :oops:

*comes back to the post after playing around in Eclipse and the LoG Editor*
If someone could verify this is correct and, if so, put it up on the wiki page and/or OP of this thread, I'm sure it would help a lot of new modders.
Image showing rune names for scripting
Made a number of scrolls and put them in an alcove, each tied to a test spell that required various rune combinations (ABC, AH, BF, etc.) and then used GIMP to edit a screencap of the runes on a spell with no rune requirements. So yeah, hope it's accurate. :P

Re: New Spells >> show them off here

Posted: Sun Oct 14, 2012 9:57 am
by Neikun
It is indeed true that the runes start from the top left corner as A and end at the bottom right corner as I

Re: New Spells >> show them off here

Posted: Sun Oct 14, 2012 11:34 am
by Komag
Szragodesca wrote:Image
Image showing rune names for scripting
That's a nice little pic, I love it! I'm sure others will find it useful :)

Re: New Spells >> show them off here

Posted: Sun Oct 14, 2012 7:55 pm
by JKos
Magic missile

I created this for my framework viewtopic.php?f=14&t=3321&start=30#p38098
but it can be done easily without the framework too, so I post it here.
I also made hold monster spell, but it's pretty hard to do without dynamic hooks (see above link)

Code: Select all

defineSpell{
	   name = "magic_missile",
	   uiName = "Magic missile",
	   skill = "fire_magic",
	   level = 0,
	   runes = "AD",
	   manaCost = 15,
	  onCast = function(champ, x, y, direction, skill)
	  	local dx,dy = getForward(party.facing)
	  	playSoundAt("fireball_launch",party.level,party.x,party.y)
	  	shootProjectile('magic_missile', party.level, party.x+dx, party.y+dy, direction, 14, 0, 0, 0, 0, 0, skill*5, nil, true)
	  end
}


defineObject{
		name = "magic_missile",
		class = "Item",
		uiName = "Magic missile",
		model = "assets/models/items/quarrel.fbx", --assets/models/items/arrow.fbx
		--ammoType = "arrow",
		gfxIndex = 109,
		attackPower = 1,
		impactSound = "fireball_hit",
		particleEffect = "magic_missile",
		stackable = false,
		sharpProjectile = false,
		projectileRotationY = 90,
		weight = 0.1,
}
defineParticleSystem{
	name = "magic_missile",
	emitters = {
		-- flames
		{
			emissionRate = 50,
			emissionTime = 0,
			maxParticles = 50,
			boxMin = {-0.0, -0.0, 0.0},
			boxMax = { 0.0, 0.0,  -0.0},
			sprayAngle = {0,360},
			velocity = {0.3, 0.3},
			texture = "assets/textures/particles/torch_flame.tga",
			frameRate = 35,
			frameSize = 64,
			frameCount = 16,
			lifetime = {0.8, 0.8},
			colorAnimation = true,
			color0 = {1, 1, 1},
			opacity = 1,
			fadeIn = 0.15,
			fadeOut = 0.3,
			size = {0.125, 0.25},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 1,
			blendMode = "Additive",
			objectSpace = true,
		},

		-- glow
		{
			spawnBurst = true,
			emissionRate = 1,
			emissionTime = 0,
			maxParticles = 1,
			boxMin = {0,0,-0.1},
			boxMax = {0,0,-0.1},
			sprayAngle = {0,30},
			velocity = {0,0},
			texture = "assets/textures/particles/glow.tga",
			lifetime = {1000000, 1000000},
			colorAnimation = false,
			color0 = {1, 1, 1},
			opacity = 1,
			fadeIn = 0.1,
			fadeOut = 0.1,
			size = {0.8, 0.8},
			gravity = {0,0,0},
			airResistance = 1,
			rotationSpeed = 2,
			blendMode = "Additive",
			objectSpace = true,
		}
	}
}

Re: New Spells >> show them off here

Posted: Sun Oct 14, 2012 9:25 pm
by crisman
Explosive Mines

I'm working on a spell that lays a mine on the ground. Right now I have made a fireburst version just to test it out, and it's working great! But I'll have to work on it more, I don't like the code so much right now, but I'll share it if someone wants to help me!

Spell itself, with a modified version of fireburst.

Code: Select all

defineSpell{
   name = "explosive_mine",
   uiName = "Explosives Mine",
   runes = "AGH",
   skill = "fire_magic",
   level = 2,
   manaCost = 35,
   onCast = function(champion, x, y, direction, skill)
	magic.explosive_mine()
return true
   end,
}

defineObject{
	name = "fireburst3",
	class = "BurstSpell",
	screenEffect = "fireball_screen",
	particleSystem = "fireburst",
	lightColor = vec(0.75, 0.4, 0.25),
	lightBrightness = 40,
	lightRange = 4,
	sound = "fireburst",
	attackPower = 40,
	damageType = "fire",
	--cameraShake = true,
	tags = { "spell" },
}

and the script in game, called magic

Code: Select all

function explosive_mine()

if findEntity("counterMine") == nil then
	spawn("counter", party.level, party.x, party.y, 0, "counterMine")
end

a = "mine"..counterMine:getValue()
spawn("pressure_plate_hidden", party.level, party.x, party.y, 0, a)
:setTriggeredByParty(false)
:setTriggeredByMonster(true)
:setTriggeredByItem(false)
:addConnector("any", "magic", "detonate")


counterMine:increment()

end

function detonate()

for i = 0, counterMine:getValue() do
a = findEntity("mine"..i)
	if a ~= nil then
		if a:isDown() then
			spawn("fireburst3", a.level, a.x, a.y, 0)
			a:destroy()
			return
		end
	end
end
end
The mine will be deployed right on the tile the party is. It won't detonate if the party steps on it.
There is no visual effect to identify the mine - right now, I have no idea what effect I can use. But it works. Any suggestion are welcome!
Have fun!

EDIT: Completely forgot: To make this work, you have to place a counter and rename counterMine. I'll change the code so it's the game that will do that...
EDIT2: now it should work without placing the counter. that will do the game ... Hope you don't have already a counter with that name thought...

Re: New Spells >> show them off here

Posted: Sun Oct 14, 2012 11:21 pm
by Merethif
crisman wrote:Explosive Mines
When casting spell in preview window I got error:
attempt to index global 'counterMine' (a nil value) X
after the line:
a = "mine"..counterMine:getValue()

The question is: what am I doing wrong? ;-)

EDIT:
Ok, I didn't noticed the object. Just clicked select all and copy/paste to spell.lua.

EDIT 2:
Still the same error :-(

Re: New Spells >> show them off here

Posted: Sun Oct 14, 2012 11:58 pm
by crisman
Merethif wrote:
crisman wrote:Explosive Mines
When casting spell in preview window I got error:
attempt to index global 'counterMine' (a nil value) X
after the line:
a = "mine"..counterMine:getValue()

The question is: what am I doing wrong? ;-)

EDIT:
Ok, I didn't noticed the object. Just clicked select all and copy/paste to spell.lua.

EDIT 2:
Still the same error :-(
Oh sorry, I completely forgot to mention that you need to place a counter and rename it counterMine D:

Re: New Spells >> show them off here

Posted: Mon Oct 15, 2012 12:13 am
by crisman
A question: for now my spells editing - except for the mine - was just creating stronger version for the base spells. My problem is that I'm not able to cast a projectile spell without killing myself.
I have to cast it one tile in front of the party, while the original spells clearly are spawn practically on the same party tile. ideas on what I have to edit?
EDIT: forget my another question -dammit, today my head is somewhere else!! - how can I clone the greater poison bolt and make it cast a poison cloud when it hits something? thanks!

Re: New Spells >> show them off here

Posted: Mon Oct 15, 2012 1:09 am
by Merethif
crisman wrote:Explosive Mines

(...)

EDIT: Completely forgot: To make this work, you have to place a counter and rename counterMine. I'll change the code so it's the game that will do that...
EDIT2: now it should work without placing the counter. that will do the game ... Hope you don't have already a counter with that name thought...
Now I'm able to place the mine, but when monster steps on it editor crashes completely. Haven't tested in in real game.