Jump to content

randomdude

Members
  • Posts

    70
  • Joined

  • Last visited

Posts posted by randomdude

  1. Hey guys, yeah I tried a lot with that. xD The engine offers this great newton physics system. You can make very realistic stuff with it. But you need to make all by hand, its glitchy sometimes and perfomance need to be checked.

    Here I made a video quickly for you to see what I mean.

    https://www.twitch.tv/videos/168986600

    You can make for example an addforce script and blow up the wall, shoot it down or make an NPC walk through it.

    You can make triangles as well for better optics.

    Make movables props and give it a mass and the other things scene, so they interact.

    With that said have fun. =D

    • Upvote 1
  2. Yeah Thanks man, I decided to skip this for a while, I tried it but I have no clue how I get this to work.I wil try it later when I have more knowledge about coding. It seems like I have to rework the whole script to get those two animations working, its kinda not worth it.

    Anyway, where do I get this animationmanagerscript? I dont have it, and can you maybe explain how this "blend" animation-thing is working please? I have no idea how to use this.

    I´m thinking about another problem at the moment. A script that allows the dude to interact with the world.

    I just took a function from the fps player script. Here see what happens, its really funny. But it works with a just an empty start function. Works with the NPCs as well.

    https://www.twitch.tv/videos/168951112

    Hmm, I thought I will not make an inventory, items and all this stuff, Its kinda boring for me to make and the player to play. All I need is a function based on that cylinder I made around the dude to interact with E. So I can make for example spots where he activates something like doors, buttons and more importent talking, dialog fields.

    Any Ideas how to start?

  3. Okay I skip this with the table at the moment, but thanks for the idea. But this question was good, I have no idea I just thought I have to place it there.

    I put the Sit animation here.

    function Script:Start()
    	if self.entity:GetMass()==0 then
    		self.entity:SetMass(10)
    	end
    	self.entity:SetPhysicsMode(Entity.CharacterPhysics)
    	self.camera = Camera:Create()
    	self.angle = self.entity:GetRotation().y
    	self.cameraangle = self.angle + self.entity:GetCharacterControllerAngle()
    	
    	
    	newmode = "Sit"
    	self.entity:PlayAnimation("Sit",0.035)
    
    end

    The KeyHit command here.

    
    function Script:UpdatePhysics()
    	local window = Window:GetCurrent()
    	local context = Context:GetCurrent()
    
    	local cx = context:GetWidth()/2
    	local cy = context:GetHeight()/2
    	
    	local newmode
    	local animmode=0
    
    	
    
    	if self.entity:GetAirborne()==false then
    			if window:KeyHit(Key.E) then
    			newmode = "Idle"
    			self.entity:PlayAnimation("Idle",0.035,0,0)
    			end
    	end

    It its working, he finally stands up, but all following animations like walk etc. demand now the keyhit. to stop and the idle animation is ignoring my speed value.

    I tried to make the whole movementbody dependent on the keyhit to activate but its not working. This could be a solutions because I dont have to rework all movementcommands. Any idea?

    Here is this keyhits = 0 thing. but I dont understand how to use it, maybe it declares how many hits?

    https://www.leadwerks.com/learn?page=API-Reference_Object_Window_KeyHit

    Or should I make this with an event? because I want a textbox with some monolog and after it is read "press e" and he stands up. Thats the whole idea there.

    I made a video again, Intro2

    https://www.twitch.tv/videos/168446210

    Thanks you all so far.

  4. Its one, I just made four different varations of it.

    function Script:UpdatePhysics()
    	local window = Window:GetCurrent()
    	local context = Context:GetCurrent()
    
    	local cx = context:GetWidth()/2
    	local cy = context:GetHeight()/2
    	
    	local newmode
    	local animmode=0
    
    if self.entity:GetAirborne()==false then 
    		if window:KeyHit(Key.E)==true then
    		newmode = "Idle"
    		self.entity:PlayAnimation("Idle",0.035)
    		else
    		newmode = "Sit"
    		self.entity:PlayAnimation("Sit",0.035)
    		end
    	end

    I thought the GetAirborne does interfere so I changed it to this. Documentation says " Returns true if the specified key is has been pressed since the last time it was checked, otherwise false is returned." Maybe its this? The dude goes up a bit but gets down if you release the key. It works with KeyDown but I dont want the key pressed all the time.

     

  5. None of this is working. Why?
     The code does it for KeyDown but not for KeyHit. What is the difference then?

    	if self.entity:GetAirborne()==false and window:KeyHit(Key.E) then
    		newmode = "Idle"
    		self.entity:PlayAnimation("Idle",0.035)
    		else
    		newmode = "Sit"
    		self.entity:PlayAnimation("Sit",0.035)
    		return
    	end
    
    	if self.entity:GetAirborne()==false and window:KeyHit(Key.E)==true then
    		newmode = "Idle"
    		self.entity:PlayAnimation("Idle",0.035)
    		else
    		newmode = "Sit"
    		self.entity:PlayAnimation("Sit",0.035)
    		return
    	end
    
    if self.entity:GetAirborne()==false then 
    		if window:KeyHit(Key.E)==true then
    		newmode = "Idle"
    		self.entity:PlayAnimation("Idle",0.035) return
    		else
    		newmode = "Sit"
    		self.entity:PlayAnimation("Sit",0.035)
    		end
    	end
    
    if self.entity:GetAirborne()==false then 
    		if window:KeyHit(Key.E)==true then
    		newmode = "Idle"
    		self.entity:PlayAnimation("Idle",0.035)
        	end
    		if window:KeyHit(Key.E)==false then
    		newmode = "Sit"
    		self.entity:PlayAnimation("Sit",0.035)
    		end
    	end

     

  6. Hello Guys,

     

    I try to make a the opening scene/intro, the most of you know I suck at coding and need some help here. Its probably very easy to solve. So I decided to make a thread where I can ask things about the coding problems. I don´t spam with a lot of threads and I get my things solved.

    So here we go. I linked a video to the intro, its not finished, so far but I want to get this coding stuff done before I add more details.

    (18+,mature content)

    https://www.twitch.tv/videos/168041356

     

    The Dude don´t want to stand up I tried a lot of variations but it wont function. He has extra animations for standing up as well but it would be nice if he just get into the idle position.

    function Script:Start()
    	if self.entity:GetMass()==0 then
    		self.entity:SetMass(10)
    	end
    	self.entity:SetPhysicsMode(Entity.CharacterPhysics)
    	self.camera = Camera:Create()
    	self.angle = self.entity:GetRotation().y
    	self.cameraangle = self.angle + self.entity:GetCharacterControllerAngle()
    	self.startposition = self.camera:GetPosition()
    end
    
    (..)
    
    function Script:UpdatePhysics()
    	local window = Window:GetCurrent()
    	local context = Context:GetCurrent()
    
    	local cx = context:GetWidth()/2
    	local cy = context:GetHeight()/2
    	
    	local newmode
    	local animmode=0
    	
    	if self.startposition and self.entity:GetAirborne()==false then
    		newmode = "Sit"
    		self.entity:PlayAnimation("Sit",0.035)
    	end
    
    	--if self.startposition==false and self.entity:GetAirborne()==false then
    		--newmode = "Idle"
    		--self.entity:PlayAnimation("Idle",0.035)
    	--end

    It´s the normal thirdperson script. In this variation I tried setting self.startposition true and false, but it does make it worse. xD I try to make the animation dependent on the cameraposition. but I could be wrong. I have really no I idea to get this done.

    If a skilled programmer wanna join my project, it would be better. I hate this coding stuff. I have so many great ideas and already mapped the main location, this is just side stuff because I wanna enjoy myself with doing this graphic things, coding just blocks my workflow.

  7. Then sorry, I have no clue. For me projectstuff is located in an extra folder. But its impossible that lw is not working after a complete delete and reinstalling. "C:\Program Files (x86)\Steam\steamapps\common\Leadwerks" Thats my location of LW. maybe you delete this, reinstall it than you open a new project, check if it is working after that you copy only your material,model and level folders into the new project.

    • Upvote 1
  8. Quote

    I guess the "use" function is common enough to implement it in the third person player as well.  However placing a block would still involve using a raycast from the camera. The only thing that would be different in comparison to a First person script is the radius of the raycast.

    Yes I tried it but it seems the use function is based on the camera, like if the object/entity is in the center of the camera the hand symbol shows up. Maybe I just have to try it harder to solve this. Anyway thanks for your work so far, look good.

  9. I´m in need for such thing and would pay for that. I dont know if it is possible but I have seen in the FPS script that using item buttons etc. is based on the point where the camera is looking at. If it would be based on a block in front of the player it would be better it is then useable for more gamegenres.

    I´m thinking about this for longer, so I share my thoughts on that.

    A invisible rectangle or box in front of the player that collides with an Item or button or person of interest and then shows the "hand" symbole. it would make it more universel for use. So you only need to use different kind of scripts for the entities to attach. It can make things easier. Best would be if the position of the box would be defined by the pivot that can be attached so its not nessesary to use the model axis which are often complete different.

  10. Okay cool, yeah I forgot about the timezones. I thought about people will have to work during the week. But it can be done. For example. we set a game master who stores the project and hand it over every friday evening to the next person. So its only on the weekends and the time zones doesnt get into account that much.

  11. Hey Dudes,

    yesterday when I was lying in bed I had this funny idea for a game game.

    Example:

    We have maybe 10 people who participate.

    One starts a blank project and starts to build a game.

    One day per person. At the end of the day, he hands the entire project over to the next person.

    There is no communication between the people.

    Who starts and follows is set be random.

    Just one map where everyone has to add something.

     

    We can discuss more rules. Maybe some keyword, general setting, used assets or genre.

    Could be very funny to see what comes out.

  12. Okay nice. This is working.

    Script.camera = nil--entity "camera"
    Script.cameraPivot = nil--entity "cameraPivot"
    
    function Script:Start()
    	self.position = self.cameraPivot:GetPosition(true)
    	self.rotation = self.cameraPivot:GetRotation(true)
    end
    
    function Script:SwitchToCameraPivot()--in
    	self.camera:SetPosition(self.position) 
    	self.camera:SetRotation(self.rotation) 
    end

    WIll play around with this and probably will have question again. Thank you very much.

  13. Okay Thanks. Here is a functional version of my first script with the Vec3. In case someone needs it.

    local CamRot = {}
    CamRot[1] = Vec3(0, 270 ,0)
    CamRot[2] = Vec3(0, 180 ,0)
    
    local CamPos = {}
    
    CamPos[1] = Vec3(5,10,-5)
    CamPos[2] = Vec3(-5,10,5)
    
    Cam1=1 
    Cam2=2
    
    function Script:Cam1()--in
    	self.Cam1=1
    
    end
    
    function Script:Cam2()--in
    	self.Cam2=2
    end
    
    function Script:UpdateWorld()
        if self.Cam1==1 then
            self.entity:SetRotation(CamRot[1].x, CamRot[1].y, CamRot[1].z)
            self.entity:SetPosition(CamPos[1].x, CamPos[1].y, CamPos[1].z)
            self.component:CallOutputs("inPosition1")
        end
        if self.Cam2==2 then
            self.entity:SetRotation(CamRot[2].x,CamRot[2].y,CamRot[2].z)
            self.entity:SetPosition(CamPos[2].x,CamPos[2].y,CamPos[2].z)
            self.component:CallOutputs("inPosition2")
        end
    
        end

     

    4 hours ago, AggrorJorn said:

    All together I would do something like this instead. Once you hit a trigger, simply place the existing camera at the position and rotation of a linked camera pivot. Attach script below to a pivot.

    
    self.camera = nil --entity "Camera"
    self.cameraPivot = nil --entity "Camera pivot"
    
    function Script:Start()
    	self.position = self.cameraPivot:GetPosition(true)
    	self.rotation = self.cameraPivot:GetRotation(true)
    end
    
    function Script:SwitchToCameraPivot()--in
    	self.camera:SetPosition(position) 
    	self.camera:SetRotation(rotation) 
    end

    Does not function. it says

    1 : attempt to index global 'self' (a nil value)

    This would be much better because its pain to set up all the cameras in the right postion by typing coordinates.

  14. Hello,

    I want the camera to switch its position once the Player hits the trigger box. Like Resident Evil or PnC-adventures.

    So after 20+ hours polishing my coding skill (which are still below room temperature) I came to this point here.

    local CamRot = {}
    
    
    CamRot[1] = 0
    CamRot[2] = 270
    CamRot[3] = 0
    CamRot[4] = 0
    CamRot[5] = 180
    CamRot[6] = 0
    
    
    local CamPos = {}
    
    CamPos[1] = 5
    CamPos[2] = 10
    CamPos[3] = -5
    CamPos[4] = -5
    CamPos[5] = 10
    CamPos[6] = 5
    
    Cam1=1
    Cam2=2
    
    
    function Script:Cam1()--in
    	self.Cam1=1
    end
    
    function Script:UpdateWorld()
    	if self.Cam1==1 then
    	self.entity:SetRotation(CamRot[1],CamRot[2],CamRot[3])
    	self.entity:SetPosition(CamPos[1],CamPos[2],CamPos[3])
    	self.component:CallOutputs("inPosition1")
    end
    end
    
    function Script:Cam2()--in
    	self.Cam2=2
    end
    
    
    function Script:UpdateWorld()
    	if self.Cam2==2 then
    	self.entity:SetRotation(CamRot[4],CamRot[5],CamRot[6])
    	self.entity:SetPosition(CamPos[4],CamPos[5],CamPos[6])
    	self.component:CallOutputs("inPosition2")
    end
    end

    The problem is Cam1 and Cam2 is functional but if I add a connection with the FlowGraph it triggers only the last one. Someone with a solution?

    Maybe I can only use one UpdateWorld function? I would like to use the GetChild, GetPosition functions and cycle the Camera between the added pivots but I dont how so far.

    Self-trySetup; Triggerscript: Standard, Playerscript:Thirdperson(lockedcam), Camerascript: posted one

    local CamRot = {}
    
    
    CamRot[1] = 0
    CamRot[2] = 270
    CamRot[3] = 0
    CamRot[4] = 0
    CamRot[5] = 180
    CamRot[6] = 0
    
    
    local CamPos = {}
    
    CamPos[1] = 5
    CamPos[2] = 10
    CamPos[3] = -5
    CamPos[4] = -5
    CamPos[5] = 10
    CamPos[6] = 5
    
    Cam1=1
    
    
    function Script:Cam1()--in
    	self.Cam1=1
    	self.enabled=true
    end
    
    function Script:UpdateWorld()
    	if self.Cam1==1 then
    	self.entity:SetRotation(CamRot[1],CamRot[2],CamRot[3])
    	self.entity:SetPosition(CamPos[1],CamPos[2],CamPos[3])
    	self.component:CallOutputs("inPosition1")
    	if self.entity:SetRotation(CamRot[1],CamRot[2],CamRot[3])==true and
    	   self.entity:SetPosition(CamPos[1],CamPos[2],CamPos[3])==true then
    			self.entity:SetRotation(CamRot[4],CamRot[5],CamRot[6])
    			self.entity:SetPosition(CamPos[4],CamPos[5],CamPos[6])
    			self.component:CallOutputs("inPosition2")
    end
    end
    end

    Here is another approch to the problem. It triggers only once as well.

    A Screenshot of the scene for better understanding.

    lw.png

×
×
  • Create New...