Data Realms Fan Forums http://forums.datarealms.com/ |
|
Wait how can you turn an actor into a material http://forums.datarealms.com/viewtopic.php?f=73&t=16889 |
Page 1 of 2 |
Author: | dragonxp [ Mon Oct 19, 2009 2:52 am ] |
Post subject: | Wait how can you turn an actor into a material |
So as the thread title says i need this for my gold transmuter, might as well learn now :/ So if any1 can tell me if this is possible? As far as i know it involves collision with the particle then this = actor and turn into material which = gold? HELP!!! ![]() My Lua Scripting Level, only mounting turrets on Dropships. |
Author: | zalo [ Mon Oct 19, 2009 2:55 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
You can't, unless you want to move the actor underground, gib it, and release a puddle of gold where it was standing. |
Author: | Rawtoast [ Mon Oct 19, 2009 3:07 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
You don't need Lua for this. Just make copies of your torso, head, and arm sprites which appear gold in color. Make these your gibs. Put them right over the arms, legs, head, and torso of your alive actor in the gib editor. Then, in your gib ini, change the material of these gibs from flesh to gold. Bingo. Edit: Oops, didn't realize you meant for an actor to turn into a material when you shoot it with something. |
Author: | Duh102 [ Mon Oct 19, 2009 3:09 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
He wants to transmute actors into gold. What might be a better solution, Mr. dragon, would be to read the gold value of the actor in question and spawn a proportionate amount of gold bricks at the place the actor was. |
Author: | dragonxp [ Mon Oct 19, 2009 3:26 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
so could you like have any lua script kill the actor then like place total proportionate amount of gold there? |
Author: | Duh102 [ Mon Oct 19, 2009 3:57 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
Pick a target with one of the proximity scripts, call actor:GibThis() (where actor is a reference to the closest actor), and do the following pseudocode. numOfBricks = actor.GoldCost / 10 (summon numOfBricks bricks) at actor.Location() * math.random() * 32. |
Author: | CrazyMLC [ Mon Oct 19, 2009 8:36 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
If you set any MOSR's material to gold once it settles you can collect it. The code for what you are talking about though would be: Code: function Update(self) for actor in MovableMan.Actors do local avgx = actor.Pos.X - self.Pos.X; local avgy = actor.Pos.Y - self.Pos.Y; local dist = math.sqrt(avgx ^ 2 + avgy ^ 2); if dist < 200 and actor.Team ~= self.Team then numbricks = math.floor(actor.GoldValue / 10); local particle = CreateMOSRotating("Gold Brick 10oz"); -- I think this is it's name. particle.Pos = actor.Pos; particle.Vel = actor.Vel; for i = 1,numbricks do MovableMan:AddParticle(particle); end actor:GibThis(); end end end |
Author: | findude [ Mon Oct 19, 2009 5:30 pm ] |
Post subject: | Re: Wait how can you turn an actor into a material |
Code: actor.Health = -1; actor.ToSettle = true; Dunno about the gold part, I think theres no way you can hack the material to different one. |
Author: | dragonxp [ Tue Oct 20, 2009 12:56 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
CrazyMLC wrote: If you set any MOSR's material to gold once it settles you can collect it. The code for what you are talking about though would be: Code: function Update(self) for actor in MovableMan.Actors do local avgx = actor.Pos.X - self.Pos.X; local avgy = actor.Pos.Y - self.Pos.Y; local dist = math.sqrt(avgx ^ 2 + avgy ^ 2); if dist < 200 and actor.Team ~= self.Team then numbricks = math.floor(actor.GoldValue / 10); local particle = CreateMOSRotating("Gold Brick 10oz"); -- I think this is it's name. particle.Pos = actor.Pos; particle.Vel = actor.Vel; for i = 1,numbricks do MovableMan:AddParticle(particle); end actor:GibThis(); end end end Ty ill try now, thnx for helping. |
Author: | CrazyMLC [ Tue Oct 20, 2009 1:59 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
Well, that isn't exactly working code. There are still optimizations and I'm not sure about what the presetname of the gold brick is. |
Author: | Duh102 [ Tue Oct 20, 2009 2:08 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
It's a MOSParticle. "10 oz Gold Brick" |
Author: | dragonxp [ Tue Oct 20, 2009 2:11 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
well could you tell me what to add, ill fix the mosparticle 10 |
Author: | CrazyMLC [ Tue Oct 20, 2009 2:35 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
Code: function Update(self) for actor in MovableMan.Actors do local dist = SceneMan:ShortestDistance(actor.Pos,self.Pos,true).Magnitude; if dist < 20 and actor.Team ~= self.Team then if actor.GoldValue ~= 0 then numofbricks = math.floor(actor.GoldValue / 10); else numofbricks = 0; end local particle = CreateMOSParticle("10 oz Gold Brick"); particle.Pos = actor.Pos; particle.Vel = actor.Vel; for i = 1,numofbricks do MovableMan:AddParticle(particle); end actor:GibThis(); end end end This should work. |
Author: | dragonxp [ Tue Oct 20, 2009 2:50 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
ok so i attach to gun after preset game using ScriptPath = right? |
Author: | CrazyMLC [ Tue Oct 20, 2009 3:23 am ] |
Post subject: | Re: Wait how can you turn an actor into a material |
Yes, but: Recopy the code, I had a typo. Apply it to the bullet the gun shoots, not the gun. |
Page 1 of 2 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |