Data Realms Fan Forums http://45.55.195.193/ |
|
Anyone still around to help with LUA scripting for scenes? http://45.55.195.193/viewtopic.php?f=8&t=46113 |
Page 1 of 1 |
Author: | Pantera1993 [ Sat Dec 24, 2016 3:48 pm ] | |||
Post subject: | Anyone still around to help with LUA scripting for scenes? | |||
Forums seem pretty dead, hopefully someone is around to help out? TBH my knowledge of LUA is abysmal. If any experienced modders could help me out I would appreciate it very much. EDIT: Re-wrote the activites from scratch, mission starts without errors. No funds, have to add them yourself at this point. Destroying enemy brain doesn't cause win, I believe i removed this section of code... Tried to make it work somehow, check out CPUbrainCheck funtion. Entering trigger areas doesn't cause dropships to spawn, probably something to do with spawn timer so at this point not sure if LZs or loadouts work properly. Doors commented out, not sure if properly implemented. A few questions: How to use lua to add doors to scene. I took a look at the Zombie Cave mission code and came up with this but I'm getting errors. Code: self.KeyDoor1 = CreateTerrainObject("Door Cliff"); self.KeyDoor1.Pos = Vector(2976, 900); self.KeyDoor1.Team = self.EnemyTeam; self.KeyDoor1:EnableEmission(false); -- probably don't need this right? MovableMan:AddParticle(self.KeyDoor1); --Errors here How can I set the doors to change team to player team when player picks up the control chip? I have no code for this, absolutley no clue what to do here. I'm also getting some formatting errors (expecting then here, expecting eof here etc...) EDIT: Ship spawn code, not sure if this works properly... Code: function CliffBaseAssault:PhaseOne() -- Loop through all actors to find an actor from our team. Be cautious with this loop and use it wiseley as it -- may add signifiant lag if used many times especially when you have many actors. for actor in MovableMan.Actors do -- Check if an actor is from our team if actor.Team == self.PlayerTeam then -- Check if an actor from our team is inside an area, if it is spawn ship if self.caveArea:IsInside(actor.Pos) then local ship = RandomACDropship("Any", self.CPUTechName); local actor = nil; local weapon = nil; for i = 0, 1 do if math.random() >= self:GetCrabToHumanSpawnRatio(PresetMan:GetModuleID(Self.CPUTechName)) then actor = CreateAHuman("Any", self.CPUTechName); else actor = RandomACrab("Any", self.CPUTechName); end if IsAHuman(actor) then actor:AddInventoryItem(RandomHDFirearm("Primary Weapons", self.CPUTechName)); actor:AddInventoryItem(RandomHDFirearm("Secondary Weapons", self.CPUTechName)); if PosRand() < 0.5 then actor:AddInventoryItem(RandomHDFirearm("Diggers", self.CPUTechName)); end end actor.AIMode = Actor.AIMODE_BRAINHUNT; actor.Team = self.CPUTeam; ship:AddInventoryItem(actor); end ship.Pos = Vector(self.DummyLZ:GetRandomPoint().X,0); ship.Team = self.CPUTeam; ship:SetControllerMode(Controller.CIM_AI, -1); MovableMan:AddActor(ship); self:AdvanceToTwo(); end end end end CPUBrainCheck Function - I know this is wrong but it's all I got. Code: function CliffBaseAssault:DoCPUBrainCheck() if MovableMan:IsActor(self.CPUBrain) then self:AddObjectivePoint("Destroy!", self.CPUBrain.AboveHUDPos+Vector(0,-16), Activity.TEAM_1, GameActivity.ARROWDOWN) else self.WinnerTeam = Activity.TEAM_1 ActivityMan:EndActivity() end end I'll upload RTE with all lua and inis included so if anyone wants to take a look feel free! EDIT: Updated RTE uploaded.
|
Author: | Bad Boy [ Sun Dec 25, 2016 12:30 am ] |
Post subject: | Re: Anyone still around to help with LUA scripting for scenes? |
Been quite a while since I've done any of this but let's see what help I can give. I believe doors themselves are actors, so if you just want to add the door without the frame you'd use CreateActor("door name", "door rte") and MovableMan:AddActor(doorActor). If you want the frame and stuff then adding the whole thing as a scene object should be the way to do it, and in that case you don't need to use MovableMan for it since it'll automatically be added to the Movable Object manager. As for changing door's teams, once you have the door actor set as a variable you can just do door.Team = Team_Number_Here. Selecting the door is a different question though - if you add the door actor through scripts then you can save it in a variable when you add it. Otherwise you'll have to do something along the lines of: Code: for a in MovableMan.Actors do if (a.ClassName == "ADoor") then a.Team = Team_Number_Here; end end The latter is probably the only way to do it if you're adding the whole door as a scene object. I haven't downloaded your rte to look at exactly what your issue is but at a glance I see that you have Self instead of self at the line that calls GetCrabToHumanSpawnRatio. Case matters so you have to be careful there. In that regard console errors are probably your friend. I don't quite recall your previous question about spawn areas, but yes, you can have as many spawn areas for a team as you want - area names are entirely up to you - as long as your code handles them. You can also, of course, just use a lot of boxes instead of multiple areas, whatever is more useful in the situation. Your brain checking stuff looks okay I think, as long as self.CPUBrain is actually defined somewhere else and DoCPUBrainCheck() is actually being called somewhere. But since you've got an issue in your spawning function that's probably breaking everything else from working. But yeah, keep at it, making missions is a ton of fun, though it's got a bit of a learning curve. If you haven't already I'd suggest looking at weegee's scene making tutorials; they're how I learned lua and how to make scenes and they'll have a lot of useful stuff for ya. You can find them here: viewtopic.php?f=8&t=16219 Let me know if this stuff helps and, if it doesn't, if you'd like me to download the rte and poke through it properly sometime when I get the chance or if you'd rather try to figure this out with hints. Good luck! |
Author: | Pantera1993 [ Mon Dec 26, 2016 6:11 am ] |
Post subject: | Re: Anyone still around to help with LUA scripting for scenes? |
Thanks for the help, I've been making progress and just figure out the doors |
Author: | Bad Boy [ Mon Dec 26, 2016 7:57 pm ] |
Post subject: | Re: Anyone still around to help with LUA scripting for scenes? |
No problem, happy to help. Good luck |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |