how to gain xp with an attack spell created?

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Grimwold
Posts: 511
Joined: Thu Sep 13, 2012 11:45 pm
Location: A Dungeon somewhere in the UK

Re: how to gain xp with an attack spell created?

Post by Grimwold »

@flatline - You're right of course.. just add all the relevant bitfields together

If I'm not mistaken we want:
bit 2 = 4
bit 3 = 8
bit 4 = 16
bit 5 = 32

4+8+16+32 = 60 (plus any of the other bitfields)

As far as common values go it's probably easier to think of it as on or off states... decide which bits you want and then add up all the values.

Code: Select all

bit 0: monsters recoil from the impact                            =   1
bit 1: ongoing damage such as poison cloud                        =   2
bit 2: damage originated from champion with ordinal index 1       =   4
bit 3: damage originated from champion with ordinal index 2       =   8
bit 4: damage originated from champion with ordinal index 3       =  16
bit 5: damage originated from champion with ordinal index 4       =  32
bit 6: ignore immunities                                          =  64
bit 7: halve damage of back row party members                     = 128
so 0,2 and 6 would be = 69
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: how to gain xp with an attack spell created?

Post by Komag »

Ah yes, that's a little chart we need to have well known, thanks! ;)
Finished Dungeons - complete mods to play
flatline

Re: how to gain xp with an attack spell created?

Post by flatline »

I was just about to say that you should be able to put in the binary number, but after double checking, it seems like you need the integer equivalent.
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: how to gain xp with an attack spell created?

Post by Xanathar »

Try this function:

Code: Select all

function getDamageFlags(recoilmonsters, ongoingdamage, fromchamp1, fromchamp2, fromchamp3, fromchamp4, ignoreimmunities, halfdamageofbackrow)
	local result = 0
	
	if (recoilmonsters) then result = result + 1; end
	if (ongoingdamage) then result = result + 2; end
	if (fromchamp1) then result = result + 4; end
	if (fromchamp2) then result = result + 8; end
	if (fromchamp3) then result = result + 16; end
	if (fromchamp4) then result = result + 32; end
	if (ignoreimmunities) then result = result + 64; end
	if (halfdamageofbackrow) then result = result + 128; end

	return result
end
You can use it passing a whole lot of boolean to compose the final result.

Not tested, since not at home.
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
FrEEsiD

Re: how to gain xp with an attack spell created?

Post by FrEEsiD »

thanks you for all your answers,
but my English not being very top, I do not quite understand :(
In any case of magic missile Jkos works very well and gives xp all champions, superb ;)

My final problem is to make a "party:shakecamera" when the missile hits a wall, monster, or the champions ...


thank you all for all ;)
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: how to gain xp with an attack spell created?

Post by JKos »

That is possible but it's pretty hard to implement. The only way to do it is to make a timer with small interval (about 0.1 second) which checks if the projectile is found in dungeon (with findEntity). If it's not found, you know that it has hit something so you can call party:shakeCamera() . Sorry no example now.

You can get the id of the shot projectile like this:

Code: Select all

	shootProjectile('magic_missile', caster.level, caster.x, caster.y, caster.facing, speed, 0, 0, 0, 0, 0,damage, caster, true)

	local projectile = nil
	for ent in entitiesAt(caster.level, caster.x, caster.y) do
		if ent.name == 'magic_missile' then
			projectile = ent
			break
		end
	end
        print(projectile.id)
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: how to gain xp with an attack spell created?

Post by Komag »

JKos wrote:...only way to do...
or you could coat every surface in the entire dungeon with hidden receptors!!!
Finished Dungeons - complete mods to play
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: how to gain xp with an attack spell created?

Post by JKos »

Ok, I guess that's a another way :D
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
FrEEsiD

Re: how to gain xp with an attack spell created?

Post by FrEEsiD »

thanks Jkos,
for the moment it is too hard for me, I will deal it later.
I will continue my dungeon ;)


Thanks you again
Post Reply