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



Reply to topic  [ 10 posts ] 
 Is there any way to despawn actors without deleting them? 
Author Message
User avatar

Joined: Sat Oct 17, 2009 2:07 pm
Posts: 127
Reply with quote
Post Is there any way to despawn actors without deleting them?
When you create a MO of any sort, you create the entity itself using appropriate CreateWhatever() function (let's call it the "A" state of object), and after that you transfer ownership of entity to the MovableManager using appropriate MovableMan:AddWhatever() function with the pointer to said entity as argument, and this spawns the entity in the game world (and puts it into -let's call it so- the "B" state).
I'm looking for some way to remove an actor from MovableMan's list of simulated MO's, thereby changing its state back from "B" to "A".
I've tried using MovableMan:RemoveActor()/RemoveMO() functions, but for some reason they crash the game without any visible cause or error report.
Assuming these functions are seemingly the only way it is intended to be done, I can see no solution to this problem at all.
Any ideas?

Oh, and the reason I'm trying to do the described manipulation is that I want to put an actor into a craft through Lua. AddInventoryItem() function seems to work only with non-listed MOs. In my case, it would always be some actor that is already in simulation, so this function is useless unless I'm able to despawn actor without completely deleting its entity from memory.
So if you've got any ideas about putting an actor into a craft through Lua, that will make the despawning unneccesary.


Thu Dec 13, 2012 10:52 pm
Profile ICQ
User avatar

Joined: Sat Jul 23, 2011 6:15 am
Posts: 82
Reply with quote
Post Re: Is there any way to despawn actors without deleting them?
Not exactly a pro with lua or anything, but basically you want it so that by meeting a certain condition, the actor will "get inside" the craft (get deleted) and transfer control to the craft, right? Simplest way would be to make it so that when the condition is met, the craft will save the actor's PresetName and inventory. Then simply delete the actor. Then for getting out, make another condition for that. Then the craft will spawn the actor through lua, add its inventory stuff back in, and then transfer control to the actor. I don't feel like researching every function you will use but that's the general idea I came up with.

Edit: Yup I forgot a few things. Namely health. And probably a few other important variables.


Last edited by kungfuchan13 on Fri Dec 14, 2012 1:33 am, edited 1 time in total.



Thu Dec 13, 2012 11:35 pm
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: Is there any way to despawn actors without deleting them?
You want to put an actor inside a craft, as in, if you could get it normally by opening the hatches and letting it jump in? But instead of the hatches, using lua?

Well, if that's the case, the best way I can think of doing it would be creating an exact copy of the actor (copying it's inventory, health, checking if it has some limbs and if not remove them, etc., though it's a pain in the butt to script that) and then use AddInventoryItem() on the craft.

Other than that, I don't think it's possible, but probably I'm wrong.


Thu Dec 13, 2012 11:45 pm
Profile
User avatar

Joined: Sat Oct 17, 2009 2:07 pm
Posts: 127
Reply with quote
Post Re: Is there any way to despawn actors without deleting them?
Well, I've thought about it already.
My main doubt about this is, firstly, that, as everyone knows, managing inventory through Lua is still really messy, I could use CaveCricket's method of cycling through inventory though. The second is that I would like to keep it usable with brain actor. However, just creating another brain actor instead might work, atleast in certain kind of brain tracking activities.
As it seems like the only way to go, I think I'll change my mind about this method and just use copying, hoping it won't be too laggy. Thanks for your answers, guys, expect to see the result in future updates of OnLine Tech :)


Fri Dec 14, 2012 12:15 pm
Profile ICQ

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Is there any way to despawn actors without deleting them?
Do you actually need them to be in the craft or would you be fine with just cheating it by setting their scale to 0 and dumping them off somewhere in the side?
It is interesting that adding actors to inventories and RemoveActor/MO work (or don't work as the case may be) like that, I've never taken a good look at either but this has me really wanting to do so.


Fri Dec 14, 2012 11:27 pm
Profile

Joined: Fri Dec 14, 2012 5:44 am
Posts: 201
Reply with quote
Post Re: Is there any way to despawn actors without deleting them?
Bad Boy wrote:
Do you actually need them to be in the craft or would you be fine with just cheating it by setting their scale to 0 and dumping them off somewhere in the side?
It is interesting that adding actors to inventories and RemoveActor/MO work (or don't work as the case may be) like that, I've never taken a good look at either but this has me really wanting to do so.


Wait, Is it possible to simply do as you have said?
I'd like to create vehicles that have that hover, Drop craft storage door, but instead of returning or anything, its a land craft that can be controlled.

But I'd like to create a lua script to check if there is an actor in its inventory before it can move at all. Or a special item (A "chip").

Could you provide me with more information on this? Is it possible to create actual craft that just get dropped in and cannot fly? Walking craft?


Sat Jan 05, 2013 2:29 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Is there any way to despawn actors without deleting them?
Look here for a method, there are other similar ones that can be done and it'd probably be easier to just dump the actor inside the mech's position instead.

On a somewhat related note, and correct me if I'm wrong, I'm getting the impression that you have lots of grand ideas and little actual experience. While it's your choice of course, I'd suggest starting small and working up to bigger things. If lua's what you want to learn, look at various scripts and try to understand how they work, look at various lua tutorials and instructions on and off the forums and look at the wiki to get to know various functions (it's invaluable).


Sat Jan 05, 2013 3:46 am
Profile

Joined: Fri Dec 14, 2012 5:44 am
Posts: 201
Reply with quote
Post Re: Is there any way to despawn actors without deleting them?
Bad Boy wrote:
Look here for a method, there are other similar ones that can be done and it'd probably be easier to just dump the actor inside the mech's position instead.

On a somewhat related note, and correct me if I'm wrong, I'm getting the impression that you have lots of grand ideas and little actual experience. While it's your choice of course, I'd suggest starting small and working up to bigger things. If lua's what you want to learn, look at various scripts and try to understand how they work, look at various lua tutorials and instructions on and off the forums and look at the wiki to get to know various functions (it's invaluable).



Hmm, you say dump the actor inside the mechs position, does that mean the actor stays present the entire time but the mass is just changed so when the mech is destroyed the actor is returned?


And

if actor.ClassName == "AHuman" and actor.Mass < 300 then

Does that control the size of what actors are allowed to use the mech at all?


Sat Jan 05, 2013 4:50 am
Profile

Joined: Fri Sep 10, 2010 1:48 am
Posts: 666
Location: Halifax, Canada
Reply with quote
Post Re: Is there any way to despawn actors without deleting them?
Izak12 wrote:
Hmm, you say dump the actor inside the mechs position, does that mean the actor stays present the entire time but the mass is just changed so when the mech is destroyed the actor is returned?


And

if actor.ClassName == "AHuman" and actor.Mass < 300 then

Does that control the size of what actors are allowed to use the mech at all?
Yes to both, though I haven't looked at the script in a while so I'm not sure entirely what purpose mass plays with respect to the first question. This is a bit off topic by the way, though it may be okay since the op doesn't seem to be continuing on the topic.


Sat Jan 05, 2013 5:55 am
Profile

Joined: Fri Dec 14, 2012 5:44 am
Posts: 201
Reply with quote
Post Re: Is there any way to despawn actors without deleting them?
Bad Boy wrote:
Izak12 wrote:
Hmm, you say dump the actor inside the mechs position, does that mean the actor stays present the entire time but the mass is just changed so when the mech is destroyed the actor is returned?


And

if actor.ClassName == "AHuman" and actor.Mass < 300 then

Does that control the size of what actors are allowed to use the mech at all?
Yes to both, though I haven't looked at the script in a while so I'm not sure entirely what purpose mass plays with respect to the first question. This is a bit off topic by the way, though it may be okay since the op doesn't seem to be continuing on the topic.


Hmm alright, well, in regards to necroing, how many days should I consider a topic dead and forgettable? Because some of these ideas I'd like to make myself and I'd rather not get in trouble for stealing other peoples ideas. Especially if they seem abandoned but are not.

For instance, In Taleworlds forums, people get extremely protective of their modifications, I am unsure of this modding community.


Sat Jan 05, 2013 6:14 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 10 posts ] 

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