View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:23 am



Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
 Attachment's through lua? 
Author Message

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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.


Wed Jul 18, 2012 10:51 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Wed Jul 18, 2012 11:09 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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.


Wed Jul 18, 2012 11:32 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post Re: Attachment's through lua?
Surely you can pass it from the local to a self property on creation?


Wed Jul 18, 2012 11:38 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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?


Wed Jul 18, 2012 11:49 pm
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Wed Jul 18, 2012 11:52 pm
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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.


Thu Jul 19, 2012 12:11 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Thu Jul 19, 2012 12:22 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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


Thu Jul 19, 2012 12:39 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Tue May 25, 2010 8:27 pm
Posts: 4521
Location: Constant motion
Reply with quote
Post 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.


Thu Jul 19, 2012 1:12 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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 :)


Thu Jul 19, 2012 1:28 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Fri Jan 07, 2011 8:01 am
Posts: 6211
Location: In your office, earning your salary.
Reply with quote
Post 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.


Thu Jul 19, 2012 1:40 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post 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.


Thu Jul 19, 2012 1:55 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 28 posts ]  Go to page Previous  1, 2

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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.082s | 14 Queries | GZIP : Off ]