Jump to content

reepblue

Developers
  • Posts

    2,503
  • Joined

  • Last visited

Everything posted by reepblue

  1. My wait list of things that Josh mentioned in the past that I'm hyped for. Right-Click->Create menu on the viewports for faster creations of pivots, cameras, and lights. A hint system so you can make entities invisible without applying a new material to it. Would be great for trigger brushes as I use a tool texture for them so I know where they are in my maps. Updated widgets, at least have them look more different Between Transition, Rotation, And Scale. Auto complete and script editor more sorted out. Right now random values are highlighted blue, and the auto complete only worked one update for me before (I think it's temp disabled unless it works with everyone else). Even if then, it was more annoying than helpful unlike the VS auto completion. Again, not making new requests, just restating ideas that Josh mentioned a while back. He might have something else big he wants to do after vegetation. Who knows, it might be roads like in LE2. Also, can't wait to see the updated SDK art stuff along with content creators to easily sell their work.
  2. I got this working a input-able console started this morning thanks to a Vectronic beta tester after he complained that he couldn't choose a map to test. (Since there is now 11 maps) It's pretty basic now, but since it's a singleton class, I can easily put it in Vectronic to see how it works in practice.
  3. reepblue

    Steam OS

    Since it's Debian based like Ubuntu, it should work, but the UI might be messed up since it was developed for the Unity desktop in-mind. It would be super awesome to be able to pickup the Alienware SteamBox (or another SteamBox of your choice) and develop games right on it! You can always make another partition and install Ubuntu on it, they are just mini-PCs.
  4. If you just use the Github desktop gui, it should be easy. All you really need to know is clone, pull, commit. and push. You can also use Dropbox as you can roll back file versions on their website.
  5. I looked through those threads, and I'm shocked I did not see that this was discussed before, Did you applied this yet Josh, or was it written down on a sticky note somewhere and other things came up, or you did as it was way worse before. Again, right now it's not game ruining, but it would be nice to see this better accommodated when I'm ready to ship if possible. And I'm sure others would like to see this too.
  6. Might have to do with the "Render To Target" option that was introduced in 3.6.
  7. I guess I'll make that decision when the game matures more. I personally don't see a huge plus with 8x at this point, but then again, the maps are very primitive as of now. I'm gonna hide 16x of being an option in the menu, but not sure about 8x. People with "Power PCs" tend to set everything to max out of habit, and I don't want them selecting an expensive option that just slows everything down. I'll have to see how 8x plays when the maps get an art pass.
  8. Oh really, I would expect to see the culling on my machine since it's a 5 year old PC with a GTX 750ti in it, but a bit shocked to see that my tester with a newer PC and a GTX 970 is seeing this too. Then again, I'm sure if you set the mouse sensitivity too low, no GPU on the market will be able to keep up. I was seeing issues with 8x, but it turned out that my flood lights had their ranges too big or something. I was getting frame dips in full screen when I transitioned to certain levels. I managed to fix this, and the flood lights are temp anyway. Only 16x lags now on my testers and my end now so I'll probably limit it to 8x in the options menu; but people can still use 16x with a launch property. Thanks guys, was curious myself, and now I have answers for my testers.
  9. While I'm in my neck of the woods developing Vectronic, I've stumbled upon a few things about the engine that I got aware of while playtesting. I've been wondering about these for a while (and some since I started with the engine) so I decided to post all of these questions here. 1) How do you reduce/remedy the frustum culling for the FPS camera? While I do understand why this happens, I was wondering if it was possible to make walls and objects popping into place less obvious. While in Marble Games and Darkness Awaits this is not a problem as the camera is just following the player around. However, since the FPS camera is constantly moving, and rotating, you notice the frustum culling the most, espeucally when the mouse is set to a high sensitivity. Is there a trick to make it so at least brushes don't do this if the player is in the same room as it/less noticeable? 2) Intense slowdown with 16x MSSA even on high end cards. While for me I can't go any higher than 4x (Well I can, It just seems to stick to 30fps for a bit before shooting to 60), One of my tester has a GTX970 and he was surprised that 16x mssa chugs his framerate down to the forties. (With Vsync on). Is everything working correctly, or something is acting up? I would expect a 970 to run Leadwerks at max with no problems, especially when the map looks like this with no shadows. I can get his full system specs if you need it. He can do 8x without any issues. I was also gonna ask someone with a GTX 980 to test it, but they're distracted playing Fallout 4. If something is up with 16x or it's some hardware limitation, I can just disable the option for 16x mssa. I thought I had more, but those two seem to be on the top of my head right now. While they are not "Game Canceling" issues, I hope to have some explanation of what's going on so I can create a better product. Thanks.
  10. Just put this instead of Map::Load() when you start the game: nextmap = "Maps\mymap.map" And the function before will automatically save the the current map you're playing. The entire thing should look like: std::string nextmap std::string currentmap if (nextmap != NULL) { World::Clear() Time::Pause() Map::Load(nextmap) Time::Resume() currentmap = nextmap nextmap = NULL // Make nextmap null so it does not loop. }
  11. Not really advanced, LEX is just complicated. Simply put: std::string nextmap std::string currentmap if (nextmap != NULL) { // Put this after you stopped the time and cleared the world. currentmap = nextmap nextmap = NULL // Make nextmap null so it does not loop. } Then when you want the map to reload: Map::Load(currentmap)
  12. What kind of a "reset" you want? In the Darkness Awaits Template, I made it reload the map by saving the changename string into another string before clearing the changename value. A C++ example of what I'm talking about can be found here.
  13. When I need something quick, I try SoundBible first. You might not find what you're looking for but there is also the Sonniss pack which from a small portion of what Thirsty Panther sent, I'm getting great use of.
  14. reepblue

    Vegetation Demo

    Like Shadmar, Shadows for me are funny. Sometimes they work, sometimes they don't. I tried launching the application once with a batch for fullscreen and lightquality set to 2 (before I noticed it's the application doing all the work) and my shadows did work, looked really crisp, but it ran at 20 frames for a while, then it shot to 100+ until I went to another area of the terrain. (GTX 750Ti) I understand that this is still a work in progress, but I though I should let you know. I also hope grass and bushes don't float over dips in the terrain when this is ready to go. (Nitpick )
  15. It's just how the engine works. No script on brushes = collapse as CSG.
  16. This is because the brush get's collapsed into CSG, and is no longer an entity. Apply this script to any brushes you want to mpve with your door. function Script:Start() -- Do nothing... end
  17. No, there is no licence for LEX. Maybe "LEX2" will if I ever decide to work on it, but this is 100% for the community, and free to use. Copyright tags are just there just to let you know I wrote the damn thing. Maybe I should have just put "Written by reepblue" but I'm so use to working with CPPs with large commented headers. Don't worry about it. I do admit, you might find it confusing at first. If you have any questions, feel free to PM me, or post on the LEX topic. Thanks.
  18. No, you're better off using mine or your own for the time being. Hopefully someday soon GUI elements will be built in.
  19. Josh added these in the 3.6 update, but there is currently no code for them as of yet. Attempting to use them will crash your application.
  20. Hey all, As a curiosity, over the weekend I found the old install of the 3.0 demo that included assets from the old sample game "Darkness Awaits". While models, textures of this project might be on the template, I don't think the scripts are. The engine has come a long way since 3.0 and instead of simply just porting assets into the newer engine and call it a day, I took the time to streamline code, textures, and fix things that were broken in the old demo. This way, the template is another example of how to make games using Leadwerks! Changes include: The start map has been updated visually showing off the current features of the engine such as deferred shadows and decals. There is now more Goblins! Normal maps are now blue instead of the magenta color they where before. Adjusted some speculator settings in most materials. Removed any instances of mobile/touch controls. All code works with current SDK scripts (Such as the current PushButton.lua). Barbarian and Goblin models both have normal and spec maps for their sheets and weapons. The Player now dies and displays a GameOver screen. Player's healthbar has been fixed when the player's health reached 0. Player and Goblin scripts now use the ReleaseTables script. Other compatibility edits. Player and Goblin scripts calls animation names instead of sequence numbers. The Player's Delete() function got replaced with Release(). Fixed Goblin's Navigation code. Goblins now stop attacking the player when they are dead. Player code now creates a camera instead of the mapper having to add one. Player and Goblins now have footsteps sounds. Models had their shapes redone in the model editor instead of the old shape tool that's under the Legacy Features. Added Crate Model. Prefabs where updated/fixed. Removed the switch prefab (it was broken, and broke the editor). The template still uses the older App.lua due to it's menu system. However, it's been modified to include newer additions in later versions of that script. (map changing, settings via Properties) You can download the file here on my GitHub. Install it under Steam\steamapps\common\Leadwerks Game Engine\Templates. Should work on both Windows and Linux. I ported this project due to the fact I felt like this game showed how to make a simple menu/startscreen in Lua without needing FlowGUI, LEX, or other things. Also another reminder that I just did the port/fixes. "Darkness Awaits" was originally created by Josh, Chris Vossen, and other members who where involved. Again, I did this out of curiosity, and I thought it would benefit the community if it was re-released as a template. If you have any problems, let me know.
  21. Use the sound class instead for simplicity. I did the same thing in my weapon script I did a while ago. Feel free to pick at it, or use the entire thing if you want. It has a max ammo count, and it auto reloads when the clip is empty, but the player has ammo. import "Scripts/AnimationManager.lua" Script.index=1--int "Weapon slot" Script.offset=Vec3(0,0,0)--Vec3 "Offset" Script.rotation=Vec3(0,0,0)--Vec3 "Rotation" Script.clipsize=6--int "Clip size" Script.ammo=200--int "Ammunition" Script.maxammo=200--int "Max Ammunition" Script.maxswayamplitude=0.01 Script.amplitude=0 Script.swayspeed=0 Script.timeunits=0 Script.smoothedposition=Vec3(0) Script.smoothedrotation=Vec3(0) Script.verticalbob=0 Script.jumpoffset=0 Script.bulletspeed=200--float "Bullet speed" Script.landoffset=0 Script.pellets=1--int "Pellets" Script.scatter=0.01--float "Scatter" Script.firetime=0 Script.refirerate=100--int "Refire rate" Script.bulletrange=1000 Script.muzzleflashscale=0.2--float "Flash size" Script.bulletforce=500--float "Force" Script.bulletdamage=10--int "Damage" Script.automatic=true--bool "Automatic" Script.dryfiresoundfile=""--path "Dry fire" "Wav File (*wav):wav|Sound" Script.fire1soundfile=""--path "Fire sound 1" "Wav File (*wav):wav|Sound" Script.fire2soundfile=""--path "Fire sound 2" "Wav File (*wav):wav|Sound" Script.fire3soundfile=""--path "Fire sound 3" "Wav File (*wav):wav|Sound" Script.pumpsoundfile=""--path "Pump sound" "Wav File (*wav):wav|Sound" Script.crosshairtexfile="Materials/HUD/crosshair_weapon.tex" --path "Crosshair" "Tex File (*tex):tex|Texture" Script.ricochet1soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_01.wav") Script.ricochet2soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_02.wav") Script.ricochet3soundfile=Sound:Load("Sound/Ricochet/bullet_impact_dirt_03.wav") Script.pickupsoundfile=Sound:Load("Sound/Player/pickupammo.wav") Script.reloadsoundfile=""--path "Reload sound" "Wav File (*wav):wav|Sound" Script.reloadspeed=0.05--float "Reload speed" Script.firespeed=0.05--float "Fire speed" Script.tracer = Sprite:Create() Script.tracer:Hide() Script.currentaction=nil function Script:Start() if self.started then return end self.started=true self.entity:SetPickMode(0,true) self.entity:SetAnimationFrame(0,1,"fire") self.entity:Hide() self.bullets = {} self.entity:SetShadowMode(0) self.entity:SetOcclusionCullingMode(false) self.tracer:SetViewMode(6)--Rotate around z axis self.tracer:SetSize(0.1,2) local mtl = Material:Load("Materials/Effects/tracer.mat") if mtl then self.tracer:SetMaterial(mtl) mtl:Release() end self.currentaction=nil self.clipammo=self.clipsize self.IsWeapon=true self.ammo = self.ammo - self.clipammo self.muzzle = self.entity:FindChild("muzzle") self.sound={} if self.sound.dryfiresoundfile~="" then self.sound.dryfire=Sound:Load(self.dryfiresoundfile) end self.sound.fire={} if self.pumpsoundfile~="" then self.sound.pump=Sound:Load(self.pumpsoundfile) end if self.fire1soundfile~="" then self.sound.fire[1]=Sound:Load(self.fire1soundfile) end if self.fire2soundfile~="" then self.sound.fire[2]=Sound:Load(self.fire2soundfile) end if self.fire3soundfile~="" then self.sound.fire[3]=Sound:Load(self.fire3soundfile) end if self.reloadsoundfile~="" then self.sound.reload=Sound:Load(self.reloadsoundfile) end self.sound.ricochet={} self.sound.ricochet[1]=Sound:Load("Sound/Ricochet/bullet_impact_dirt_01.wav") self.sound.ricochet[2]=Sound:Load("Sound/Ricochet/bullet_impact_dirt_02.wav") self.sound.ricochet[3]=Sound:Load("Sound/Ricochet/bullet_impact_dirt_03.wav") self.sound.ammo=Sound:Load("Sound/Player/pickupammo.wav") -- Crosshair self.image={} self.image.crosshair = Texture:Load(self.crosshairtexfile) --self.image.crosshairleft = Texture:Load("Materials/HUD/crosshair_bracket_left.tex") --self.image.crosshairright = Texture:Load("Materials/HUD/crosshair_bracket_right.tex") self.entity:SetPickMode(0) self.muzzleflash = Sprite:Create() self.muzzleflash:SetSize(self.muzzleflashscale,self.muzzleflashscale) self.muzzleflash:SetCollisionType(0) local material = Material:Load("Materials/Effects/muzzleflash.mat") self.muzzleflash:SetMaterial(material) self.muzzlelight = PointLight:Create() self.muzzlelight:SetColor(1,0.75,0) self.muzzlelight:SetRange(4) self.muzzleflash:SetShadowMode(0) local tag = self.entity:FindChild("muzzle") self.muzzlelight:SetParent(tag) self.muzzlelight:SetPosition(0,0,0) self.muzzlelight:Hide() self.muzzleflash:SetParent(self.muzzlelight,false) self.animationmanager = AnimationManager:Create(self.entity) self.originalposition = self.entity:GetPosition() self.originalrotation = self.entity:GetRotation() self.emitter={} --[[ --Debris emitter - This will throw chunks off of walls and make it look like they are breaking self.emitter[0]=Emitter:Create() self.emitter[0]:SetMaterial("Materials/Effects/tracer.mat") self.emitter[0]:SetEmissionVolume(0.05,0.05,0.05) self.emitter[0]:SetColor(1,1,1,1) self.emitter[0]:SetVelocity(10,10,10,1) self.emitter[0]:SetParticleCount(5) self.emitter[0]:SetReleaseQuantity(5) self.emitter[0]:SetMaxScale(0.25,1) self.emitter[0]:SetDuration(150) self.emitter[0]:SetRotationByVelocityMode(true) self.emitter[0]:Hide() ]]-- --Debris emitter - This will throw chunks off of walls and make it look like they are breaking self.emitter[0]=Emitter:Create() self.emitter[0]:SetMaterial("Materials/Effects/default.mat") self.emitter[0]:SetEmissionVolume(0.05,0.05,0.05) self.emitter[0]:SetColor(0.1,0.1,0.1,1) self.emitter[0]:SetVelocity(1.5,1.5,1.5,1) self.emitter[0]:SetParticleCount(10) self.emitter[0]:SetReleaseQuantity(10) self.emitter[0]:SetMaxScale(0.3) self.emitter[0]:SetDuration(1000) self.emitter[0]:SetAcceleration(0,-12,0) self.emitter[0]:Hide() --Smoke emitter - This will provide a soft dust effect around bullet impacts self.emitter[1]=Emitter:Create() self.emitter[1]:SetColor(1,1,1,0.25) self.emitter[1]:SetMaterial("Materials/Effects/smoke.mat") self.emitter[1]:SetEmissionVolume(0.1,0.1,0.1) self.emitter[1]:SetVelocity(0.3,0.3,0.3,1) self.emitter[1]:SetParticleCount(3) self.emitter[1]:SetReleaseQuantity(3) self.emitter[1]:SetMaxScale(4) self.emitter[1]:SetDuration(2500) self.emitter[1]:AddScaleControlPoint(0,0.5) self.emitter[1]:AddScaleControlPoint(1,1) self.emitter[1]:SetRotationSpeed(10) self.emitter[1]:Hide() --Blood emitter - This will provide a visual cue when an enemy is shot self.emitter[2]=self.emitter[1]:Instance() self.emitter[2] = tolua.cast(self.emitter[2],"Emitter") self.emitter[2]:SetMaterial("Materials/Effects/bloodspatter.mat") self.emitter[2]:SetColor(1,1,1,0.25) self.emitter[2]:SetParticleCount(3) self.emitter[2]:SetReleaseQuantity(3) self.emitter[2]:SetDuration(200) self.emitter[2]:SetEmissionVolume(0,0,0) self.emitter[2]:SetMaxScale(1) self.emitter[2]:SetRotationSpeed(10) self.emitter[2]:AddScaleControlPoint(0,0) self.emitter[2]:AddScaleControlPoint(1,1) self.emitter[2]:SetVelocity(0,0,0,0) self.emitter[2]:SetVelocity(0,0,0,1) self.emitter[2]:Hide() --[[if self.autogive then local player,n for n,player in ipairs(players) do player:AddWeapon(self,self.index) end end]]-- self.entity:Hide() end function Script:Holster() if self.entity:FindAnimationSequence("holster")>-1 then self.animationmanager:SetAnimationSequence("holster",self.reloadspeed,0,1)--,self,self.EndHolster,25) end end function Script:Unholster() if self.entity:FindAnimationSequence("unholster")>-1 then self.animationmanager:SetAnimationSequence("unholster",self.reloadspeed,0,1) self.currentaction="unholster" end end function Script:Hide() self.entity:Hide() self.muzzlelight:Hide() end function Script:FindScriptedParent(entity,func) while entity~=nil do if entity.script then if type(entity.script[func])=="function" then if entity.script.enabled~=false then return entity else return nil end end end entity = entity:GetParent() end return nil end function Script:BeginJump() self.jumpoffset = -180 end function Script:BeginLand() self.landoffset = -180 end function Script:SupressCrosshair() self.supresscrosshair = true end function Script:UnSupressCrosshair() self.supresscrosshair = false end function Script:FinalizeReload() self.currentaction=nil if self.cancelreload then self.cancelreload=false end end function Script:ReceiveAmmo(ammount) self.ammo = self.ammo + ammount if self.sound.ammo~=nil then self.sound.ammo:Play() end if self.ammo > self.maxammo then self.ammo = self.maxammo end end function Script:IsAmmoMaxed() if self.ammo < self.maxammo then return true end return false end function Script:EndReload() if self.entity:FindAnimationSequence("ReloadLoop")>-1 then if self.ammo>0 and self.clipammo<self.clipsize and (self.reloadedshells==0 or self.cancelreload==false) then if self.sound.reload~=nil then self.sound.reload:Play() end self.animationmanager:SetAnimationSequence("ReloadLoop",self.reloadspeed,300,1,self,self.EndReload) self.clipammo = self.clipammo + 1 self.ammo = self.ammo - 1 self.reloadedshells = self.reloadedshells + 1 else self.animationmanager:SetAnimationSequence("ReloadEnd",self.reloadspeed,300,1,self,self.FinalizeReload) end else self.currentaction=nil local rounds = self.clipsize - self.clipammo rounds = math.min(self.ammo,rounds) self.ammo = self.ammo - rounds self.clipammo = self.clipammo + rounds end end function Script:CanReload() if self.currentaction==nil then return true else return false end end function Script:Reload() if self.currentaction==nil then self.cancelreload=false if self.clipammo<self.clipsize and self.ammo>0 and self.currentaction==nil then self.currentaction="reload" self.reloadedshells=0 if self.entity:FindAnimationSequence("Reload")>-1 then self.animationmanager:SetAnimationSequence("Reload",self.reloadspeed,300,1,self,self.EndReload) self.reloadstarttime=Time:GetCurrent() if self.sound.reload~=nil then self.sound.reload:Play() end elseif self.entity:FindAnimationSequence("ReloadStart")>-1 then self.animationmanager:SetAnimationSequence("ReloadStart",self.reloadspeed,300,1,self,self.EndReload) end end end end function Script:FinalizeFire() self.currentaction=nil end function Script:EndFire() if self.entity:FindAnimationSequence("Pump")>-1 then self.animationmanager:SetAnimationSequence("Pump",0.03,300,1,self,self.FinalizeFire) if self.sound.pump~=nil then self.sound.pump:Play() end else self.currentaction=nil end end function Script:UpdateWorld() local bullet,n,dist local pickinfo=PickInfo() local firstbullet=true local travel for n,bullet in ipairs(self.bullets) do --Check how far the bullet has travelled dist = (bullet.position-bullet.origin):Length() if dist>self.bulletrange then table.remove(self.bullets,n) bullet.sprite:Release() bullet=nil end if bullet~=nil then travel = bullet.velocity/60.0*Time:GetSpeed() if self.entity.world:Pick(bullet.position,bullet.position+travel,pickinfo,0,true,Collision.Projectile) then table.remove(self.bullets,n) bullet.sprite:Release() --Find first parent with the Hurt() function local enemy = self:FindScriptedParent(pickinfo.entity,"Hurt") if enemy~=nil then if enemy.script.health>0 then enemy.script:Hurt(self.bulletdamage,self.player) end --Blood emitter e = self.emitter[2]:Instance() e = tolua.cast(e,"Emitter") e:Show() e:SetLoopMode(false,true) e:SetPosition(pickinfo.position+pickinfo.normal*0.1) e:SetVelocity(0,0,0) else --Add a temporary particle emitter for bullet effects local e e = self.emitter[0]:Instance() e = tolua.cast(e,"Emitter") e:Show() e:SetLoopMode(false,true) e:SetPosition(pickinfo.position) local v=3 e:SetVelocity(pickinfo.normal.x*v,pickinfo.normal.y*v,pickinfo.normal.z*v,0) --Smoke emitter e = self.emitter[1]:Instance() e = tolua.cast(e,"Emitter") e:Show() e:SetLoopMode(false,true) e:SetPosition(pickinfo.position+pickinfo.normal*0.1) local v=0.2 e:SetVelocity(pickinfo.normal.x*v,pickinfo.normal.y*v,pickinfo.normal.z*v,0) --Play bullet impact noise e:EmitSound(self.sound.ricochet[math.random(#self.sound.ricochet)],30) if pickinfo.entity~=nil then --Add impulse to the hit object if pickinfo.entity:GetMass()>0 then --local force = pickinfo.normal*-1*self.bulletforce local dir = bullet.velocity:Normalize() local force = dir * self.bulletforce * math.max(0,-pickinfo.normal:Dot(dir)) --force = force * math.max(0,-pickinfo.normal:Dot(d))--multiply by dot product of velocity and collided normal, to weaken glancing blows pickinfo.entity:AddPointForce(force,pickinfo.position) end --Extract a partial surface from the hit surface and make a bullet mark --To be added later --if pickinfo.surface~=nil then -- local aabb = AABB(pickinfo.position-radius,pickinfo.position+radius) -- local surf = pickinfo.surface:Extract(aabb) --end end end else bullet.position = bullet.position+travel bullet.sprite:SetPosition(bullet.position - bullet.velocity:Normalize()*1) if bullet.sprite:Hidden() then dist = (bullet.position-bullet.origin):Length() if dist>bullet.sprite:GetSize().y then bullet.sprite:Show() end end end end firstbullet = false end end function Script:Fire() if self.player.weaponlowerangle==0 then local currenttime=Time:GetCurrent() if self.lastfiretime==nil then self.lastfiretime=0 end if currenttime-self.lastfiretime>self.refirerate then if self.currentaction==nil then self.lastfiretime = currenttime if self.clipammo==0 then if self.sound.dryfire then if self.suspenddryfire~=true then self.sound.dryfire:Play() if self.player~=nil then self.player.suspendfire=false self:Reload() end end end else self.currentaction="fire" if #self.sound.fire>0 then self.sound.fire[math.random(#self.sound.fire)]:Play() end self.clipammo = self.clipammo - 1 self.firetime = Time:GetCurrent() self.muzzlelight:Point(self.player.camera,1) self.muzzlelight:Show() self.muzzleflash:SetAngle(math.random(0,360)) self.animationmanager:SetAnimationSequence("Fire",self.firespeed,300,1,self,self.EndFire) --Spawn bullet local n for n=1,self.pellets do local d = Transform:Normal(0,0,1,self.player.camera,nil) d = d + Vec3(math.random(-1,1),math.random(-1,1),math.random(-1,1)) * self.scatter d = d:Normalize() local p if self.muzzle then p=self.muzzle:GetPosition(true) self:SpawnBullet(p,d*self.bulletspeed) else System:Print("Warning: Muzzle entity not found.") end end end else self.cancelreload=true end end end end --Creates a bullet function Script:SpawnBullet(position,velocity) local bullet = {} bullet.sprite = tolua.cast(self.tracer:Instance(),"Sprite") bullet.sprite:SetPosition(position) bullet.sprite:AlignToVector(velocity) bullet.sprite:Hide() bullet.position = position bullet.origin = Vec3(position.x,position.y,position.z) bullet.velocity = velocity table.insert(self.bullets,bullet) end function Script:Draw() local t = Time:GetCurrent() if self.muzzlelight:Hidden()==false then if t-self.firetime>50 then self.muzzlelight:Hide() end end local jumpbob = 0 if self.jumpoffset<0 then jumpbob = (Math:Sin(self.jumpoffset))*0.01 self.jumpoffset = self.jumpoffset + 8*Time:GetSpeed() end if self.landoffset<0 then jumpbob = jumpbob + (Math:Sin(self.landoffset))*0.01 self.landoffset = self.landoffset + 10*Time:GetSpeed() end --Animate the weapon local bob = 0; local speed = math.max(0.1,self.player.entity:GetVelocity():xz():Length()) if self.player.entity:GetAirborne() then speed = 0.1 end self.swayspeed = Math:Curve(speed,self.swayspeed,20) self.swayspeed = math.max(0.5,self.swayspeed) self.amplitude = math.max(2,Math:Curve(speed,self.amplitude,20)) self.timeunits = self.timeunits + self.swayspeed*4*Time:GetSpeed() local sway = math.sin(self.timeunits/120.0) * self.amplitude * self.maxswayamplitude bob = (1-math.cos(self.timeunits/60.0)) * self.maxswayamplitude * 0.1 * self.amplitude local campos = self.player.camera:GetPosition(true) self.smoothedposition.x = campos.x self.smoothedposition.y = Math:Curve(campos.y,self.smoothedposition.y,2) self.smoothedposition.z = campos.z self.entity:SetRotation(self.rotation) self.entity:SetPosition(sway*self.entity.scale.x,bob+jumpbob,0) self.entity:Translate(self.offset,false) self.animationmanager:Update() end function Script:Release() if self.emitter~=nil then self.emitter[0]:Release() self.emitter[1]:Release() self.emitter[2]:Release() self.emitter=nil end if self.sound~=nil then ReleaseTableObjects(self.sound) self.sound=nil end end function Script:Cleanup() self.tracer:Release() end --This function will be called after the world is rendered, before the screen is refreshed. --Use this to perform any 2D drawing you want the entity to display. function Script:PostRender(context) -- Don't draw if we don't have a player. if self.player == nil then return end -- Don't draw if we are not a weapon. if not self.IsWeapon then return end -- Don't draw if player is dead. if self.player.health<=0 then return end -- Crosshair keyvalues if self.supresscrosshair then return end -- From crosshair keyvalue. if self.player.supresswpncrosshair then return end -- If we are holding something if self.player.carryingEntity then return end -- Disable the default crosshair. --self.player.supresscrosshair = true local crossHairX = math.floor((context:GetWidth() - self.image.crosshair:GetWidth()))/2 local crossHairY = math.floor((context:GetHeight() - self.image.crosshair:GetHeight()))/2 context:SetBlendMode(Blend.Alpha) context:SetColor(1,1,1,1) context:DrawImage(self.image.crosshair, crossHairX, crossHairY) context:SetBlendMode(Blend.Solid) end
  22. I asked the same question a while back. You still need 2013, but I think VS2015 support is coming eventually.
  23. Coming out really nice! I hope someday we can make multiplayer games for the launcher, that would be pretty sweet.
  24. Here is a quick map I did in the Advanced First Person Template. The left platform uses the advertised way of making platforms, while the right uses the Move() function. Note using SetPostition each pass also makes similar results. If you were to increase the barrels mass to something like 20, the platform on the left will break. I fixed this thanks to Einlander's script, and I talked about it here. Making a model or CSG move and react to physics much like the func_door entity from Source should not be this convoluted. If the jointed object much how the sliding door script is set up did not react to an objects weight, the issue would be solved. PlatformTest.zip
  25. Also new Cursors! Hopefully they don't down the line break like the Hammer Cursors.
×
×
  • Create New...