[spell] Telekinesis (video)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

[spell] Telekinesis (video)

Post by JKos »

Hi,

I made a telekinesis spell which can be used to pull items towards the party. Technically it's done with a timer which modifies the subtile offset of the item.
I think it works pretty nicely, but unfortunately we can't access the subtileoffset of the item, so the initial offset has to be set to 0,0 which makes the items "jump" to the center of the tile when the spell is cast.
https://docs.google.com/file/d/0B7cR7sc ... NWU3c/edit
(my mouse is broken so don't care about the extra clicks :) )



Script entity telekinesis

Code: Select all

function onCast(caster)
	local item = help.nextEntityAheadOf(party, 5,'item',true)
	if item then
		pullItem(item)
	end
end


function pullItem(item)
	local timer = timers:create('move_timer_'..item.id)
	timer:setTimerInterval(0.01)
	
	timer.item_id = item.id
	
	timer:addCallback(
		function(self) 	
			local item = findEntity(self.item_id)
			
			self.sub_x = self.sub_x + (self.dx * 0.10)
			self.sub_y = self.sub_y + (self.dy * 0.10)
			item:setSubtileOffset(self.sub_x, -self.sub_y) 			
		end
	)
	
	timer.moveTo = function(self,dir,distance)
		self.dir = dir
		self.distance = distance
		self.sub_x = 0
		self.sub_y = 0
		self.dx,self.dy = getForward(dir)
		self:setTickLimit(distance*30,true) 
		self:activate()
	end
	
	timer.onDeactivate = function(self)
		local item = findEntity(self.item_id)
		item = help.recreateItem(item,item.x+self.dx*self.distance,item.y+self.dy*self.distance)
		item:setSubtileOffset(0,0)
	end
	local dist = help.getDistance(party,item)
	timer:moveTo(help.getOppositeFacing(party),dist)

end
Just call the telekinesis.onCast from spell onCast hook.

Requires LoG Framework (link is in my signature)

This technique could be used to make moving rats, mouses and insects too, which could be picked up and eaten. But I can't do 3d modelling.
- 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
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: [spell] Telekinesis (video)

Post by Xanathar »

Awesome!
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
User avatar
Komag
Posts: 3659
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: [spell] Telekinesis (video)

Post by Komag »

I love it, very cool! 8-)
Finished Dungeons - complete mods to play
User avatar
LordYig
Posts: 175
Joined: Wed Jul 04, 2012 5:45 pm

Re: [spell] Telekinesis (video)

Post by LordYig »

Ho ! This is so nice !
It opens some opportunities for puzzles !
flatline

Re: [spell] Telekinesis (video)

Post by flatline »

Amazing job! Grimrock has evolved to the point where Portal is the less complicated puzzle game. :)

Moving items in this way creates a lot of other opportunities too. *a thousand ideas pops up at once*
User avatar
Rook
Posts: 71
Joined: Thu Dec 06, 2012 5:48 pm
Location: Belfast, UK

Re: [spell] Telekinesis (video)

Post by Rook »

You're a wizard, Harry!
User avatar
Rook
Posts: 71
Joined: Thu Dec 06, 2012 5:48 pm
Location: Belfast, UK

Re: [spell] Telekinesis (video)

Post by Rook »

flatline wrote:Amazing job! Grimrock has evolved to the point where Portal is the less complicated puzzle game. :)

Moving items in this way creates a lot of other opportunities too. *a thousand ideas pops up at once*
Moving Dragon statues around a room to place on pressure plates springs to mind.
User avatar
akroma222
Posts: 1029
Joined: Thu Oct 04, 2012 10:08 am

Re: [spell] Telekinesis (video)

Post by akroma222 »

Brilliant!!
I had thought about a telekinesis spell but don't have the know how to make it happen...
Nice work for sure!!
User avatar
pferguso
Posts: 40
Joined: Tue Nov 06, 2012 6:09 pm

Re: [spell] Telekinesis (video)

Post by pferguso »

Nice work!
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [spell] Telekinesis (video)

Post by Diarmuid »

Really cool! It is your extended timers that made animation possible to implement.
Post Reply