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