Jump to content

AggrorJorn

Members
  • Posts

    4,816
  • Joined

  • Last visited

Posts posted by AggrorJorn

  1. 5 hours ago, Yue said:

    According to your experience, you can squat the character with SetInput ?.

    This used to be possible but is currently not supported by the character controller physics type. Making physics behave exactly like you want to can be really tricky. I know that Josh has spend a huge amount of time over the years trying to get the current character controller in its current state.

    If crouching is supported again, it will added to the third person script.

  2. On 8/14/2017 at 1:23 PM, randomdude said:

    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 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.

    On 8/15/2017 at 5:05 AM, Yue said:

    I think, what is great is that you teach us to make that script.

    The C++ video Cassius mentioned is what I still use as a base for the third person script. This new script is just more advanced with a lof of extra options.

     

    • Upvote 2
  3. Hi Santiago,

    First of welcome to the forum and to Leadwerks. 

    As for your question

    On 8/13/2017 at 4:25 AM, Santiago3D said:

    When I press SPACE I create an ammunition, but how do I do it? And how do I check all the ammunition and move them, according to your SCRIPT. And mainly, where should the code go to review all the ammunition in each loop? 

    As Thirsy Panther stated, there is a projectile script available that you can use. If you want to try it out on your own start with something like this:

    --pseudo
    if key.space then
    	local bulletInstance = bulletPrefab:Instantiate() --You can use prefabs to load an entity that has a script.
    	
    	--if it is just an entity, set the script for this newly created bullet
    	bulletInstance:SetScript("bullet.lua")
    
    end

    I would also recommend making a new topic in the programming section where you can clearly state your question and possibly give some more info like current scene setup, what you have in code so far etc. The more info you provide on what you want, the better we can help you.

  4. I mean the actual project files, so that we can try it out ourselves.

    Additionaly a screenshot of your player structure. To which object is your player attached. Your previous screenshots show the script tab, but not the actual entity it is attached to in your scene. 

    • Upvote 1
  5. Hi community,

    I would like your opinion on a question. I have been working on an advanced third person controller. The original idea was to sell this script on the workshop for a few dollars. What happened next is that I got contacted by @Rick and @Roland about converting this script to the Leadwerks Component System (LCS). In case you are not familiar with it: it is this really cool component and event driven system that makes creating gameplay so much more fun and managable. You can read more on it here and here.

    LCS
    To kind of help promote this cool system, I converted the third person controller to their system (which I call the RickRoll system). That means it will be opensource, and thus free to use and alter by anyone who wants to use the LCS. 

    My question to you is, should I still put the third person script on the workshop as a paid item? Note that this script works without using LCS. This one would really be drag and drop from a prefab and you are done.

    • Upvote 4
    1. Please use a code tag for your code.
    2. Can you describe what exactly isn't working? Do you see an error? What behviour are you seeing?
    3. Omit parts of your script that are not relevant for now (make a backup though): for instance the sound and drawing ui. 
    4. So you have this helicopter and by pressing a button, you want to fire a rocket? You want to separate that functionality.
    5. Try something more in this direction. A script for the helicopter and a script for a rocket.

    Helicopter

    --psuedo
    if keypressed then
    	local spawnPosition = self.entty:GetPosition(true)
    	local obuz = Prefab:Load("Prefabs/obuz.pfb")
    	obuz:SetPosition(spawnPosition)
    	obuz.script:Start()
    end

     

    Rocket

    function Script:UpdatePhysics()
    	self.entity:AddForce(0,0,obuzforce)
    end
    
    function Script:Collision(entity, position, normal, speed)
    	local collisiontype = entity:GetCollisionType()
    
    	if collisiontype==Collision.Prop or collisiontype==Collision.Scene then
    		--Create an explosion emitter here
      	end
    end

     

  6. Again, many ways to do this. Some possibilities:

    • Let each enemy perform a distance check once a loop or after a timer is done. 
      --in enemey UpdateWorld
      local playerPos = self.entity:GetPosition(true)
      local enemyPos = self.playerEntity:GetPosition(true)
      local distance = playerPos:DistanceToPoint(enemyPos)
      
      if distance < 1.5 then --1.5 is just an examepl.
         System:Print("within attack range or something")            
      end

       

    • Or you let the player do a ForEachEntityinAABB. This retrieves all entities within a give shape around the player. Then for every entity it finds,check if it is an enemy and you can do things. 
      --player updateworld
      local playerSurrounding = self.entity:GetAABB(Entity.GlobalAABB)
      local world = World:GetCurrent()
      world:ForEachEntityInAABBDo(playerSurrounding, "MyCallback", self.entity)
      
      function MyCallback(entity, extra)
      	if entity.script ~= nil and entity.script.isEnemy then
      		System:Print("this is an enemy in the players region")
      	end
      end

       

  7. There are several ways to do this.

    • Script property. If is it an occasional entity that needs a reference, just use a script propery for entities and drag in the player. 
      Script.player = nil --entity "Player"

       

    • If many objects require a reference, I would handle it automatically. At the start of each script, loop over the entities in the world and check if the player is among them. If the player name is unique, then you can do something like this:
      local n
      for n=0, world:CountEntities()-1 do
      	local entity = world:GetEntity(n)
      	if entity:GetKeyValue("name") == "MyPlayer" then
      		playerEntity = entity
      		break
      	end
      end

      Note that you might want to store the player reference somewhere as it is used a lot. Saves iterations on start up.

  8. On 8/2/2017 at 1:18 PM, Rick said:

    I would make an online massive game that only has one "world" as far as the users knew. It would have to be multiple servers behind the scenes though. It would be an endless world because it would grow as players explored.

    I like it. but somehow I have a 2d sprite world in my head when I read this.

     

    On 8/2/2017 at 9:51 PM, gamecreator said:

      Inspired by Trine......

    Great game and very nice visuals too.

     

    On 8/4/2017 at 6:16 PM, aiaf said:

    ll remain persistent between plays so you will populate the world with events you will recognize.Say you become somehow a leader and start a war and you will see the remains of a battle or some monuments.

    That sounds cool. Pretty much exactly what I would want in my game. The devastation of previous battles, should still be visible. Eve online does this pretty well.

  9. 40 minutes ago, randomdude said:

    WIll play around with this and probably will have question again.

    It is good that you are trying to make your own stuff work first. And if you are really stuck, don't hesitate to ask. That is what the community is there for. 

  10. 13 hours ago, randomdude said:

    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.

    There can be only 1 UpdateWorld function per script. 

     

    Some feedback on how to use Vec3 instead of 3 separate variables for the coordinates.

    local CamRot = {}
    CamRot[1] = Vec3(0, 270 ,0)
    CamRot[2] = Vec3(0, 180 ,0)
    
    self.entity:SetRotation(CamRot[1].x, CamRot[1].y, CamRot[1].z )

     

    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

     

×
×
  • Create New...