Spike trap

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Spike trap

Post by AdrTru »

SpiderFighter wrote:Damn. That code made my head hurt.
I am so sorry. Do you thing that my programing is bad? It is maybe true, but I love it :oops:
I dont know how get value from graph in lua easily.

Edit:
I have idea to rewrite script to be much much simple. I will do it during weekend.

Edit:
This is little bit optimalized code :
SpoilerShow
Functions - GetKQ(ax,ay,bx,by) and GetLV(ramp,i) is not needed for this script

Code: Select all

function GetTableFromRamp(ramp,poc)
local tab={}
local A,B,y
local increment = 100.0 / poc
local index = 2
  for j = 1, poc do
    position = 1.0*j*increment
    while (position > ramp[index].x) and (index < #ramp) do
      index = index +1
    end
    A = ramp[index-1]
    B = ramp[index]
    y = (1.0*(position-A.x)/(B.x-A.x)*(B.y-A.y)+A.y)/100.0
    tab[j]={["x"]=position,["y"]=y}
  end
return tab 
end
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: Spike trap

Post by SpiderFighter »

AdrTru wrote:
SpiderFighter wrote:Damn. That code made my head hurt.
I am so sorry. Do you thing that my programing is bad? It is maybe true, but I love it :oops:
I dont know how get value from graph in lua easily.

Oh, no!!! I only meant that I am not smart enough to follow it. It was a compliment. :)
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Spike trap

Post by AdrTru »

akroma222 wrote:That is terrific!!
Maybe even "swipe_special" from the original asset pack could go well?
I made new sound combined Gilotina sound width keylock and chain slide sound.
That sound is imho good and will be included in next version.

SpiderFighter: My English is bad and I have problem with understanding :)
But, in this situation it wos positive becouse I did rewrited this script to much simple version.

I going to publish new version of this mod soon, but I want to make some objects from floor spike (full line, ful tile and may be more). UPLOADED
And in future i may make trap with spear sting from wall and I am thinking about clockwork mowing wall.
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Spike trap

Post by AdrTru »

There is concept of new trapsystem. - Its working dungeon editor file.
http://ulozto.cz/x4bGMgiQ/trap-lever-zip


How it works:
there are script entities trap_xxx for generating traps.
Into this entities mus be inserted code:

Code: Select all

traps_blocker   = 0     -- 1 - will be create blocker when is trap closed
traps_goback    = 1     -- 1 - trap will automaticaly go back to open after close time
traps_closeTime = 0.5   -- time for return time
traps_damage    = 10    -- basic damage dealed by trap


function open()
  TrapsManager.open(self)
end

function close()
  TrapsManager.close(self)
end
Now is possible to connect connector from some buttons/levers/... to open/close functions in this script entity


Internal functions:
At begining will be scaned all dung for this script entity.
Every of this will sanwn Internal_trap...(lever) ,Timer for return time and special alcove with inserted item for blocking changing status lever manualy.( not need in my last version )

In this mos is added redefined sound for all levers and buttons - for calm lever usage.
Inspiration for this system wos Xanathars TreasureChest system.
System is using framework for hooks.


Wrte me when you find some problems with this mod.

Known problems:

Models arent finalized

when someone click to lever handle( in center of wall at rounded part of icon) with item in mouse - lever will be changed manualy.(solved in my last version)

Will be created:

More traps type/ spears positions
Last edited by AdrTru on Mon Feb 24, 2014 4:02 pm, edited 2 times in total.
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
User avatar
germanny
Posts: 530
Joined: Sat Apr 07, 2012 10:52 pm
Location: Kiel, Germany

Re: Spike trap

Post by germanny »

This is great, i was fiddling with traps too.
Now i dont need to pain my brain - it´s basically done!
Dungeon Master Resource Pack worker and passionated Beer drinker
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Spike trap

Post by AdrTru »

Thank you germanny.
I look forward to your models of trap, if you have create it. :)
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
User avatar
germanny
Posts: 530
Joined: Sat Apr 07, 2012 10:52 pm
Location: Kiel, Germany

Re: Spike trap

Post by germanny »

I had this in mind:
Image
Image
SpoilerShow
Image
Image
Three models: Spiked spears, floor holes and floor.
The floor model can use any texture by redefining in GMT.

Hey AdrTru, if you like it you can add it to your traps and make it work!
I can send you all versions as model with animations.
Dungeon Master Resource Pack worker and passionated Beer drinker
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Spike trap

Post by AdrTru »

Yes, this models is very nice.
I thing that wil be usefull to add some variable for definition of type of floor.
For axetrap, spike trap I will make this visual variants too. ( spear traps is extruded from receiptor )
Thank you germanny - your models is really nice and suitable for dungs.
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
User avatar
AdrTru
Posts: 223
Joined: Sat Jan 19, 2013 10:10 pm
Location: Trutnov, Czech Republic

Re: Spike trap

Post by AdrTru »

http://ulozto.cz/xSzWwwDp/trap-lever-140303-zip

There are integrated Germanys traps and new spears piersed from ceiling.
! It is working wersion and before publication will be renamed some part of it.

Write me please if you discover some errors. ( I'll explain that it is feature :D )
My LOG2 projects: virtual money, Forge recipes, liquid potions and
MultiAlcoveManager, Toolbox, Graphic text,
LordofKral
Posts: 27
Joined: Mon Feb 10, 2014 5:56 pm

Re: Spike trap

Post by LordofKral »

Next Feature:
A blade in the wall. When someone over a specific height cross, it could get hurt... it could be nice for all the small herders, they can cross and you don´t :)
Post Reply