-
Posts
245 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Posts posted by Slimwaffle
-
-
Yeah I tried that by using a variable called pause assigning it a value of 0. Then putting everything inside the update-world function on the fps controller in an if statement (so if paused = 0 it would update). And making the inventory on open pass a value of 1 to stop update. But it did nothing.
So I went the easy way and just added in an inventory section into the already existing menu script. Because for some reason the menu script already does what I want.
-
So I would add something to say if Time is paused mouse does nothing?
-
But the issue I'm pretty sure is the mouse is still being used by the first person player controller
-
Its there so the game pauses while you are going through your inventory screen
-
I am trying to design an inventory system using the gui widgets. The mouse locks to crosshair position when it shouldn't. And I was wondering how I fix it. I want to be able to freely move the mouse around and click on buttons. The same way I can in the main menu when I press escape.
<My Code>
function Script:Start()
local Inventory={}
local scale = 1--Inventory GUI
Inventorygui = GUI:Create(context)
Inventorygui:Hide()
Inventorygui:SetScale(scale)
local widget
Inventorygui:GetBase():SetScript("Scripts/GUI/Panel.lua")
Inventorygui:GetBase():SetObject("backgroundcolor",Vec4(0,0,0,1))
local image = Inventorygui:LoadImage("Bag/bag.tex")
local imagePanel = Widget:Panel(0,0,1920,1080, Inventorygui:GetBase())
imagePanel:SetImage(image)
imagePanel:Redraw()Inventory.gui=gui
Inventory.context = context
--Create a link button
Inventory.newbutton = Widget:Button("Resume Game",100,Inventorygui:GetBase():GetSize().y/2-60,300,20,Inventorygui:GetBase())
Inventory.newbutton:SetString("style","Link")
Inventory.newbutton:SetAlignment(1,0,0,0)Inventory.options = Widget:Button("Inventory",100,Inventorygui:GetBase():GetSize().y/2-10,300,20,Inventorygui:GetBase())
Inventory.options:SetString("style","Link")
Inventory.options:SetAlignment(1,0,0,0)optionspanel = Widget:Panel(Inventorygui:GetBase():GetClientSize().x/2-250,Inventorygui:GetBase():GetClientSize().y/2-300,500,600,Inventorygui:GetBase())
optionspanel:SetAlignment(0,0,0,0)
Inventory.optionspanel=optionspanel
indent=8
--Create a panel
widget = Widget:Tabber(indent,indent,optionspanel:GetClientSize().x-indent*2,optionspanel:GetClientSize().y-indent*2,optionspanel)
widget:AddItem("Inventory",true)
optionspanel:SetObject("backgroundcolor",Vec4(0.15,0.15,0.15,1))
Inventory.tabber = widgetlocal indent = 12
panel = Widget:Panel(indent,indent,widget:GetClientSize().x-indent*2,widget:GetClientSize().y-indent*2-30,widget)
panel:SetBool("border",true)
Inventory.panel={}
Inventory.panel.general=panelInventory.applyoptions = Widget:Button("Use",widget:GetClientSize().x-72*2-4-indent,widget:GetClientSize().y-28-5,72,28,widget)
local y=20
local sep=40
optionspanel:Hide()
end
function Script:UpdateWorld()
if window:KeyHit(Key.I) then
Inventorygui:Show()
Time:Pause()
window:ShowMouse()
end
end -
Thanks mate. That worked perfectly.
-
So I have been looking into a save and load function. So far everything I have seen uses tables. I noticed in alot of the code there is an update world function. Is there some kind of way. To save the entire world state (So absolutely everything is included) and then update it back to the world state when using a load function?
-
I was wondering if anyone could help me with a glitch I am experiencing with the gui. So I wanted to load a background image on the main menu.The problem is that it loads buggy then you click and it loads perfectly. The code I used looked like this;
--GUI
local gui = GUI:Create(context)
gui:Hide()
gui:SetScale(scale)
local widget
gui:GetBase():SetScript("Scripts/GUI/Panel.lua")
gui:GetBase():SetObject("backgroundcolor",Vec4(0,0,0,1))
--This part is my code
local image = gui:LoadImage("Frame/Walkabout.tex")
local imagePanel = Widget:Panel(0,0,1920,1080, gui:GetBase())
imagePanel:SetImage(image)
--Ends hereGameMenu.gui=gui
GameMenu.context = contextHow do I get this to load properly the first time without having to click?
-
I searched everywhere. There is no reference to name. I think I am going to have to add something in myself.
I think maybe along the lines of on weapon pick up if weapon file is = "path to mp4.pfb" then name of next index = "mp4"
Not sure if that will work.
Seems a bit tedious. Would saving all the file paths (For each item) and the equivalent name (for each item) to a table and then search matching string in table and returning name value work better?
-
This is what I came up with that compiles without error. But its not printing a name value to screen.
wep = self.weapons[self.currentweaponindex].entity:GetKeyValue("Name")
context:SetBlendMode(1)
context:SetColor(0,1,1,255)context:DrawText("Weapon = " ..wep , 20,(context:GetHeight() - 80))
-
At the moment its just the default weapon autopistol and the ones from the fps pack. I want to print to screen above my ammo the name of the weapon currently being held
So yeah mostly prefabs
-
I was wondering how I would go about getting weapon name to print to screen? I checked all the code and can't find a reference to name anywhere. The closest I found was weapon file. Which prints the weapon file path to screen but does not change when swapping weapons.
-
I fixed everything. Poly count is my only issue now. Thanks for the help guys.
- 1
-
I was able to get body and hair to separate properly. Because fuse puts body on one layer and everything else on a second layer when creating textures. I would add hair export. remove hair. So only hair was on second layer. And import skinned FBX to leadwerks. Then apply hair textures to blank material generated for hair. And repeat the process for each item (top, pants and so on). This worked great for hair. But now my problem is clothing items aren't texturing properly. Is there a way to combine surfaces in model editor into a single surface. So that I can do hair and clothes on a single texture?
- 1
-
yeah I followed this to fix the animations. The only issue now is that importing a skinned character generates blank materials that appear all black.
-
And importing skinned FBX is worse because the textures just go black inside the engine.
-
Ok I fixed the issue. I needed to make the shaders for the material animated. Apply to the character. (This removes animations) then reapply animations and save.
Now my only Issue is the texture. Under closer inspection. I have discovered that. Fuse is creating the character and clothes on what I think on different layers. Because substance painter
when the model is imported shows them on separate layers. But leadwerks is converting the model from obj all on one layer. Which makes the texture wrap over the clothes and hair.
-
Update - I don't get FPS lag anymore. And everything works fine. My only issue now. Is that when I generate material from tex and apply to character. It makes the character T pose. But from the shadows you can still see the animation playing.
Without texture though this worked perfectly just from copying all the settings from crawler into new character.
-
This is just test scene while I am still building things and figuring out the engine. Eventually the project will be a sandbox level
- 1
-
Even if I delete them all. And only place in the custom one on its own. I still get the same issue
-
turns out poly count is fine. Here is the attached project. I am getting all kinds of random errors e.g model T posing and not animating when textured. And no matter what massive reduction in fps. The model I am using now is in a folder called mixamo.
-
thanks heaps guys I haven't added in distance check yet. But I got this working perfectly with two lines of code. My only question is now how do I get the position of the head instead. Because it uses the feet and prints the bar below the enemy. Or even if I got entity height somehow?
these were the two lines I used.
local p = self.entity:GetPosition()
local y = player.camera:Project(p) -
19648 polygons. Seems like a lot
-
I have tried importing my own character. And attaching the default monster script. I loaded in animations and renamed them accordingly to interact with the script. However I am getting all sorts of random errors. And was wondering if someone could help. For this process I used fuse, mixamo and substance painter.
First error is with meshing. When I create a material to apply the textures to my model.it doesn't let me apply textures to clothes and hair separately.
The other issue is yes the character moves and the script appears to be working when selecting animations. But I get wild fps drop and stutter. And now the AI behaves erratic. Often stopping and doing nothing. The only thing I can think off is maybe slowing down the animation speeds. But I honestly don't know. Because they should work regardless of speed.
Right now my dude has skin pants and his script and movement doesn't work properly. Is anyone able to help fix this?
- 1
Moving Items
in Programming
Posted
I am so happy I got this working I am going to share it with you guys. These scripts will allow you to move items around in game. Enjoy
The first script is here;
--Generic Item Script
function Script:Start()
self.entity:SetKeyValue("type","item")
pos = self.entity:GetPosition()
end
function Script:UpdateWorld()
end
Now the Second Script to actually move the item;
--Script to move Item
Script.camPick = false
Script.radius = 1
function Script:Start()
self.player = self.entity:GetParent()
self.camera = self.player.script.camera
end
function Script:UpdateWorld()
local pickInfo = PickInfo()
local mouse = window:GetMousePosition()
if self.camera:Pick(mouse.x, mouse.y, pickInfo, self.radius, true,2) then
if pickInfo.entity:GetKeyValue("type") == "item" then
self.camPick = true
end
else
self.camPick = false
end
local pickInfo = PickInfo()
local mouse = window:GetMousePosition()
if self.camera:Pick(mouse.x, mouse.y, pickInfo, self.radius, true,2) then
pickInfo.entity:SetPickMode(Entity.PolygonPick)
dist = self.camera:GetDistance(pickInfo.entity,false)
if dist >= 20 then
self.camPick = false
end
if self.camPick == true then
if pickInfo.entity:GetKeyValue("type") == "item" then
if window:KeyDown(Key.Q) then
--UnProject mouse coordinates from screen space to world space and position the box there
local p = window:GetMousePosition()
p.z = 3 --distance in front of the camera to project to
p = self.camera:UnProject(p)
pickInfo.entity:SetPosition(p)
end
end
end
end
end