View unanswered posts | View active topics It is currently Mon Sep 16, 2019 5:46 pm



Reply to topic  [ 12 posts ] 
 Is it possible to do this to an Actor? 
Author Message

Joined: Thu Jul 30, 2015 7:52 pm
Posts: 12
Location: Tacoland, México
Reply with quote
Post Is it possible to do this to an Actor?
So, as i said on my intoducction, i been getting into respriting and i asked myself this:

"Is it possible to make an actor that could spawn with a randomized body?, Also, is it possible with limbs, heads, etc...?"

For example:
There's 3 body sprites on a mod, and the actor within the mod, will spawn with one of the 3 bodies.
Or
How do Ronin's spawn with different heads, every single time?

I don't know how to explain my question well, but this is mod down below is an example of what i'm looking for, but with actors.

viewtopic.php?f=61&t=45902

PS: I'm sorry if this is in the wrong section, i am new here.


Thu Jul 30, 2015 11:05 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: Is it possible to do this to an Actor?
Bodies, heads, and helmets, yes; easily. Limbs? I'm not so confident about doing it with those.

The trick for the former set is that they only need a single frame, so you can make an image that has multiple frames with no animation speed and attach a script to the component so that it picks a random frame. This allows you to give a faction a little extra flavour for very little extra work. I use it for my C&C mods to give the fanatics and shadow agents randomized heads, like these guys;

Image

Alternately you can go a little more complex; I believe the Ronin use scripts on the head to spawn random helmets and scripts on the body to spawn random chestplates. It might be possible to do the same with limbs, but I'm not certain.


Fri Jul 31, 2015 12:25 pm
Profile YIM

Joined: Thu Jul 30, 2015 7:52 pm
Posts: 12
Location: Tacoland, México
Reply with quote
Post Re: Is it possible to do this to an Actor?
Arcalane wrote:
Bodies, heads, and helmets, yes; easily. Limbs? I'm not so confident about doing it with those.

The trick for the former set is that they only need a single frame, so you can make an image that has multiple frames with no animation speed and attach a script to the component so that it picks a random frame. This allows you to give a faction a little extra flavour for very little extra work. I use it for my C&C mods to give the fanatics and shadow agents randomized heads, like these guys;

Image

Alternately you can go a little more complex; I believe the Ronin use scripts on the head to spawn random helmets and scripts on the body to spawn random chestplates. It might be possible to do the same with limbs, but I'm not certain.


I see, yea i saw stuff like Head.lua on the ronins, but i don't know how to open or check those lua codes, or i don't know if it is possible.

Also, continuing my noobiness on randomized bodies.

So is like having, lets say, TorsoB000, TorsoB001, TorsoB002, and by the magic of lua, choose a random one for the actor?
And i think limbs would kinda work, except, the animations for the flexing would be all messed up and not fit with the actor at all, wouldn't they?
Or i am completely wrong and the randomized bodies could work without lua?


Fri Jul 31, 2015 4:39 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: Is it possible to do this to an Actor?
deeptron wrote:
I see, yea i saw stuff like Head.lua on the ronins, but i don't know how to open or check those lua codes, or i don't know if it is possible.


You can use something as simple as notepad - I personally use notepad++ whenever I'm doing script-tweaking.

deeptron wrote:
Also, continuing my noobiness on randomized bodies.

So is like having, lets say, TorsoB000, TorsoB001, TorsoB002, and by the magic of lua, choose a random one for the actor?
And i think limbs would kinda work, except, the animations for the flexing would be all messed up and not fit with the actor at all, wouldn't they?
Or i am completely wrong and the randomized bodies could work without lua?


Yep. You need to tell the object that it has however-many sprites/frames in the ini code, but other than that, don't set an animation type or speed. Then attach a script like so;

Code:
function Create(self)
   self.Frame = math.ceil(math.random(0,7))
end


This tells it to pick a random frame between TorsoB000 and TorsoB007. If you only have/want 3 frames, set it t0 random(0,2) instead. Note that the main AI scripts are attached to the torso part as well, so random torso sprites are a tiny bit more complex than just that chunk in the codebox there.

You're right about the limbs thing - that was my point, as you'd get this weird random mess for stretching/retracting. You'd probably need a script on the body that adds seperate arm entities or something.

As far as I know random parts need scripts. The basic stuff is trivial to do, though.


Sun Aug 02, 2015 9:21 pm
Profile YIM

Joined: Thu Jul 30, 2015 7:52 pm
Posts: 12
Location: Tacoland, México
Reply with quote
Post Re: Is it possible to do this to an Actor?
Arcalane wrote:
deeptron wrote:
I see, yea i saw stuff like Head.lua on the ronins, but i don't know how to open or check those lua codes, or i don't know if it is possible.


You can use something as simple as notepad - I personally use notepad++ whenever I'm doing script-tweaking.

deeptron wrote:
Also, continuing my noobiness on randomized bodies.

So is like having, lets say, TorsoB000, TorsoB001, TorsoB002, and by the magic of lua, choose a random one for the actor?
And i think limbs would kinda work, except, the animations for the flexing would be all messed up and not fit with the actor at all, wouldn't they?
Or i am completely wrong and the randomized bodies could work without lua?


Yep. You need to tell the object that it has however-many sprites/frames in the ini code, but other than that, don't set an animation type or speed. Then attach a script like so;

Code:
function Create(self)
   self.Frame = math.ceil(math.random(0,7))
end


This tells it to pick a random frame between TorsoB000 and TorsoB007. If you only have/want 3 frames, set it t0 random(0,2) instead. Note that the main AI scripts are attached to the torso part as well, so random torso sprites are a tiny bit more complex than just that chunk in the codebox there.

You're right about the limbs thing - that was my point, as you'd get this weird random mess for stretching/retracting. You'd probably need a script on the body that adds seperate arm entities or something.

As far as I know random parts need scripts. The basic stuff is trivial to do, though.


Ohh ok, thanks!
But i'll need to practice this with an actor, yes i was just asking about this and had yet to test it.
But wait, where do i put the ScriptPath on? i have the lua code, and now i know that i have to add it to the ini of an actor so it reads it.

Aside form that, now that were talking about lua, shouldn't this be in the Lua Scripting section?


Sun Aug 02, 2015 10:38 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: Is it possible to do this to an Actor?
I usually place the ScriptPath near the top, under or near the PresetName, and you'd attach it to whatever you want randomized.

For example;

Code:
AddDevice = HDFirearm
   PresetName = My Gun
   Description = Blahblahblah
   AddToGroup = Primary Weapons
   SpriteFile = ContentFile
      FilePath = Module.rte/Sprites/MyGun.bmp
   ScriptPath = Module.rte/Scripts/MyGunScript.lua
   etc...


This kind of script wouldn't really work with weapons, as they're animated by the engine - it just happened to be the handiest example I could think of.


Sun Aug 02, 2015 11:09 pm
Profile YIM

Joined: Thu Jul 30, 2015 7:52 pm
Posts: 12
Location: Tacoland, México
Reply with quote
Post Re: Is it possible to do this to an Actor?
Ok, i did everything you said, i made the lua, i placed the script under and on top of the PresetName, but it still won't read it.
I don't know if it is because i copied and pasted the ronin's head.lua and replaced the codes with the ones you gave me.

function Create(self)
self.Frame = math.ceil(math.random(0,7))
end

But it still won't recognise it, the game and the actor load just fine, but it the lua won't work, i tried it with heads instead of bodies, for now.


Mon Aug 03, 2015 1:04 am
Profile

Joined: Thu Jul 30, 2015 7:52 pm
Posts: 12
Location: Tacoland, México
Reply with quote
Post Re: Is it possible to do this to an Actor?
I hate to doble post but please help, it just won't let me, both scripts don't work for me.


Sat Aug 08, 2015 7:49 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: Is it possible to do this to an Actor?
I can't tell where it's going wrong from just your description. You'll probably need to upload your progress somewhere so someone can look at the actual code side of things. :???:


Sat Aug 08, 2015 8:25 pm
Profile YIM

Joined: Thu Jul 30, 2015 7:52 pm
Posts: 12
Location: Tacoland, México
Reply with quote
Post Re: Is it possible to do this to an Actor?
Oh ok, well here is the test i ran with some actor form some mod named Dermod.


Attachments:
Test.rte.zip [179.54 KiB]
Downloaded 127 times
Sun Aug 09, 2015 4:22 pm
Profile
User avatar

Joined: Sun Jan 28, 2007 10:32 pm
Posts: 1609
Location: UK
Reply with quote
Post Re: Is it possible to do this to an Actor?
Code:
AddEffect = Attachable
   PresetName = Engineer Head
   Mass = 36
   Sharpness = 1
   HitsMOs = 1
   GetsHitByMOs = 1
   ScriptPath = Test.rte/Sprites/Actors/Head.lua
   SpriteFile = ContentFile
      FilePath = Test.rte/Sprites/Actors/Head.bmp
   FrameCount = 1


Your issue has been staring you in the face the whole time; the FrameCount is 1. It should be 6. :roll:


Tue Aug 11, 2015 5:44 pm
Profile YIM

Joined: Thu Jul 30, 2015 7:52 pm
Posts: 12
Location: Tacoland, México
Reply with quote
Post Re: Is it possible to do this to an Actor?
Arcalane wrote:
Code:
AddEffect = Attachable
   PresetName = Engineer Head
   Mass = 36
   Sharpness = 1
   HitsMOs = 1
   GetsHitByMOs = 1
   ScriptPath = Test.rte/Sprites/Actors/Head.lua
   SpriteFile = ContentFile
      FilePath = Test.rte/Sprites/Actors/Head.bmp
   FrameCount = 1


Your issue has been staring you in the face the whole time; the FrameCount is 1. It should be 6. :roll:


Holy crap i never EVER saw that, i never knew that code even it existed! :lol:
Well, hey, isn't that how we learn stuff.
Anyways thanks for your help men!


Wed Aug 12, 2015 5:05 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ] 

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.024s | 17 Queries | GZIP : Off ]