Page 2 of 3

Re: Spike trap

Posted: Sat Apr 06, 2013 3:29 am
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

Re: Spike trap

Posted: Sat Apr 06, 2013 8:03 pm
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. :)

Re: Spike trap

Posted: Sat Apr 06, 2013 10:16 pm
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.

Re: Spike trap

Posted: Sun Feb 23, 2014 7:38 pm
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

Re: Spike trap

Posted: Sun Feb 23, 2014 10:57 pm
by germanny
This is great, i was fiddling with traps too.
Now i dont need to pain my brain - it´s basically done!

Re: Spike trap

Posted: Mon Feb 24, 2014 9:45 am
by AdrTru
Thank you germanny.
I look forward to your models of trap, if you have create it. :)

Re: Spike trap

Posted: Mon Feb 24, 2014 11:10 pm
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.

Re: Spike trap

Posted: Tue Feb 25, 2014 12:39 am
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.

Re: Spike trap

Posted: Mon Mar 03, 2014 10:25 pm
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 )

Re: Spike trap

Posted: Wed Mar 05, 2014 2:32 pm
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 :)