Author |
Message |
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
 Exceptions for dying actors
I couldn't redact a better title.
So, I'm making a particle which changes it's position to an actor's one. Now, if the actor dies, the game crashes. Obviously, I made the particle delete itself if actor.Health < 1.
But, that doesn't work if the actor is gibbed.
Is there any function to check that? Or any way?
|
Thu Jun 21, 2012 12:35 am |
|
 |
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
 Re: Exceptions for dying actors
Check that the actor's ID isn't 255 -- you can always access that.
|
Thu Jun 21, 2012 1:03 am |
|
 |
Asklar
Data Realms Elite
Joined: Fri Jan 07, 2011 8:01 am Posts: 6211 Location: In your office, earning your salary.
|
 Re: Exceptions for dying actors
Ah, I forgot that.
Many much thanks, Master.
|
Thu Jun 21, 2012 2:07 am |
|
 |
Bad Boy
Joined: Fri Sep 10, 2010 1:48 am Posts: 666 Location: Halifax, Canada
|
 Re: Exceptions for dying actors
Correct me if I'm wrong but couldn't you just add an 'if MovableMan:IsActor(actor) then' check before referencing the actor?
|
Thu Jun 21, 2012 4:20 am |
|
 |
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
 Re: Exceptions for dying actors
Yeah, that also works -- probably better in this case, admittedly. Checking the ID works better for generic objects.
|
Thu Jun 21, 2012 4:58 am |
|
 |
Bad Boy
Joined: Fri Sep 10, 2010 1:48 am Posts: 666 Location: Halifax, Canada
|
 Re: Exceptions for dying actors
Yeah, of course, since you don't have to figure out which class they fit in, I was wondering why you chose that instead. Also I'd imagine it's great for attachables (or at least a similar method is for getting pointers to them) since they don't seem to fit in any class; it took me irritatingly long to figure it out the other day. But then again, attachables are generally kind of screwy, for example, PresetMan:ReloadAllScripts() doesn't affect them but self:ReloadScripts() does you can't stick pie buttons on them as far as I can tell, though that may be deliberate.
|
Thu Jun 21, 2012 5:39 am |
|
 |
|