View unanswered posts | View active topics It is currently Sun Jan 05, 2025 4:48 am



Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
 Variable Heads 
Author Message
User avatar

Joined: Sun Jun 13, 2010 12:40 am
Posts: 327
Location: US of A
Reply with quote
Post 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.


Tue Jun 29, 2010 2:29 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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);


Tue Jun 29, 2010 3:49 am
Profile WWW
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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:
HeadChangingScript.zip [545 Bytes]
Downloaded 153 times



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.


Tue Jun 29, 2010 4:17 am
Profile WWW
User avatar

Joined: Wed Feb 24, 2010 11:00 pm
Posts: 255
Location: Unknow
Reply with quote
Post 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.


Tue Jun 29, 2010 3:28 pm
Profile
User avatar

Joined: Sat Nov 03, 2007 9:44 pm
Posts: 1916
Location: Flint Hills
Reply with quote
Post Re: Variable Heads
Wouldn't it also be possible to have random helmets, with pretty much exactly the same technique?


Tue Jun 29, 2010 3:31 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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.)


Tue Jun 29, 2010 3:41 pm
Profile WWW
User avatar

Joined: Wed Feb 24, 2010 11:00 pm
Posts: 255
Location: Unknow
Reply with quote
Post 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 :-o


Tue Jun 29, 2010 5:36 pm
Profile
User avatar

Joined: Sat Nov 03, 2007 9:44 pm
Posts: 1916
Location: Flint Hills
Reply with quote
Post 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.


Tue Jun 29, 2010 6:56 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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.)


Tue Jun 29, 2010 8:50 pm
Profile WWW
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post 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.


Wed Jun 30, 2010 6:47 am
Profile WWW
User avatar

Joined: Tue Mar 10, 2009 7:16 pm
Posts: 102
Reply with quote
Post 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.


Wed Jun 30, 2010 10:40 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Variable Heads
I don't really mind. It might not even work anyway. :P
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.


Wed Jun 30, 2010 5:23 pm
Profile WWW
User avatar

Joined: Tue Aug 14, 2007 8:40 pm
Posts: 259
Reply with quote
Post 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?


Wed Jun 30, 2010 6:52 pm
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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.


Wed Jun 30, 2010 7:05 pm
Profile WWW
User avatar

Joined: Wed Feb 24, 2010 11:00 pm
Posts: 255
Location: Unknow
Reply with quote
Post 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.


Wed Jun 30, 2010 7:26 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 21 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.042s | 14 Queries | GZIP : Off ]