Jump to content

Mordred

Members
  • Posts

    118
  • Joined

  • Last visited

Everything posted by Mordred

  1. hi, i tried WM myself (Free Edition) for now and i am thinking to geht it too. The Results are Quote cool and i believe its One of the easier and faster ways to generate quite Big Procedural maps. Right now im still struggling of i Should Buy it or not but the more i think about it the closer i get to "yes"
  2. I think the way YouGroove explained might be quite good for my idea's. I do not want to use that "Player" variable for mobile entities (like hostile mobs or os) but for interactive stationary objects. Say if i want to cut down a tree i want to have the tree automatically know that the result (for e.g. "you choped 10 logs") pass the values to the player without having to bother attaching the script to the whole forest at all. Hostile entities are another thing, here i have to say that i'm gonna use the way like in darkness awaits. That's how i actually managed to get my first script in the other topic up n running. Besides that i could use that script for all interactive stuff so it's just "checking for the player in the proximity" once i "use" the object (using function Script:use()). Anyways, i have to take a deeper look into those options. Thanks for showing the possibilitys to me
  3. Okay, thank you Rick, so it might occur "slow" in the first place, bit later on it might be simply better to attach the "player" script manually, because: the more often i use that the longer the iteration lasts since it has do to the same work several times. Did i understand it correct? I was hoping for a builtin function that wouldn't need to "check all entities" at all. Well, anyways, you did answer my question, thanks!
  4. Hey guys, since i had to do quite some work to get my script actually targeting the player i'm wondering if this is somehow easier achieved? For e.g. if i define a script variable like the player HP i can predefine it with the value "100", is that possible with "self.target" too? Oh: Before that happens... i do not want to drag the player into the affiliated fiel in the script entity, i want to do this code wise. And i do not really want to have to bother arround with the range between the script entity and the player. Just a simple, playing, "self.target = set.player()" or so would be cool
  5. It's basically the same i did earlier today. You have to set a "target" in your colission script, once you did that you can access functions within the target script using for e.g. self.target.script:<function>() Here's the code i did so far, it passes a damage value (named xDamage) from this code, to the "FPSPlayer" script (Atually: Its more to the "entity carrying the FPSPlayer script" than to the script itself) using its builtin "Hurt()" function. You just have to make sure that the "self.target" somehow point's to your Character, i did this using the "GetEntityNeighbors" function like done in the "EnemyAI" Script. -- give access to code in "GetEntityNeighbors.lua" import "Scripts/Functions/GetEntityNeighbors.lua" Script.target = nil --entity "Target" Script.damage = 0 -- float "Damage" Script.teamid = 2 --choice "Team" "Neutral,Good,Bad" function Script:Use() -- load entities within range (30) of self.entity into "entities", only load entities that have scripts attached local entities = GetEntityNeighbors(self.entity,30,true) local k,entity -- loop thrrough the result of "entities". k = key, entity = result for k,entity in pairs(entities) do -- only select entities with teamid == 1 ("good") if entity.script.teamid == 1 then -- and if the entity has at least 1 health remaining if entity.script.health>0 then local d = self.entity:GetDistance(entity) -- set self.target = resulting entity self.target = entity end end end -- prepare random function math.randomseed(os.time()) if self.target ~= nil then -- randomize the damage dealt a bit, setting the "min damage" value if self.damage > 0 then if self.damage > 5 then minDmg = self.damage - 4 else if self.damage > 2 and self.damage <= 5 then minDmg = self.damage - 2 else minDmg = self.damage end end -- actual code randomizing the damage. Damage is dealt between "minDmg" and "self.damage" (the value is set in the assets browser) xDamage = math.floor(Math:Random(minDmg, self.damage + 1)) -- fire function "Hurt" at self.target --> thus the player or entite that was found before. self.target.script:Hurt(xDamage, self.target) end end end My bad, didnt say that.... forgive me welcome to Leadwerks bansama
  6. actually, i know he bought it via steam and that a few days ago already. I do not believe that there's an automatic "import" process from steam to leadwerks, or am i wrong? How did other steamusers get access to the workshop? Now i'm curious
  7. here's the "streamlined" code with a few comments. Hopefully others may profit from it Again my thanks to YouGroove for trying to solve my issue, without his comment i wouldn't have tried to access "self.target.script:Hurt" -- give access to code in "GetEntityNeighbors.lua" import "Scripts/Functions/GetEntityNeighbors.lua" Script.target = nil --entity "Target" Script.damage = 0 -- float "Damage" Script.teamid = 2 --choice "Team" "Neutral,Good,Bad" function Script:Use() -- load entities within range (30) of self.entity into "entities", only load entities that have scripts attached local entities = GetEntityNeighbors(self.entity,30,true) local k,entity -- loop thrrough the result of "entities". k = key, entity = result for k,entity in pairs(entities) do -- only select entities with teamid == 1 ("good") if entity.script.teamid == 1 then -- and if the entity has at least 1 health remaining if entity.script.health>0 then local d = self.entity:GetDistance(entity) -- set self.target = resulting entity self.target = entity end end end -- prepare random function math.randomseed(os.time()) if self.target ~= nil then -- randomize the damage dealt a bit, setting the "min damage" value if self.damage > 0 then if self.damage > 5 then minDmg = self.damage - 4 else if self.damage > 2 and self.damage <= 5 then minDmg = self.damage - 2 else minDmg = self.damage end end -- actual code randomizing the damage. Damage is dealt between "minDmg" and "self.damage" (the value is set in the assets browser) xDamage = math.floor(Math:Random(minDmg, self.damage + 1)) -- fire function "Hurt" at self.target --> thus the player or entite that was found before. self.target.script:Hurt(xDamage, self.target) end end end
  8. But thanks for trying YouGroove [Edit] OMFG it's SO mega easy.... the problem was that i called "self.target:Hurt(xDamage)", but it actually has to be "self.target.script:Hurt(xDamage)". Didnt see the forest due to all those trees well. in case someone else might be interested, i gonna add a few comments to my code and will post it as it works right now in a few hours.
  9. Oh, no sorry, i explained it wrong. The Code you posted above goes error free, i even get the "self.target" to point to the players entity in memory (i did see that in debug mode) The error occurs on the last line of code: self.target:Hurt(xDamage) "attempt to call method 'Hurt' (a nil value)" But the variable xDamage is filled with a number (even if i replace it by "5" it's the same error) and if i add (xDamage, self.target) it's still the same error [Edit] Tried to make a function Script:Test() --> printing a message to console. I do get the same error, so the problem seems to be the value in self.target .... do i have to convert the memory adress i do get to smth. else maybe?
  10. function script Hurt(damage, DistributorOfPain) --> that's actual in the basic "FPSPlayer.lua" script without changing it. I already thought, that the "nil" error might come due to the fact i only fill "damage" in the "Hurt()" function above, but i even tried to set the "DistributorOfPain" to self.target (since i lack another target i could use....) but that doesnt work either. Besides that, the value in "DistributorOfPain" is not used in the FPSPlayer script at all. function Script:Hurt(damage,distributorOfPain) if self.health>0 then self.sound.damage[math.random(#self.sound.damage)]:Play() self.health = self.health - damage dmgReceived = damage self.hurtoffset = Vec3(math.random(-1,1),math.random(-1,1),0):Normalize()*30 local blood = {} local n=1 blood.texture=self.image.blood[math.random(1,4)] blood.intensity=1 table.insert(self.bloodoverlay,blood) if self.bloodindex>4 then self.bloodindex=1 end if self.health<=0 then self:Kill() end end end [Edit] Besides, it did work before when i set the Target via drag n drop into the script by hand that way. It's only not working since i tried to get the target automagically.
  11. Hello fellow Leadwerkers, i have a little problem. I'm trying stuff and i have reached a place where i cannot continue further without help. Basically i want to do the following: Create a box, that box has a script attached named "Damage" that's being run on "Use", so if i press "E" it's fired up, the "Damage" script shall target the player and do random damage. I got it all running if i add the target via "Script.target = nil --entity "Target" followed by dragging the "Player" onto that field in the assets tab. But now i'm lazy, i want to use that scrip on several places and i do not want to add the target "Player" every time by hand. So my idea was to look into the "MonsterAI.lua" script how that is solved. I ended up with smth like this: import "Scripts/Functions/GetEntityNeighbors.lua" Script.target = nil --entity "Target" Script.damage = 0 -- float "Damage" Script.teamid = 2 --choice "Team" "Neutral,Good,Bad" function Script:Use() local entities = GetEntityNeighbors(self.entity,30,true) local k,entity for k,entity in pairs(entities) do if entity.script.teamid == 1 then if entity.script.health>0 then local d = self.entity:GetDistance(entity) local pickinfo=PickInfo() self.target = entity end end end math.randomseed(os.time()) System:Print("I'm in the tree use function") if self.target ~= nil then if self.damage > 0 then if self.damage > 5 then minDmg = self.damage - 4 else if self.damage > 2 and self.damage <= 5 then minDmg = self.damage - 2 else minDmg = self.damage end end xDamage = math.floor(Math:Random(minDmg, self.damage + 1)) self.target:Hurt(xDamage) end end end My idea was to set the TeamID for that script to "bad" == 2 (whilst the player is "good" == 1), so it will only run if it has contact with the player. The Problem is, i have no idea how to get the result of "return entity.script" as a valid target to use it in the 2nd half of the script (following the lines after "self.target = entity.script"). I'm basically quite sure that i didn't understand how it works at all, so any help, especially if someone could explain my error, would be appreciated. Thanks in advance! [Edit] Did some slight changes to the original code, so now the "self.target" points to the correct entity, but still i get a "called nil" when trying to access "self.target:Hurt(xDamage)". Even though i was able to see in debugmode that the adress stored in "self.target" is actually the player (and thus the target i want).
  12. 1st Question: When it's dono 2nd Question: Indie = only LUA, full (it's more "extended" since the Indieedition is a fullversion too) has C++ & LUA support 3rd Question: that's not 100% sure by now, but Josh is looking into it if / how it works.
  13. Hehe thanks for your response Christian, but you're sadly too late. I already found the problem and was able to fix it. The Shader has to be of type "sprite" instead of the default "diffuse".
  14. If i might respond to your suggestion, Christian . That might work with this quite easy shape (btw. it's not pure plane walls, but i see that suggestion might work). The problem comes with other, larger, models with more tris. For e.g. i own a few premade houses that have several layers, or dungeon tunnels that are more smooth / round than simple boxes. And tbh it's a lot of work to make those invisble boxes for all your models. You're doing the models in a diff. program to make live easier in the first place, not to place them and to have build invisble layouts all arround (if i would do that, i could build the model in Leadwerks in the first place). Anyways, as mentioned Josh is already into it
  15. Thanks Rick! I didn't come to that idea, it seems to work now, even though it's a bit "wastefull" to have to do this
  16. Yea, i already deleted that file, but the problem is, i have like 8 or 10 textures, who all get the same name, so i can't use like 8 to 10 models, since the materials they use always change, depending what texture i create. Maybe it's important to know, that those texture files are in .dds format? Does it change anything? Can it be an error in the creation process of those files?
  17. Hello fellow Leadwerkers, i'm writing, because i again have some trouble. I have several textures, called "Plant_a", "Plant_b", "Plant_c" and so on. They do fit on models named the same way. The problem is, if i start converting some of those textures (strangely not all) to a material the Engine keeps telling me "File Plant.mat already exists, do you wish to overwrite it?". Even though, when i delete that file, the engine does create a new one, but the name in the assets tab is smth. different (Instead of callint it Plant_a it's maybe Plant_x since i renamed the file once to Plant_x to get over that issue --> didnt work). Does anyone had the same issue and might know a solution for this? In short: Texturefile named "Plant_a" shall be converted to a material Message "File Plant.mat already exists, do you want to overwrite?" Hitting yes --> exery model that had the old "Plant.mat" texture is changed to the new one (and thus it's not fitting anymore).
  18. That was kinda problem in the first place but na, it's a bug Josh confirmed in the steamboards. The polymesh you create after resizing the model is'nt resized, thus its usually either to large or to small to fit to the resulting model
  19. Okay guys, i just read in the steamboards that Josh was told about that issue, it's a bug, he found it, and he fixed it. An update should be released "soon" but he want's to fix some other bugs before releasing it too. so topic might be closed
  20. Okay, we managed to find out the following: We have to resize the model after importing it into Leadwerks, because it's just to big as it is. By doing so we have to make a new polymesh to attach to the model to prevent players from falling though the floor (or move through walls). The problem ist: the polymesh we create after (!) resizing the model (and even when saving it under a new name) is still the original size it was in the first place. So if we resize the model to, say, 10%, the mesh is still at size 100% and thus it does not fit onto the model. Anyone knows a workaround for that issue that a newbie might use?
  21. i just've started to work with that engine too, but maybe i can help (and even learn myself) if you can give me the model? 'cause now i'm curios myself.
  22. May you're interested in knowing what "shape size" does. Imagine an invisible (box in this case) of size 100 by 100 by 100. The engine is gonna place that invisible box and the result should be that you cannot enter that box.
  23. Oh, well, go to your assets tab, rightclick your model (the one you imported) and select "generate shape", select the option "Convex hull". After that file is saved, attach it in the physics tab to the model after selecting your model in the viewport (or scene list). It's in the physics tab the 2nd option "Shape file". After you did that, just try it again. P.S. might be of type "Prop" instead of "scene", but i'm not 100% sure her
  24. Ähm, sorry to ask ScrotieFlapWack, but what is the problem?
  25. Hehe yea, it might work, but i have no clue how to set it up right now, so i do make some "baby steps" to reach my goals before i make smth. more complicated. But thanks for the link Guppy!
×
×
  • Create New...