Data Realms Fan Forums http://45.55.195.193/ |
|
Variable Heads http://45.55.195.193/viewtopic.php?f=1&t=19132 |
Page 1 of 2 |
Author: | Jomn [ Tue Jun 29, 2010 2:29 am ] |
Post subject: | Variable Heads |
How would you make it so that different heads would appear on an actor? Like Crobotech except that it just switches it randomly. |
Author: | Geti [ Tue Jun 29, 2010 3:49 am ] |
Post subject: | Re: Variable Heads |
Go look at Zombies'09. tl;cbflac: basically you give the head lots of frames and use the attachable handler to grab them head as an Attachable then do head.Frame = math.random(head.FrameCount); |
Author: | CrazyMLC [ Tue Jun 29, 2010 4:17 am ] |
Post subject: | Re: Variable Heads |
My Code This should pick a random frame of your head and make it so that the head stays on that frame for the rest of eternity. Or until it dies. Just edit the first two functions with your info and attach the script to your actor. You'll also need to give your head multiple frames with varying head images for this to do anything. In case you need it, this is the code to apply a script to an actor: Code: ScriptPath = The_Name_Of_Your_Mod.rte/Whatever_Folder_The_Script_Is_In/HeadChangingScript.lua Put that anywhere in your actor's ini file code. Here's the code in a zip. Attachment: I can't wait to see your mod! Credit to Geti for more than half of the code. Credit to Mail2345 for figuring out how to run scripts on attachables. EDIT: For anyone wondering, you can put in the PresetName and FrameCount of anything you want and it'll still work... just as long as it's attached to whatever the script is on. |
Author: | CCnewplayer [ Tue Jun 29, 2010 3:28 pm ] |
Post subject: | Re: Variable Heads |
Geti it's right but Geti's way it's using lua to the actor come with a female body with a female head or the same with male sprites , you can use ini , but you can make only male or female. |
Author: | Azukki [ Tue Jun 29, 2010 3:31 pm ] |
Post subject: | Re: Variable Heads |
Wouldn't it also be possible to have random helmets, with pretty much exactly the same technique? |
Author: | CrazyMLC [ Tue Jun 29, 2010 3:41 pm ] |
Post subject: | Re: Variable Heads |
Basically, my script was exactly what Geti said to do except with some attempts at being user friendly. You can use this technique on anything. Even helmets. I'll provide and example on how later. This is the same code as before but applied to the object the script is on: Code: function Create(self) self.BodyFrameCount = 1 --ENTER YOUR FRAMECOUNT HERE ------------------------------------------------------------- self.BodyFrame = math.random(0,self.BodyFrame-1) end function Update(self) self.Frame = self.BodyFrame end (This is the technique I'm using for a variety of my mods that I'm working on.) |
Author: | CCnewplayer [ Tue Jun 29, 2010 5:36 pm ] |
Post subject: | Re: Variable Heads |
Azukki wrote: Wouldn't it also be possible to have random helmets, with pretty much exactly the same technique? Yes , we can make fully random actors |
Author: | Azukki [ Tue Jun 29, 2010 6:56 pm ] |
Post subject: | Re: Variable Heads |
Pretty sure arms and legs are hardcoded to cycle through all of their frames accordingly with the extension of the limb. So it likely won't work with that. I remember hearing that the Ronin were supposed to be randomized eventually though, so hopefully that will be incorporated in a way where modders can also make full body randomization. |
Author: | CrazyMLC [ Tue Jun 29, 2010 8:50 pm ] |
Post subject: | Re: Variable Heads |
Actually, you can. Well, I think you can. I still have to test it. Code: function Create(self) --assume we already have a pointer to the arm and that it is "arm" self.NumberOfArmSets = 2 self.ArmFrameBoost = arm.FrameCount / self.NumberOfArmSets self.ArmRandom = math.random(0,self.NumberOfArmSets-1) end function Update() if self.ArmRandom * self.ArmFrameBoost > arm.Frame then arm.Frame = arm.Frame + self.ArmFrameBoost elseif (self.ArmRandom+1) * self.ArmFrameBoost <= arm.Frame then arm.Frame = arm.Frame - self.ArmFrameBoost end end (Yes, I've spent a lot of time thinking about this sort of stuff.) |
Author: | Geti [ Wed Jun 30, 2010 6:47 am ] |
Post subject: | Re: Variable Heads |
Nah, you can't, because the loop is set to be n fames long where n is the total number of frames. |
Author: | neroe23 [ Wed Jun 30, 2010 10:40 am ] |
Post subject: | Re: Variable Heads |
I asked for that a while ago, but Joe didn't post his code. So I'll take yours if you agree. Anyway thanks. |
Author: | CrazyMLC [ Wed Jun 30, 2010 5:23 pm ] |
Post subject: | Re: Variable Heads |
I don't really mind. It might not even work anyway. If it does work, and you use it in a mod... well, if you credit me (along with Geti and Mail2345) I'd be happy, but again, it doesn't really matter. |
Author: | Raven [ Wed Jun 30, 2010 6:52 pm ] |
Post subject: | Re: Variable Heads |
Azukki wrote: Pretty sure arms and legs are hardcoded to cycle through all of their frames accordingly with the extension of the limb. So it likely won't work with that. I remember hearing that the Ronin were supposed to be randomized eventually though, so hopefully that will be incorporated in a way where modders can also make full body randomization. When that happens, we could have a Random faction, with one actor. And it would randomize every part of the actor. Would it be possible to randomize guns? |
Author: | CrazyMLC [ Wed Jun 30, 2010 7:05 pm ] |
Post subject: | Re: Variable Heads |
I'm not sure how to do that. Just giving the actor a random gun might be easier than changing the gun to a random frame. |
Author: | CCnewplayer [ Wed Jun 30, 2010 7:26 pm ] |
Post subject: | Re: Variable Heads |
Sakiskid wrote: When that happens, we could have a Random faction, with one actor. And it would randomize every part of the actor. Would it be possible to randomize guns? No , if you add many frames to one gun , it will change the frames when you fire. |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |