Data Realms Fan Forums
http://forums.datarealms.com/

Attachment's through lua?
http://forums.datarealms.com/viewtopic.php?f=73&t=31461
Page 2 of 2

Author:  Bad Boy [ Wed Jul 18, 2012 10:51 pm ]
Post subject:  Re: Attachment's through lua?

Yeah, that's what I'd do in most cases anyway. The only problem there is you can get some desync when CC's physics go wonky and there's the chance that referencing the pseudoattachable from the actor will screw up; for example, when another actor with that pseudo attachable walks by so it's closer to the actor whose pseudoattachable you want. So using a multi-framed attachable that starts invisible works pretty well too.
It's too bad the attach function doesn't work though, maybe it'll get fixed in some future release.

Author:  Roast Veg [ Wed Jul 18, 2012 11:09 pm ]
Post subject:  Re: Attachment's through lua?

Why does an actor with the same MOSR mess it up? If the script created the MOSR you should have a unique MO there. It'd only mess up like that if it were checking for the closest one, which it should never need to do.

Author:  Bad Boy [ Wed Jul 18, 2012 11:32 pm ]
Post subject:  Re: Attachment's through lua?

If you're looking for it from the actor's script it'd be easiest to check for proximity, I can't think of any other decent ways to reliably find it off the top of my head. I guess you could use sharpness or lifetime or presetname checks as safeties though, changing those to the actor's ID or whatever.

Author:  Roast Veg [ Wed Jul 18, 2012 11:38 pm ]
Post subject:  Re: Attachment's through lua?

Surely you can pass it from the local to a self property on creation?

Author:  Bad Boy [ Wed Jul 18, 2012 11:49 pm ]
Post subject:  Re: Attachment's through lua?

If you make it with the actor's script you mean? Then yes, but not if you make it with a bomb or held device or whatever, since you won't be able to access it from the actor. Or am I misunderstanding you there?

Author:  Roast Veg [ Wed Jul 18, 2012 11:52 pm ]
Post subject:  Re: Attachment's through lua?

Well with a pie menu function as well, can't you also access the properties of actors? In the context of the OP, I think it's entirely possible to avoid bugs like that.

Author:  Bad Boy [ Thu Jul 19, 2012 12:11 am ]
Post subject:  Re: Attachment's through lua?

Hmmm, if you put the pie button on the actor then you could definitely access properties and create variables for the actor. But if you put it on the object I don't think you can, though I may be mistaken. If you put it on an object, using self as an argument would point to the object, and using actor as the argument would give you a pointer but (I think) leave you unable to add any variables to the actor. And if you put it on the actor, you'd have a pie button that's mostly useless.
I wonder though, can you put more than one argument in a pie button function? I'd assume so, and perhaps that could be used to solve the problem. Though so all my lines of thought in that direction would wind up with you being able to find the actor easily from the object but they wouldn't help with finding the object from the actor.

Author:  Roast Veg [ Thu Jul 19, 2012 12:22 am ]
Post subject:  Re: Attachment's through lua?

I've never tried applying properties to an actor from a pie menu from an object, but I was under the impression that it worked.

Author:  Bad Boy [ Thu Jul 19, 2012 12:39 am ]
Post subject:  Re: Attachment's through lua?

Well things like sharpness, lifetime, presetname, etc. that are ini defined properties can be changed easily, but I don't think you can get a variable you make in the actor's script from the pie menu. I.e. if you add something like
self.myhelmet = nil;
to the actor's create function, as far as I know you can't use the pie function to do
actor.myhelmet = whatever

If I'm not mistaken, since a self variable is really just a local variable that continues to exist in other related functions (i.e. create, update, etc.) you can't access it outside of the self's script. Though if I am mistaken that'd be great :D

Author:  Roast Veg [ Thu Jul 19, 2012 1:12 am ]
Post subject:  Re: Attachment's through lua?

I know you can't access it in the scripts of other objects, but I thought pie menus functions weren't associated with an object in particular.

Author:  Bad Boy [ Thu Jul 19, 2012 1:28 am ]
Post subject:  Re: Attachment's through lua?

Hmm, I'm honestly not sure, I always figured they were associated . I don't really know how pie functions pick things or what using something other than self or actor as an argument would do. I guess someone'll just have to test it and find out :)

Author:  Asklar [ Thu Jul 19, 2012 1:40 am ]
Post subject:  Re: Attachment's through lua?

Bad Boy wrote:
Well things like sharpness, lifetime, presetname, etc. that are ini defined properties can be changed easily, but I don't think you can get a variable you make in the actor's script from the pie menu. I.e. if you add something like
self.myhelmet = nil;
to the actor's create function, as far as I know you can't use the pie function to do
actor.myhelmet = whatever

If I'm not mistaken, since a self variable is really just a local variable that continues to exist in other related functions (i.e. create, update, etc.) you can't access it outside of the self's script. Though if I am mistaken that'd be great :D


No, you can't access it, or at least I couldn't.

I tried to create a reload function for my gunship, which involved resetting some timers and changing some variables, which where like self.ReloadTimer, self.CanFire and things like that, but it didn't work.

Author:  Bad Boy [ Thu Jul 19, 2012 1:55 am ]
Post subject:  Re: Attachment's through lua?

Oh, well that's surprising in and of itself. You used self as the argument and couldn't access anything? I'd hoped you'd be able to at least access that much. But then again, that makes sense, if you could access them sharpness wouldn't always be used for pie scripts.
That said, asklar, what you had to do there was have the pie menu change the helicopter's sharpness (or lifetime, presetname, etc.) and use the update function of the helicopter to have it reload if its sharpness or whatever was that value, like normal pie scripts but with a bunch of other stuff to worry about too.

Page 2 of 2 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/