Jump to content

hippokittie

Members
  • Posts

    48
  • Joined

  • Last visited

Everything posted by hippokittie

  1. http://postimg.org/image/isvn2hy7v/ http://postimg.org/image/ej6dfbs0p/ http://postimg.org/image/5ak5cgwor/ There is the un textured uv, a textured uv, and a image from the 3d program. Any ideas?
  2. Okay this may sound dumb but my textures arnt working. In my 3d modeling program they all look fine, and in the texture preview they look fine. Yet when they are on the model its just a solid color not my texture. Its not with all my models though, as my monsters all look fine. There is also an issue with the weapons as they look fine and textured in the previewer, but when in game they to are solid color. Not sure if things are going wrong when I import the models or if there is just an issue with how the texturing is being applied. Please do tell me I am not the only one with this issue!
  3. So I plugged the script into the the editor, and still nothing. I don't know what I am doing wrong.............. The ai script I am using for the test is just the default ai script, altered the name and animation sequences, from leadwerks. I took the hurt function directly from the fpsweapon (that I called) and the ai has functions for hurt. The collision is set on a collision box on the blade as a prop, and I even tried making the box larger to see if that would work but it didn't... I am so confused
  4. Helpful, but confusing. So with this kinda code it should fire off everytime the blade makes contact? import "Scripts/Objects/Player/FPSWeapon.lua" Script.damage=10 Script.entered = false Script.exited = false Script.hadCollision = false function Script:Start() self.enabled=true end function Script:Fire() local enemy = self:FindScriptedParent(Collision.entity,"Hurt") if enemy.script.health>0 then enemy.script:Hurt(self.damage,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) end function Script:UpdatePhysics() if self.entered then Fire=true end if self.hadCollision == false then if self.exited == false then self.exited = true self.component:CallOutputs("OnExit") self.entered = false end end end self.hadCollision = false end function Script:Collision(entity, position, normal, speed) self.hadCollision = true self.component:CallOutputs("OnCollide") if self.entered == false then self.component:CallOutputs("OnEnter") self.entered = true self.exited = false end end
  5. So I have been working for a few weeks on making and fixing up this code, and am at an impasse. I have the weapon equipping and swinging, but nothing is happening to the monsters. I have the code broken into 2 parts, 1 for the swinging and equip, and 1 (attached to a collision entity on the weapons blade) that when it collides with an enemy ai it is supposed to remove health from them. The second code I also plan on tweaking to include everyone who touches it (for traps) but have no clue. The code that isn't working is here. import "Scripts/Objects/Player/FPSWeapon.lua" Script.damage=10 function Script:Start() self.enabled=true end function Script:Collision(entity, position, normal, speed) if self.enabled then self.component:CallOutputs("Collision") end end function Script:Fire() local enemy = self:FindScriptedParent(Collision.entity,"Hurt") if enemy.script.health>0 then enemy.script:Hurt(self.damage,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) end I brought in collision code directly into it so it would know what it was looking for, and imported the script for fps weapon to get the damage system working. It is showing no errors but at the same time doesn't do anything. Any Ideas? I just want to get it working, so I can tweak it for each weapon and trap.
  6. Me and my team have been working with leadwerks for a little bit now, but have run into many issues with the programming, things are working and we don't know why or how, and things aren't working and we don't know why or how. We have been trying to do things ourselves and have also tried asking on the forums here, but feel as if we are just not skilled enough at programming. So we wanted to bring someone into the team who DOES know what they are doing. We have the full version on steam, so we can do c++ and lua scripts with no issues. Anyone here know where we can ask people about to join in? We don't have a lot of funding right now, but are setting up an indiegogo and would be more than willing to pay from that and from the profits...once the game is finished (for the profits that is, indiegogo funding will just be after we get the amount asked). Would that be a bad thing, and we should wait until after the indiegogo? I don't where to go, our last project everyone just kinda worked in their spare time...
  7. Alright cool, thank you again if I have any problems I will let you know! Once I get the "weak point" script tweaked and working better I will shoot it your way, never know when you might need it.
  8. The only languages I have programmed well in was c#, unrealscript, and actionscript 2. I am told that c++ is like c#, not sure what to believe there as they also said unreal script was like visual basic. If I do stick with lua, would you be able to suggest a site to help understand it better?
  9. Alright thank you ^.^ me and the other modeler are going to be retoping our monsters, most of the poly count is from the rounding of the body and face. I figured out how to make the melee weapon do damage, and goofing around with a bit of coding to figure it out, even found a way to randomize (between diffrent numbers) the damage to fit the rpg feel. I wrote a script that seems to be working that I will include in the complete package to be applied to specific bones to increase damage delt to the monsters if they are hit there, needs some tweaking and bug fixing but it kinda works . Would you suggest staying with lua or going more into the c++? I do have the full version is why I ask.
  10. I am very grateful, I was simply asking if the issue was the same for the weapon as the harpy, and about it causing my frame rate drop. I understand how it may sound, and I do thank you for being patient with me. I do wounder why the uv's didn't transfer from blender though. It may have something to do with sculptris perhaps, will have to look into it. I do thank you, and WILL accredit you for your help with everything you have done. I may ask a few question here and there from time to time, but only after I have looked at it more thoroughly. Again I am very grateful for your help. There are not many places for me to look about lua in comparison to leadwerks, other than here. If I have any more question, I will ask. Thank you
  11. http://www.mediafire.com/download/ipr281l5cqxoui1/gladiouse.fbx weapon file http://www.mediafire.com/download/k1fnvksheltgn3m/harpy.fbx monster Monster code import "Scripts/AnimationManager.lua" import "Scripts/Functions/GetEntityNeighbors.lua" --Public values Script.health=40--int "Health" Script.enabled=true--bool "Enabled" Script.target=nil--entity "Target" Script.sightradius=30--float "Sight Range" Script.senseradius=2--float "Hearing Range" Script.teamid=2--choice "Team" "Neutral,Good,Bad" --Private values Script.damage=5 Script.attackrange=1.5 Script.updatefrequency=500 Script.lastupdatetime=0 Script.prevtarget=nil Script.animation={} Script.animation.idle=1 Script.animation.run=2 Script.animation.attack={} Script.animation.attack[0]=4 Script.animation.attack[1]=2 Script.animation.death=3 Script.followingtarget=false Script.maxaccel=10 Script.speed=6 Script.lastupdatetargettime=0 Script.attackmode=0 Script.attackbegan=0 Script.sound={} Script.sound.alert = Sound:Load("Sound/Characters/mutant_injure_02.wav") Script.sound.attack={} Script.sound.attack[1] = Sound:Load("Sound/Characters/mutant_attack_04.wav") Script.sound.attack[2] = Sound:Load("Sound/Characters/mutant_attack_06.wav") function Script:Enable()--in if self.enabled==false then if self.health>0 then self.enabled=true if self.target~=nil then self:SetMode("roam") else self:SetMode("idle") end end end end function Script:ChooseTarget() local entities = GetEntityNeighbors(self.entity,self.sightradius,true) local k,entity for k,entity in pairs(entities) do if entity.script.teamid~=nil and entity.script.teamid~=0 and entity.script.teamid~=self.teamid then if entity.script.health>0 then local d = self.entity:GetDistance(entity) --if d<self.senseradius then -- return entity.script --else -- local p = Transform:Point(entity:GetPosition(),nil,self.entity) -- if (p.z>-math.abs(p.x) and p.z<-math.abs(p.y)) then local pickinfo=PickInfo() if self.entity.world:Pick(self.entity:GetPosition()+Vec3(0,1.6,0),entity:GetPosition()+Vec3(0,1.6,0),pickinfo,0,false,Collision.LineOfSight)==false then return entity.script end -- end --end end end end end function Script:DistanceToTarget() local pos = self.entity:GetPosition() local targetpos = self.target.entity:GetPosition() if math.abs(targetpos.y-pos.y)<1.5 then return pos:xz():DistanceToPoint(targetpos:xz()) else return 100000--if they are on different vertical levels, assume they can't be reached end end function Script:TargetInRange() local pos = self.entity:GetPosition() local targetpos = self.target.entity:GetPosition() if math.abs(targetpos.y-pos.y)<1.5 then if pos:xz():DistanceToPoint(targetpos:xz())<self.attackrange then return true end end return false end function WorldGetEntitiesInAABBDoCallback(entity,extra) if entity~=extra then if GetEntityNeighborsScriptedOnly==false or entity.script~=nil then table.insert(WorldGetEntitiesInAABBDoCallbackTable,entity) end end end function GetEntityNeighbors(entity,radius,scriptOnly) local result local aabb = AABB() local p = entity:GetPosition(true) local temp = GetEntityNeighborsScriptedOnly GetEntityNeighborsScriptedOnly=scriptOnly aabb.min = p - radius aabb.max = p + radius aabb:Update() local table = WorldGetEntitiesInAABBDoCallbackTable WorldGetEntitiesInAABBDoCallbackTable = {} entity.world:ForEachEntityInAABBDo(aabb,"WorldGetEntitiesInAABBDoCallback",entity) result = WorldGetEntitiesInAABBDoCallbackTable WorldGetEntitiesInAABBDoCallbackTable = table GetEntityNeighborsScriptedOnly = temp return result end function Script:Start() self.animationmanager = AnimationManager:Create(self.entity) if self.enabled then if self.target~=nil then self:SetMode("roam") else self:SetMode("idle") end end end function Script:Hurt(damage,distributorOfPain) if self.health>0 then if self.target==nil then self.target=distributorOfPain self:SetMode("attack") end self.health = self.health - damage if self.health<=0 then self.entity:SetMass(0) self.entity:SetCollisionType(0) self.entity:SetPhysicsMode(Entity.RigidBodyPhysics) self:SetMode("dying") end end end function Script:EndDeath() self:SetMode("dead") end function Script:DirectMoveToTarget() self.entity:Stop() local targetpos = self.target.entity:GetPosition() local pos = self.entity:GetPosition() local dir = Vec2(targetpos.z-pos.z,targetpos.x-pos.x):Normalize() local angle = -Math:ATan2(dir.y,-dir.x) self.entity:SetInput(angle,self.speed) end function Script:SetMode(mode) if mode~=self.mode then local prevmode=self.mode self.mode=mode if mode=="idle" then self.target=nil self.animationmanager:SetAnimationSequence(0,0.02) self.entity:Stop()--stop following anything elseif mode=="roam" then if self.target~=nil then self.animationmanager:SetAnimationSequence(1,0.04) self.entity:GoToPoint(self.target:GetPosition(true),5,5) else self:SetMode("idle") end elseif mode=="attack" then self:EndAttack() elseif mode=="chase" then if self.entity:Follow(self.target.entity,self.speed,self.maxaccel) then if prevmode~="chase" then self.entity:EmitSound(self.sound.alert) end self.followingtarget=true self.animationmanager:SetAnimationSequence(self.animation.run,0.05,300) if self:DistanceToTarget()<self.attackrange*2 then self.followingtarget=false self.entity:Stop() self:DirectMoveToTarget() end else self.target=nil self:SetMode("idle") return end elseif mode=="dying" then self.entity:Stop() self.animationmanager:SetAnimationSequence(self.animation.death,0.04,300,1,self,self.EndDeath) elseif mode=="dead" then self.entity:SetCollisionType(0) self.entity:SetMass(0) self.entity:SetShape(nil) self.entity:SetPhysicsMode(Entity.RigidBodyPhysics) self.enabled=false end end end function Script:EndAttack() if self.mode=="attack" then if self.target.health<=0 then self:SetMode("idle") return end local d = self:DistanceToTarget() if d>self.attackrange then --if d>self.attackrange*2 then self:SetMode("chase") return --else -- local pos = self.entity:GetPosition() -- local targetpos = self.target.entity:GetPosition() -- self.entity:SetInput(-Math:ATan2(targetpos.x-pos.x,targetpos.y-pos.y),self.speed) -- return --end end self.entity:Stop() self.attackmode = 1-self.attackmode--switch between right and left attack modes self.animationmanager:SetAnimationSequence(self.animation.attack[self.attackmode],0.04*math.random(1,1.25),300,1,self,self.EndAttack) self.attackbegan = Time:GetCurrent() if math.random()>0.75 then self.entity:EmitSound(self.sound.attack[self.attackmode+1]) end end end function Script:UpdatePhysics() if self.enabled==false then return end local t = Time:GetCurrent() self.entity:SetInput(self.entity:GetRotation().y,0) if self.mode=="idle" then if t-self.lastupdatetargettime>250 then self.lastupdatetargettime=t self.target = self:ChooseTarget() if self.target then self:SetMode("chase") end end elseif self.mode=="roam" then if self.entity:GetDistance(self.target)<1 then self:SetMode("idle") end elseif self.mode=="chase" then if self.target.health<=0 then self:SetMode("idle") return end if self:TargetInRange() then self:SetMode("attack") elseif self:DistanceToTarget()<self.attackrange*2 then self.followingtarget=false self.entity:Stop() self:DirectMoveToTarget() else if self.followingtarget==false then if self.entity:Follow(self.target.entity,self.speed,self.maxaccel) then self:SetMode("idle") end end end elseif self.mode=="attack" then if self.attackbegan~=nil then if t-self.attackbegan>300 then self.attackbegan=nil self.target:Hurt(self.damage) end end local pos = self.entity:GetPosition() local targetpos = self.target.entity:GetPosition() local dx=targetpos.x-pos.x local dz=targetpos.z-pos.z self.entity:AlignToVector(-dx,0,-dz) end end function Script:Draw() if self.enabled==false then return end self.animationmanager:Update() end weapon code import "Scripts/AnimationManager.lua" Script.offset=Vec3(0,0,0)--Vec3 "Offset" Script.clipsize=6--int "Clip size" Script.ammo=200--int "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.landoffset=0 Script.firetime=0 Script.bulletrange=1000 Script.bulletforce=500 Script.bulletdamage=10 Script.reloading=false Script.clipammo=Script.clipsize 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.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.reloadsoundfile=""--path "Reload sound" "Wav File (*wav):wav|Sound" function Script:Start() self.ammo = self.ammo - self.clipammo self.sound={} if self.sound.dryfiresoundfile~="" then self.sound.dryfire=Sound:Load(self.dryfiresoundfile) end self.sound.fire={} if self.sound.fire1soundfile~="" then self.sound.fire[0]=Sound:Load(self.fire1soundfile) end if self.sound.fire2soundfile~="" then self.sound.fire[1]=Sound:Load(self.fire2soundfile) end if self.sound.fire3soundfile~="" then self.sound.fire[2]=Sound:Load(self.fire3soundfile) end if self.reloadsoundfile~="" then self.sound.reload=Sound:Load(self.reloadsoundfile) end self.sound.ricochet={} self.sound.ricochet[0]=Sound:Load("Sound/Ricochet/bullet_impact_dirt_01.wav") self.sound.ricochet[1]=Sound:Load("Sound/Ricochet/bullet_impact_dirt_02.wav") self.sound.ricochet[2]=Sound:Load("Sound/Ricochet/bullet_impact_dirt_03.wav") self.entity:SetPickMode(0) self.muzzleflash = Model:Load("Models/Primitives/Plane.mdl") self.muzzleflash:SetCollisionType(0) local material = Material:Load("Materials/Effects/muzzleflash.mat") self.muzzleflash:SetMaterial(material) self.muzzleflash:SetScale(0.25) self.muzzlelight = PointLight:Create() self.muzzlelight:SetColor(1,0.75,0) self.muzzlelight:SetRange(4) self.muzzleflash:SetShadowMode(0) local tag = self.entity:FindChild("j_gun") self.muzzlelight:SetParent(tag) self.muzzlelight:SetPosition(0,0.2,0.5) 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/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() end function Script:Hide() self.entity:Hide() self.muzzleflash: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:EndReload() self.reloading=false local rounds = self.clipsize - self.clipammo rounds = math.min(self.ammo,rounds) self.ammo = self.ammo - rounds self.clipammo = self.clipammo + rounds end function Script:Reload() if self.clipammo<self.clipsize and self.ammo>0 and self.reloading~=true then self.reloading=true self.animationmanager:SetAnimationSequence(0,0.02,300,1,self,self.EndReload,25) self.reloadstarttime=Time:GetCurrent() if self.sound.reload~=nil then self.sound.reload:Play() end end end function Script:Fire() if self.reloading==false then if self.clipammo==0 then self.sound.dryfire:Play() else self.sound.fire[math.random(#self.sound.fire)]:Play() self.clipammo = self.clipammo - 1 self.firetime = Time:GetCurrent() self.muzzlelight:Point(self.player.camera,1) self.muzzlelight:Turn(0,math.random(0,360),0) self.muzzlelight:Show() self.animationmanager:SetAnimationSequence(2,0.08,300,1) local d = Transform:Normal(0,0,1,self.entity,nil) local p = self.player.camera:GetPosition(true) local pickinfo=PickInfo() if self.entity.world:Pick(p,p+d*self.bulletrange,pickinfo,0,true,Collision.Prop) then --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)]) 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 force = d * self.bulletforce * math.max(0,-pickinfo.normal:Dot(d)) --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 end end end 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 end if self.landoffset<0 then jumpbob = jumpbob + (Math:Sin(self.landoffset))*0.01 self.landoffset = self.landoffset + 10 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:LockMatrix() self.entity:SetPosition(sway*self.entity.scale.x,bob+jumpbob,0) self.entity:Translate(self.offset.x,self.offset.y,self.offset.z) self.animationmanager:Update() self.entity:UnlockMatrix() end function Script:Release() self.emitter[0]:Release() self.emitter[1]:Release() self.emitter=nil end those are what I have. Any idea what I am doing wrong? (side note should I reduce the polys on the monster?)
  12. I have been learning a bit of lua on my own, but the issues I am having here are from using the default scripts in the engine. I asked for a tutorial to understand what I am doing wrong, also asked to just be pointed in the right direction not for people to spell it out for me. I want to make it so everything in my project works, and once it all works setting up a basic tutorial for my things, or simply making a free package of them, with comments on what each code does so new people like me can understand it better and learn from it
  13. the issues with the ai is, that when I put the script on my own custom models, it doesnt fire off any of the commands set up in its code(the animations, attacking, moving nothing). The same with the melee weapons. I edited the codes for the animations to match up to mine (like changing the sequence numbers). But nothing. Not to mention, when I have the coding on my weapon and it exists in a scene it drops my fps to 10 from 70. without the code it doesnt effect it.
  14. Hello again, I hate bothering you guys with what seems to be bacis stuff. I need some help editing or writing my own code for ai and melee weapons. I have their animations all imported (both weapon and monsters) and have set up some basic scenes to test them. I took a look at the prefab monster code as well as the prefab fps weapon code. I thought simply changing the code with my own values and equipping them would work for now, but it doesn't. I dont even know where to begin. Is there a tutorial for a basic ai and melee weapon system? Lua or c++ would work for it. Any packages possibly for me to take a look at? I am sorry so very lost.
  15. well that worked very well thank you!! Now for the task of despawning them when you are away from them haha
  16. Alright, so I fixed the spawn cound issue, and found and issue with spawn count. fixed that issue and now am stuck with a error saying "attempting to index nill value" with my code "local item=self.item[math.random(1,3)]:Instance() " I have 3 items (added a bow to it) but something isnt clicking with it. do I need to refrence the script again in the function Script:start? Or make mention of the index in the update?
  17. i removed the comment lines (and fixed a few bugs it found) bu now there is the error "attempt to perform arithmetic on field 'lastSpawnTime' (a nil value)". Is there someting wrong with the script there? and is there something wrong after that as well?
  18. I changed my script to lua (as the random number thing is easier, but now I am more lost haha) I tried a bit of fusing around with my code, and it stopped giving me errors, but now nothing spawns still. Did I do something wrong? Script.SpawnRate = 1 --float Script.Spawncount = 1--int --[[ function Script:Start() self.item={} self.item[1]=self.Gladios self.item[1]=self.Spear self.counter = 0 end ]]-- --[[ function Script:UpdateWorld() end ]]-- --[[ function Script:UpdatePhysics() if self.counter >= Spawncount then return end local a = math.random(0,1) if Time:GetCurrent() > self.lastSpawnTime + (self.SpawnRate * 1000) then self.counter = self.counter + 1 self.lastSpawnTime = Time:GetCurrent() local Gladios = Prefab:Load("Map Assets/greate maze/weapons/gladios.pfb") local Spear = Prefab:Load("Map Assets/great maze/weapons/Spear.pfb") item:SetPosition(self.itemlocation+Vec3(0,1,0)) local item=self.item[math.random(1,3)]:Instance() end ]]--
  19. Sorry I am rather new like I said, but how do I define what number corrisponds with what item. Would I replace self.item.instance with self.gladios.instance?(gladios is one of the weapons). or local item=self.gladios(self.1):instance() ? along with that, if I do get it spawning, wouldnt the mass make it roll off my the shelf its ment to be on? I saw someone who wrote a code for spawning monsters in a set location, but they had to define the rotation as well, would that also be needed? Thank you again for responding, just trying to figure out things
  20. So I am rather new to c++ and lua programming. I understand the basics of what the code I want is, just not how to express them. I want to choose between a number of things to randomly spawn in specific locations (like have one location but every time you return it is a diffrent item). I have the prefabs set up in the engine, and I want to assosiate those prefabs in the code with a number, and have the random number generator (which I have and it works) pick a number and then after that number is picked, spawn the item. I understand that for each piece I would have to do an If() statment, but don't understand how to make it spawn on the axis I set up in the map. Also The code I tried (but deleted because of it making leadwerks crash when it activated) would choose the number, but not be able to read what the number was supposed to be assosiated with. Any help, even just points in the right direction, would be very appreciated. #include<iostream.h> #include<conio.h> #include<stdlib.h> void main() { //clear the screen. clrscr(); //declare variables as int. int high,low,random; //get the data. cout<<"Enter higher limit:"; cin>>high; cout<<"Enter lower limit:"; cin>>low; //generate random number random = (rand() % (high-low+1) + low); //print the numbers cout<<random<<endl; //get character getch(); } that is my random number generator code (that I use to choose the items( I use the code several diffrent time for diffrent items))
×
×
  • Create New...