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



Reply to topic  [ 11 posts ] 
 Easy inter-MO communication, Create() interception. 
Author Message
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Easy inter-MO communication, Create() interception.
As the title says, you can intercept the creation of any scripted object simply by finding the conversion function(ToAHuman, ToACrab, ect) and copying somewhere, and replacing it with your own function.

This is due to the game copying scripted MOs from a list in MovableMan, conveting them andd copying them into lists named after the ClassName that hold the functions and the variables of scripted MOs.

For an example, if I wanted to kill all scripted AHumans, I would do this:
Code:
function DestroyHumans(actor)
actor:GibThis()
return OldToAHuman(actor)
end

And where I have a code injected:
Code:
if not(injected) then
OldToAHuman = ToAHuman
injected = true
ToAHuman = DestroyHumans
end



Now, by looking at the lists named after the plural of the classname, like AHumans, you can change variables without the hackish ID indexed lists.
The lists have two things in them, lists containing the preset functions, and the pointers to an object reference that allows you to edit variables.
And set new variables.
Example(resets the fly up timer on destroyer cannon things):
Code:
for k,v in pairs(AEmitters) do
if v.PresetName == "Destroyer Cannon Shot" then
v.testTimer:Reset()
end
end


Both of these do not work on attachables, attachables are covered with this:
viewtopic.php?f=73&t=15359


Last edited by mail2345 on Fri Jul 03, 2009 5:44 am, edited 4 times in total.



Fri Jul 03, 2009 2:45 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Intercepting creation of scripted objects.
Cure for zombie infection, basically?
Or lua death bomb?


Fri Jul 03, 2009 2:56 am
Profile WWW
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Intercepting creation of scripted objects.
Also fire proofing. But if one of my zombies on the field, the controller MO is already made, so no for that.
But Darlos9D's flamethrower uses the fire to control the health damage, so you could check if the particle is near, and neutralize.

Lua death bomb depends on how.

This can also be used to neutralize heat seaking missiles.


Fri Jul 03, 2009 3:00 am
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post Re: Intercepting creation of scripted objects.
Oh, yeah, that makes sense!
Heat-seeking rocket jammer here we come!
MUAHAHA!


Fri Jul 03, 2009 3:04 am
Profile WWW
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post Re: Intercepting creation of scripted objects.
Wait, wait, wait. Does that mean that we can have Lua scripts running on different objects, but that can influence each other? If so, it surely does expand scripting possibilities quite a lot.


Fri Jul 03, 2009 3:08 am
Profile WWW
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Intercepting creation of scripted objects.
We could always do that. 's called a global variable.


Fri Jul 03, 2009 3:09 am
Profile
User avatar

Joined: Fri Oct 17, 2008 9:46 pm
Posts: 5212
Location: The Grills Locker.
Reply with quote
Post Re: Intercepting creation of scripted objects.
Uh. :oops:
If so, then what exactly is this script for?


Fri Jul 03, 2009 3:15 am
Profile WWW
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Intercepting creation of scripted objects.
Global variables are non-private, and are target towards all scripts.
You can index by ID, but that runs the risk of bugs.

Anyway, both MOs have to be willing.
Oh, I found another method. Will add to the OP.


Fri Jul 03, 2009 3:19 am
Profile
User avatar

Joined: Sun Jul 13, 2008 9:57 am
Posts: 4886
Location: some compy
Reply with quote
Post Re: Easy inter-MO communication, Create() interception.
why didnt i see this topic before?
helpful, mail.


Wed Jul 29, 2009 11:42 am
Profile WWW
User avatar

Joined: Sun May 31, 2009 1:04 am
Posts: 308
Reply with quote
Post Re: Easy inter-MO communication, Create() interception.
So does this only work on objects that have a script attached to them?


Sun Aug 09, 2009 8:44 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Easy inter-MO communication, Create() interception.
Yes. Apparently the in game engine uses these lists, so becareful.


Sun Aug 09, 2009 11:16 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 11 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.147s | 13 Queries | GZIP : Off ]