-
Posts
556 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by havenphillip
-
Ok I'll try it. Thanks guys.
-
Ah ok. So this right here: function Script:UpdateWorld()... local enemy = self:FindScriptedParent(pickinfo.entity,"Hurt") Ok so now how do I actually get that? You're talking about modifying the gun script?
-
Oh yeah in the gun code. This one? 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
-
Ok sorry I'm lost already. The pick position? Pass the pick and the Hurt() into the Headshot Box script? Actually that part makes sense but where is the pickposition? Are the entity children a table somewhere that I can iterate them? How do I find the exact limb? It's not as simple as: Hurt()... if self.headshotBox then damage = 100 end I can see I should have thought this through longer.
-
-
I tried making a hitbox like from your video, but in your video it's just one box and I can't make a distinction in damage on the limbs. I presume there is something I'm missing or did wrong, but I couldn't get that to work. In the AI script I referenced it in the Start() as: self.headshotBox=self.entity:FindChild("Headshot Box") I made a pivot and attached it to the head limb and attached a script that created a box there: function Script:Start() self.head = self.entity:GetParent() material = Material:Load("HUD Elements/Materials/_original.mat") self.box = Model:Box(0.35,0.35,0.35) self.box:SetMaterial(material) self.box:SetPosition(self.head:GetPosition(true)) self.box:SetParent(self.head,true) self.box:Translate(1,0,0) end The box works like this and reduces health with damage but now I don't know how to reference it. I'm assuming I could do something like in the AI script under the Hurt() function add an "if" statement but what? "If target? == self.headshotBox then...?" Or should I add some kind of Hurt() function to the box itself?
-
What's the best way to approach headshots? I tried messing with the AI script in the Hurt() function. I tried making a script that created a box around the head. I tried making a pick...seems like the best way would be to add an "if" statement in the AI script Hurt(damage) function by declaring the head but how?
-
Ok so I added this line in the HUD AI under ChooseTarget(): if d < self.sightradius then ..so it looks like this: 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) 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 if d < self.sightradius then --added so they don't charge from any distance return entity.script end end end end end end Not sure why that's not in the original script. So to OP just what Macklebee suggested above, plus change this one line in your HUD AI script, save it as a prefab if you're spawning them, and also I have to change this line in the minimap script from a 1 to a 2 for the dots to appear: local AABB = self.miniMapSphere:GetAABB(1) ...so it looks like: local AABB = self.miniMapSphere:GetAABB(2)
-
Yeah that works. The sightrange is still off. I have to set it to -22 to walk up to the crawler. Should be at 0. Is there a way to compensate for that in the minimap script? Like add something to the table?
-
Are you using the minimap? Looks like it may be the minimap sphere. I deleted it and they worked normally.
-
How do you "loop over all entities in the world'? Talking about an AABB box?
-
lol! Same problem I had before. Needed to download this: Microsoft Visual C++ 2010 Redistributable Package (x86) Thanks.
-
I got a new computer and downloaded Leadwerks but it won't start for some reason. I click and a window pops up "Preparing to launch Leadwerks Game Engine" then it disappears and nothing. No .dll errors or anything. Just won't start. What the heck?
-
-
want to make a horizontal compass
havenphillip replied to havenphillip's topic in General Discussion
Oh awesome! That's exactly what I was looking for. I only need to do this and some PostRender() stuff but this is right. function NormalizeAngle(angle) if angle <= - 180 then return angle + 360 elseif angle >= 180 then return angle - 360 else return angle + 0 end end Here it is. Working perfectly: UI Elements.zip -
I want to make a horizontal compass that allows the player to navigate towards a goal. How can I set the rotation towards the goal to equal zero so that whenever the player is facing the objective it is set at the middle?
-
Oops. My mistake.
-
Does your camera have a script? I got this from Aggror's death trigger script. Maybe put this on your camara? You'd have to create a pivot and child the pivot where the camera will reset to the player too. Script.start = "" --entity "Start Point" function Script:Collision(entity, position, normal, speed) reset = self.start:GetPosition() self.entity:SetPosition(reset) end
-
OK I'm going to have to keep looking at this to see if I can understand what I can get away with and what I can't. There's a few examples floating around but this is new territory. I feel like I'm about to level up.
-
My idea is if I can create a single bounding box script and have different scripts call on it that way I can make multiple use of it, but how would I call the bounding box script in another script?
-
Ok so I can just call it like "self.menu"?
-
How do I interact with a script I've imported into another script from that second script?
-
Can you explain this again? You want the camera to shoot a beam or you want to shoot a beam at the camera? You want the camera to stop or the beam?
-
I still want to learn that FlowGUI though. I studied some of the sample maps but the scripts call scripts that call scripts. Where's the starting point if I want to understand it? I want to read it all and understand the step by step logic. Where do I start? What's the first script? I also don't understand how you don't use the format "function Script:Start()" for instance but do things like "function GetGuiElements(guiType)". Reminds me of Rick's State Machine Coroutine thing he posted which I also can't make sense of.
-
Ah ok sweet that worked: context:DrawText(string.format("%.0f",self.timer), self.cirPos.x-14, self.cirPos.y-14, 30, 30, Text.VCenter+Text.Center) Cool I'll leave it here for whoever wanders by: Circle Timer.lua (Currently set up to attach to pivot then child to player. Kills player at zero)