Data Realms Fan Forums http://45.55.195.193/ |
|
Transforming a certain actor via a TDExplosive http://45.55.195.193/viewtopic.php?f=1&t=30452 |
Page 1 of 1 |
Author: | Hunter0 [ Wed Feb 22, 2012 10:49 pm ] |
Post subject: | Transforming a certain actor via a TDExplosive |
Basically, I want to make a TDExplosive that transforms the nearest actor in a small radius to its impact point, as long as it is a certain type (Soldier Light for example), into another one (Soldier Heavy for example). Any help at all would be appreciated especially as I have been trying to figure it out for the last 2-3 hours. Also, sorry if this doesn't make any sense. |
Author: | DudeAbides [ Thu Feb 23, 2012 12:23 am ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
I think maybe this will work This code should activate when the item destroys itself, and checks for 1) actors 2) distance and 3) Soldier name, replicating it's position, velocity, rotation angle, angular velocity, and team. I forget if you're supposed to use the 'ToActor' thing but maybe someone else here can clear it up. |
Author: | CaveCricket48 [ Thu Feb 23, 2012 2:34 am ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
Change Code: function destroy (self) to Code: function Destroy(self) and it should work as intended. However, inventory is still an issue. |
Author: | Hunter0 [ Thu Feb 23, 2012 8:25 am ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
Inventory won't be an issue because ACrabs can't pick up stuff. Thank you! |
Author: | Hunter0 [ Thu Feb 23, 2012 9:14 am ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
Wait a second, this doesn't work for me. The only effect it has on the actor is that he turns around and looks at me.... |
Author: | lucariokiller [ Thu Feb 23, 2012 10:20 am ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
Quote: Inventory won't be an issue because ACrabs can't pick up stuff. Thank you! XD |
Author: | Bad Boy [ Thu Feb 23, 2012 10:46 am ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
Make sure you throw the bomb close enough. That script only affects actors that are within 50 pixels of the bomb upon its detonation. If you want to increase that limit, change the the 50 in the line "if SceneMan:ShortestDistance(self.Pos,actor.Pos,true).Magnitude < 50 then" to whatever distance you want. And yeah, if the actor is outside of the max range he'll just be alerted or whatever by the bomb's detonation and will turn towards it. |
Author: | Hunter0 [ Thu Feb 23, 2012 7:14 pm ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
Nope, the distance isn't the issue: I have another weapon that deals damage to anyone in a 40 pixel radius and that works fine on the same ACrab. It must be something else |
Author: | CaveCricket48 [ Thu Feb 23, 2012 9:20 pm ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
If you modified the script in any way, post it here. |
Author: | Bad Boy [ Thu Feb 23, 2012 9:43 pm ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
The script was borked, here's a fixed version. Code: function Destroy(self) for actor in MovableMan.Actors do if SceneMan:ShortestDistance(self.Pos,actor.Pos,true).Magnitude < 50 then if actor.PresetName == "Soldier Light" then local hevact = CreateAHuman("Soldier Heavy" , "Coalition.rte"); hevact.Pos = actor.Pos; hevact.RotAngle = actor.RotAngle hevact.AngularVel = actor.AngularVel hevact.Vel = actor.Vel hevact.Team = actor.Team hevact.Health = actor.Health MovableMan:AddActor(hevact); hevact:FlashWhite(500); actor.ToDelete = true; end end end end He got the preset names wrong and forgot an = sign. Also keep in mind that this script has a few problems. It takes all nearby actors instead of just the closest (not sure how you want it to work) and if you have multiple explosives detonating at the same time you'll get more actors (i.e. 2 of them at the same time will give 4 actors, etc.). Though to be fair the latter probably only happens if they detonate at the exact same time as they did when I used a keypress to test them. |
Author: | Hunter0 [ Thu Feb 23, 2012 10:19 pm ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
It still won't work for some reason. Is it just me? |
Author: | CaveCricket48 [ Thu Feb 23, 2012 10:47 pm ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
You ARE shooting at a "Soldier Light," right. Just asking. |
Author: | Bad Boy [ Thu Feb 23, 2012 11:04 pm ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
It works perfectly for me and I tested it pretty extensively so there's no reason it shouldn't work for you if you copy-pasted my script. That said, you should check and see if you're getting any console errors (if you don't know you open the console with ~ or /). For what it's worth I made a copy of ronin's stone and attached the script to it and I gibbed it with a keypress in the update function. But none of that should matter at all. Maybe you should post up your explosive so someone can take a look. |
Author: | Hunter0 [ Fri Feb 24, 2012 9:17 am ] |
Post subject: | Re: Transforming a certain actor via a TDExplosive |
That's strange, it works now after I redo it completely of course. I must have edited it or something before so it wouldn't function. Thanks for all your help! |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |