Jump to content

Mince

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Mince

  1. Thanks Rick, but that really wont work for the desired effects, as the forces need to continue through so many frames. We come a long way with lua; from no-where to a full but basic AI & Animation control. really tho I think we need to use c++. One thing we found with LUA is it runs differently different times, sometimes crashing editor sometimes not.>>really wired. We will share all our models and examples when we can upload here so you can try yourself. Do you find problems with LUA? Especially with playing sounds!!
  2. I see lots of you members are with it when it comes to programming in c++. The examples given seem messy and basic. I wanted to tidy it up I realise you must declare world,cam,buffers ect so I added the vars at the top and made some functions to crete cam and load level. When it compiles I get warnings about the possibility of accuracy loss from the following vars IS THIS EXCEPTABLE and or THE RIGHT WAY ?? //Global Vars TCamera fgcam; TLight light; TVec3 camrotation; TEntity campiv; TEmitter fire; TWorld foreground; TCamera cam; TBuffer gbuffer; TBuffer lightbuffer; But it compiles and when I run it it crashes out. Here is the full code please some1 take a second to help and maybe give a example, Your probably familiar with this one,its from the Heat/Fire example. #include "engine.h" #include <iostream> #include <string> const int ScreenWidth = 800; const int ScreenHeight = 600; const char* MediaDir = "C:/Program Files/Leadwerks Engine SDK"; const char* AppTitle = "Mince Machine"; void ErrOut( const std::string& message ) { std::cerr << message << std::endl; } //Global Vars TCamera fgcam; TLight light; TVec3 camrotation; TEntity campiv; TEmitter fire; TWorld foreground; TCamera cam; TBuffer gbuffer; TBuffer lightbuffer; float mx=0.0,my=0.0; class MinceMachine{ public: void MMCreateBuffer() { //Create a render buffer TBuffer gbuffer=CreateBuffer(1024,768,BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL); TBuffer lightbuffer=CreateBuffer(1024,768,BUFFER_COLOR|BUFFER_DEPTH); } void CreateCam() { TCamera fgcam=CreateCamera(); TEntity campiv=CreatePivot(); PositionEntity(campiv,Vec3(0,1,0)); TCamera cam=CreateCamera(campiv); PositionEntity(cam,Vec3(0,0,-4)); } void LoadLevel(const_str level) { LoadMesh("scene.gmf"); TWorld foreground=CreateWorld(); CameraClearMode(fgcam,0); } void Setup(int mode) { // leTFilter(1); // leAFilter(1); // leSetHDR(mode); // leSetBloom(mode); // leSetAntialias(4); // leSetSSAO(0); // leSetGodRays(0); // SetAppTitle( AppTitle ); // RegisterAbstractPath( MediaDir ); // // Set Lua framework object // SetGlobalObject( "fw", fw ); } void CreateLight(float x,float y,float z) { TLight light = CreatePointLight(); PositionEntity(light,Vec3(x,y,z)); EntityColor(light,Vec4(1,0.5,0,0.1)); } void mouse() { TVec3 camrotation; HideMouse(); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); } void MouseCamupdate() { mx=Curve(MouseX()-GraphicsWidth()/2,mx,3); my=Curve(MouseY()-GraphicsHeight()/2,my,3); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation=EntityRotation(campiv); camrotation.X+=my; camrotation.Y-=mx; RotateEntity(campiv,camrotation); } void CreateHeat(int Intensity,int LifeTime,float x,float y, float z,int RAD) { //Bit Of Red // TEmitter fire = CreateEmitter(Intensity,LifeTime,Vec3(x,y,z)); // EntityColor(fire,Vec4(1,0.5,0,0.1)); // PaintEntity(fire,LoadMaterial("fire.mat")); // SetEmitterRadius(fire,RAD,RAD/2); // SetEmitterWaver(fire,0.5); // SetEmitterRotationSpeed(fire,0.5); // SetEmitterArea(fire,Vec3(1,0.5,1)); //Create the heat haze emitter // TEmitter heat = CreateEmitter(Intensity/5,LifeTime*2,Vec3(x,y-0.5,z)); // TMaterial material=LoadMaterial("heathaze.mat"); // SetMaterialTexture(material,GetColorBuffer(lightbuffer),1); // SetMaterialTexture(material,GetDepthBuffer(gbuffer),2); // PaintEntity(heat,material); // SetEmitterRadius(heat,RAD+0.5,RAD+0.5); // SetEmitterWaver(heat,0.5); // SetEmitterRotationSpeed(heat,0.1); // SetEmitterArea(heat,Vec3(1,0.5,1)); } };//End of Mince Engine Machine Class int main(int argc, char** argv) { Graphics(1024,768,0,60,GRAPHICS_BACKBUFFER|GRAPHICS_DEPTHBUFFER); //Create a world TWorld world=CreateWorld(); if (!world) { MessageBoxA(0,"Error","Failed to create world.",0); //goto exitapp; return 0; } //Creeate Refrence Object MinceMachine Engine; Engine.Setup(1); Engine.CreateCam(); Engine.MMCreateBuffer(); Engine.LoadLevel("scene.gmf"); Engine.CreateHeat(100,1000,0,2,0,0.5); SetWorld(world); Engine.CreateLight(0,0.25,0); Engine.mouse(); Engine.MouseCamupdate(); //Main loop while(!KeyHit(KEY_ESCAPE)) { Engine.MouseCamupdate(); UpdateWorld(); //Render Main World SetBuffer(gbuffer); SetWorld(world); RenderWorld(); //Render Lights //SetBuffer(lightbuffer); //RenderLights(gbuffer); //SetBuffer(BackBuffer()); //DrawImage(GetColorBuffer(lightbuffer),0,TextureHeight(GetColorBuffer(lightbuffer)),TextureWidth(GetColorBuffer(lightbuffer)),-TextureHeight(GetColorBuffer(lightbuffer))); //Forground Render SetWorld(foreground); SetBuffer(BackBuffer()); ClearBuffer(BUFFER_DEPTH); SetEntityMatrix(fgcam,GetEntityMatrix(cam)); RenderWorld(); SetShader(0); SetWorld(world); Flip(); } //End of While Loop }//End of Program
  3. We want to move our charters with forces rather than Placing them, this will enable our characters to be pushed back by the bullet forces and explosions. Please help?
  4. Will LE3 use Lua? It seems We finally getting it.
  5. How would you go about allowing the cast to ignore this collision?
  6. Easy when u know how. Thanks Josh i got Decals!!!
  7. pick is the bullet.lua`s pick
  8. We Get Violation code, AND IT SHUTS DOWN. Please help. I have this code added into my bullet.lua and use the pick it does just before terminating its self with a emitter. --Add Decal This bit at tob of bullet.lua bulletholemat = ("abstract::bulletholemat.mat") bullethole=CreateDecal(pick.surface,TFormPoint(pick.position,nil,pick.entity), 5.0/16.0,30) EntityParent(bullethole,mesh,0) PaintEntity(bullethole,bulletholemat) AddMesh(bullethole, pick); FreeEntity(bullethole)
  9. model=GetMeshModel(pick.entity) model:AddForceAtPoint( bulletforce, pick.position ) Is crawler a model:Mesh ???
  10. We got a minigun and its fun blasting doors and drums about. We made each gun have different bullet force. Mini Gun to has 2000 rounds per clip and fire every 30ms. You goto have a go, LOL We would share it and scripts but waiting to become full members!
  11. This must relate to all, looking at Furious Frank and LECP. With this info Anyone can add bullet hit sounds to oildrum glass well anything really. also relating to bullet.lua> How come if you shoot oildrum the added force takes effect, but the force is not added to crawler?
  12. using minigun instead of object gave me a error attempting to index a global object with nil value, Does that mean It cant find the actual files?
  13. I have not any space left to host minigun.zip for you to see. can we upload here?
  14. .DDS works, .JPG works, .BMP works fine and also .TGA The only problem ive encountered in 3DWS is that .PNGs either don't show or are black and white / Distorted
  15. I tried the EntityNew={} ver That gave me a error with inherit = nil??? The following Script dont work, either if any one can help me rotate the blades that will be great. --Include the base script for all classes dofile("Scripts/base.lua") --Some global sounds we will use for all instances squeak={} squeak[0]=LoadSound("abstract::squeak_1.ogg") squeak[1]=LoadSound("abstract::squeak_2.ogg") --This function builds the interface for the properties editor function InitDialog(grid) --Add the base interface for all classes base_InitDialog(grid) --Now we can add our own custom properties group=grid:AddGroup( "Windmill" ) group:AddProperty( "spinspeed","|0,4",PROPERTY_FLOAT,"Spin Speed") group:Expand(1) end --Spawn function for creating new instances function Spawn(model) local entity=base_Spawn(model) --Retrieve a few limbs we will use later entity.blades=model:FindChild("windmill_blades") entity.base=model:FindChild("windmill_housing") entity.model:SetKey("spinspeed","1") --An update function for one instance. Declaring the function as part of the entity table allows us to use "self" for the table function entity:Update() --Although these limbs should always be present, it"s a good idea to add a check to make sure they exist before using them if self.blades~=nil then self.blades:Turnf(0,tonumber(self.model:GetKey("spinspeed"))*AppSpeed(),0,0) end if self.base~=nil then --Make the base sway slightly angle=math.sin(AppTime()/2000.0)*5-15 angle=angle+math.cos(AppTime()/500.0)*2 self.base:SetRotationf(0,0,angle,0) --Make the base squeak lasttime=tonumber(self.model:GetKey("lastsqueaktime","0")) if (AppTime()-lasttime>8000) then self.model:SetKey("lastsqueaktime",AppTime()+math.random(0,5000)) self.base:EmitSound(squeak[math.random(0,1)],50,1,0) end lasttime=tonumber(self.model:GetKey("lastsheeptime","0")) end end end --Update function, called during every UpdateWorld() function Update(world) if world==world_main then local model,entity for model,entity in pairs(entitytable) do if model.world==world then entity:Update() end end end end
  16. Yes i Opened it in Notepad the .MAT File that is, and typed in Blend=1 and i also tried Blend=Alpha. Still no joy
  17. Hi there, I'm making a Game in Leadwerks 2.3 and am having trouble making my Glass.DDS transparent I am using Photoshop CS5 with the N-vidia DDS Plugin I Edited the .PNG file adding an Alpha Channel. I then Made the Whole alpha channel black and then exported it as a DXT5 (Reccomended) and In the game it is not Transparent. I Also generated Mip Maps in the plugin and Tried flattening the image also. Still it doesn't work.
×
×
  • Create New...