-
Posts
517 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Genebris
-
-
I don't think that's possbile, but if you want you can create a pivot point with a script, save as prefab and parent it to entities you want to add script to. Obviously you will need to use self.entity:GetParent() in this script instead of self.entity.
-
Why don't you just take default player prefab?
-
This height value is what you need. Set it to 999 (maximum) and it will be very high.
- 3
-
I think I also had this problem once and solved by deleting last opened map.
-
I think I also have had a big frame drop after installing new Nvidia driver in Skyrim once, so this can happen even with AAA games I guess.
-
Not sure if this can help you, but I have made basic dungeon generation shown on this video:
I have five models (painted in different colors in video) and specified each enter and exit spot with pivot point.
Here is code:
Script.startPivot="" --entity
Script.dungeon={}
Script.names={"d1", "d2l", "d2r", "d3l", "d3r"} --Names of all possible dungeon segments to check AABB intersection
Script.d1="Prefabs/Dungeon/d1.pfb"
Script.d2l="Prefabs/Dungeon/d2l.pfb"
Script.d2r="Prefabs/Dungeon/d2r.pfb"
Script.d3l="Prefabs/Dungeon/d3l.pfb"
Script.d3r="Prefabs/Dungeon/d3r.pfb"
Script.currentR=0
Script.nextR=0
Script.j=0
Script.i=0
Script.s=0
Script.allDungeonSegments={}
--Debug
function Script:Start()
--math.randomseed(10)
end
function Script:UpdateWorld()
if App.window:KeyHit(Key.G) then self:Use() end
end
function Script:Use()
self:GenerateDungeon()
end
function Script:GenerateDungeon() --main generation function
self.currentR=0
self.nextR=0
self.i=0
self.j=0
player:ConsoleLog("Generation started. Countentities = "..App.world:CountEntities())
self:DeleteAllDungeonSegments()
player:ConsoleLog("All segments deleted. Countentities = "..App.world:CountEntities())
self.dungeon={}
self.dungeon[0]=self:CreateSegment(self:GetRandomPart()) --Create first dungeon element
self.dungeon[0]:SetRotation(0,self.currentR,0,true)
local pos = self.dungeon[0]:FindChild("Enter"):GetPosition(true)
local previousPos = self.startPivot:GetPosition(true)
local dPos = pos-previousPos
self.dungeon[0]:SetPosition(pos-dPos, true)
local result = true --Create main path
self.dungeon, result=self:GeneratePath(100, self.dungeon) --If this function failed to generate dungeon we still need to save it, but we sholdn't proceed further
if not result then
self:GenerateDungeon() --Failed to generate dungeon, starting again
return
end
--Generate forks
self:GenerateForks()
end
function Script:GeneratePath(amount, startingTable, emergencyLimit)
if not emergencyLimit then emergencyLimit=200 end
local dungeon={}
dungeon=startingTable
local emergencyCounter=0
local i=#dungeon+1
self.intersectionFound=false
while i<=amount do
emergencyCounter=emergencyCounter+1
--System:Print(emergencyCounter.." i="..i)
if emergencyCounter>emergencyLimit then --reached limit of retries, generate again
return dungeon, false --still need to return current dungeon to be able to clear it
end
dungeon=self:CreateSegment(self:GetRandomPart())
local yRotation=dungeon[i-1]:GetRotation(true).y+self:GetExtraRotation(dungeon[i-1])
dungeon:SetRotation(0,yRotation,0,true)
pos = dungeon:FindChild("Enter"):GetPosition(true)
previousPos = dungeon[i-1]:FindChild("Exit"):GetPosition(true)
dPos = pos-previousPos
dungeon:SetPosition(dungeon:GetPosition(true)-dPos, true)
--Check AABB
local aabb=dungeon:GetAABB(Entity.GlobalAABB)
local j=1
local maximum=#self.allDungeonSegments
while j<=maximum do
--System:Print(j)
if self.allDungeonSegments[j]~=dungeon and self.allDungeonSegments[j]~=dungeon[i-1] and self.allDungeonSegments[j]~=dungeon[i-2] then
if aabb:IntersectsAABB(self.allDungeonSegments[j]:GetAABB(Entity.GlobalAABB)) then
System:Print(dungeon:GetKeyValue("name").." intersects with "..self.allDungeonSegments[j]:GetKeyValue("name"))
if i<4 then
return dungeon, false
else
System:Print("Three steps back")
self:DeleteSegment(dungeon)
System:Print("Deleted last segment")
dungeon=nil
self:DeleteSegment(dungeon[i-1])
System:Print("Deleted i-1")
dungeon=nil
self:DeleteSegment(dungeon[i-2])
System:Print("Deleted i-2")
dungeon=nil
i=i-3
j=1000--maximum+1
end
end
end
j=j+1
end
i=i+1
--System:Print("End of I loop. i="..i)
end
return dungeon, true --returning true if managed to generate dungeon properly
end
function Script:GenerateForks()
local i=1
while i <= #self.dungeon do
if self.dungeon:GetKeyValue("name")=="d1" and math.random(0, 20)==0 then
local matrix=self.dungeon:GetMatrix(true)
self:DeleteSegment(self.dungeon)
self.dungeon={}
self.dungeon[0]=self:CreateSegment(self:GetRandomPart(4,5))
self.dungeon[0]:SetMatrix(matrix, true)
self.dungeon[1]=self:CreateSegment(self:GetRandomPart())
local yRotation=self.dungeon[0]:GetRotation(true).y+self:GetExtraRotation(self.dungeon[0]) --second element
self.dungeon[1]:SetRotation(0,yRotation,0,true)
pos = self.dungeon[1]:FindChild("Enter"):GetPosition(true)
previousPos = self.dungeon[0]:FindChild("Exit2"):GetPosition(true)
dPos = pos-previousPos
self.dungeon[1]:SetPosition(self.dungeon[1]:GetPosition(true)-dPos, true)
--local dungeon
--local result
local dungeon, result = self:GeneratePath(15, self.dungeon, 30)
if not result then
self:DeleteSegment(dungeon[#dungeon])
self.dungeon=dungeon
else
self.dungeon=dungeon
end
end
i=i+1
end
end
--other function
function Script:GetRandomPart(minimum, maximum) --Choose random element
if not minimum then minimum=0; maximum=3 end
local r=math.random(minimum, maximum)
if r==1 or r==0 then
return self.d1
elseif r==2 then
return self.d2r
elseif r==3 then
return self.d2l
elseif r==4 then
return self.d3r
elseif r==5 then
return self.d3l
end
end
function Script:GetExtraRotation(name)
name=name:GetKeyValue("name")
if name=="d2r" or name=="d3r" then
return (90)
elseif name=="d2l" or name=="d3l" then
return (-90)
end
return 0 --all other segments return 0
end
function Script:CreateSegment(name)
local entity=Prefab:Load(name)
table.insert (self.allDungeonSegments, entity)
return entity
end
function Script:DeleteSegment(entity)
local i=1
local maximum=#self.allDungeonSegments
while i<=maximum do
if self.allDungeonSegments==entity then
local temp = self.allDungeonSegments
table.remove (self.allDungeonSegments, i)
--self.allDungeonSegments=0
temp:Release()
i=maximum
end
i=i+1
end
end
function Script:DeleteAllDungeonSegments()
for i=1, #self.allDungeonSegments do
self.allDungeonSegments:Release()
end
self.allDungeonSegments={}
end
function Script:IsDungeonSegment(name) --not needed
name=name:GetKeyValue("name")
for i=1, #self.names do
if self.names==name then return true end
end
return false
end
- 6
-
You probably need to press "Fit shape" in barrel physics settings, it will give it a physics shape.
- 1
-
Nice, thanks! I already was afraid there is no solution for this )
But is there something else I should create in start? Other types of variables are fine?
-
That's unexpected. What if I want to make an inventory for NPCs? And what else is shared besides tables?
-
Something weird is happening. I have two objects with the scame script on them. Here is the code:
Script.enabled=0 --bool "enabled"
Script.int=0
Script.tab={1}
function Script:UpdateWorld()
System:Print("------------starts "..self.entity:GetKeyValue("name"))
System:Print("int="..self.int)
System:Print("#="..#self.tab)
System:Print("[#]="..self.tab[#self.tab])
if not self.enabled then return end
self.int=self.int+1
self.tab[#self.tab+1]=math.random(1,9)
System:Print("-----------END "..self.entity:GetKeyValue("name"))
end
It has boolean variable which is set to true for one entity and to false for another entity in the editor.
it also has one number variable (int) and one table (tab). Script with "enabled" entity ads +1 to int variable and one extra table element with random value each update.
And here is what I get in output:
------------starts Pivot 1 (enabled)
int=0
#=1
[#]=1
-----------END Pivot 1 (enabled)
------------starts Pivot 2 (disabled)
int=0
#=2
[#]=4
------------starts Pivot 1 (enabled)
int=1
#=2
[#]=4
-----------END Pivot 1 (enabled)
------------starts Pivot 2 (disabled)
int=0
#=3
[#]=8
------------starts Pivot 1 (enabled)
int=2
#=3
[#]=8
-----------END Pivot 1 (enabled)
------------starts Pivot 2 (disabled)
int=0
#=4
[#]=7
------------starts Pivot 1 (enabled)
int=3
#=4
[#]=7
-----------END Pivot 1 (enabled)
------------starts Pivot 2 (disabled)
int=0
#=5
[#]=9
...
(Added space after each update for easier reading)
As you can see int variable increases in "enabled" entity and doesn't change in "disabled". Also disabled entity doesn't print last ("---END") line, so it is really disabled.
But for some reason the table changes for both of those entities. It has same amount of elements and the last element is the same (it was generated randomly) for both scripts.
Can you please explain me what is going on here?
-
-Can you make randomly generated Worlds?
-How big can the Worlds be? / Can I put 2 or more World Maps (4096x4096) together to get an bigger Map?
You can make randomly generated levels, but you can't involve terrain into this as there are currently no methods to edit terrain at runtime (correct me if i'm wrong please). But you can also create a terrain in the editor and dynamically put objects onto it at runtime.
The world size isn't limited, but terrain size is limited by 4000x4000 and you can't have more than 1 terrain.
I wouldn't try making huge open worlds like Skyrim on Leadwerks. At least not with Lua only.
-Are there any other Programs I must think of to buy when I use the Engine, for example to model something or make textures?
For modelling you can use Blender which is free and has everything you could ever need. But you will need image editor such as Photoshop to work with textures.
For exporting from blender use blender exporter. It's more convenient than exporting FBX.
-
http://www.leadwerks.com/werkspace/topic/9663-introduction-to-steam-code-in-leadwerks/
It seems like in this thread gamecreator showed how to transfer coordinates between players via steamworks and he used default AppID. Am I missing something or does this mean you can make fully working multiplayer with Spacewar ID?
-
you need a real appid on steam to be able to use multiplayer with steamworks and to use other steamwork features
Ok, what does default ID allow you to do then?
-
At this point I am not seeing any killer feature in Steam networking that would want me to tie networking to Steam. We'll probably set up our own server for matchmaking, as well as provide the tools to create your own, if you wish.
Does this mean you can make a multiplayer game entierly on Steamworks and it will work without even enabling Steam client (and ofc without getting game greenlit)? Doesn't steam need to recognise your game at least as Spacewar?
-
Yes, that's not realistic, but I'm making a a monster that has a black smoke instead of head and when he runs he leaves a long trail of particles behind instead of having thick smoke in place of head.
I'll make simple particles system myself and upload to workshop if it works.
-
But it doesn't help me. Velocity settings apply only on new particles. Particles that already was released won't change.
I guess I can just write particle system myself. Hope it won't be too bad for performance.
-
Is therer a way to make particles move in emitter's local space? So when emitter moves, it's particles move with it, while still having their own speed?
-
Everything you named is not hard to do. The only problem I see is different footsteps while walking on terrain: you won't be able to check the texture you are standing on. But if you use different objects with different materials instead of terrain (and I think you don't really need terrain because player will be sneaking inside buildings and not in the forest at least most of the time), then there should be no problem to change footsteps.
-
I'm not going to use this mainly because it doesn't let me work with files for my game, but I hope it will help Leadwerks grow.
-
entity:SetPickMode(0)
and picking won't work on this entity.
- 1
-
Yes, just take the default door swing and make rotation angle depending on the mouse position.
-
Easiest way:
Place your key on a table mark it as hidden in it's properties (Appearance tab). Add this script to your lever:
Script.key=nil --entity "Key"
function Script:Use()
self.key:Show()
end
And drag the key from scene tree window to a script variable field called "Key".
-
Before updating projeck files Leadwerks always asks you if you want to update the project. I don't remember if you can reject updating, but you sure can't miss the update.
-
Never had a problem with upadtes that forced me to redesign everything from scratch. And I'm sure noone else had. Because it's simply not possible. I have once got FPSPlayer script restored to default because of update, so I simply took backup file from script directory and made another player script that won't be updated. Few times App.lua was updated, I always was able to simply take backup file from it's dirrectory.
Next DLC planned.
in General Discussion
Posted
No, it was 100 MB for a single mod limit for Skyrim. 50 mod limit was only for a few weeks after Skyrim workshop opened (in 2012).