Hi Folks. I have recently discovered in the odf files in Legacy that there is an animated Black Hole. I managed to put this into the menu's in the map editor tool. I tried a game with the Black Hole, However I found that you literally have to fly your ship into the hole, when you stop engines your ship stays where it is, restart them and then so far into the hole your ship is destroyed. What I would like to know is, is it possible via mission scripting, to make the Black Hole behave like a real one ie, when a ship strays a little too close to it, it pulls a ship into it even if the ships engines are working against it? Any help appreciated. :)
basically with scripting, but not by modifing the odf. The reason the black hole's "destruction zone" or Event Horizon is so small is the same reason Wormholes entry point is so small. The coding for them is left over from Armada where the ships were scaled A LOT smaller..
To do what you want to the level you asked is complicated and takes a few things.
1. Setup a trigger that goes off when a ship passes within a certain distance of the black hole.
RULE S_Lost if(ALWAYS_EVALUATE && CountUnitsNearObject(Handle, Distance, TeamNum)) then Ship_Lost END_RULEHandle=the Blackhole's handle Distance= distance to activate TeamNum= Player ship team which is Team 1
2. When that triggers the action bring it to a stop To stop the ship: SetCrew(GetNearestVehicle(Handle), 0.00) DisableDirectControl() Handle = Blackhole's handle
Try DisableDirectControl.. see if that prevents the player from taking control of the ship again..
3. If you like you can then cause the ship to move toward the black hole.
DisableEngines(GetNearestVehicle(Handle), 0) Goto(GetNearestVehicle(Handle), Handle, 0) Handle=the Blackhole's handle
4. Another rule for when it gets to a closer radius BOOM it blows up..
RULE S_Lost if(ALWAYS_EVALUATE && CountUnitsNearObject(Handle, Distance, TeamNum)) then Ship_Lost END_RULE Handle=the Blackhole's handle Distance= distance to activate this is smaller than the last one.. TeamNum= Player ship team which is Team 1 Then in the the .scp file create the matching action with this: ExplodeNow(GetNearestVehicle(Handle) h) EnableDirectControl() Handle=the Blackhole's handle If DisableDirectControl works you would want to Reenable control once the ship exploded if the player had a second ship to command.. I have never used the disable/enable direct control.
If the Disable/Enable Directcontrol don't do what I expect then you might have to do something a little different..
I also haven't used GetNearestVehicle before. I have used GetNearestObject, but "Vehicle" might be a better fit if it works right.
Thank you Muldrf, very helpful as always, I am having one problem with this though, when I go to build the mission, I get an error saying "mw4r.cpp error c2064: term does not evaluate to a function taking 0 arguments" any ideas?
it should refer you to a line number in brackets such as " (432) " if my memory serves. open up mw4r.cpp and scroll down to that line number. you will see what function is being called then go back to you mw4r.rul and find the line in there with that entry. The .cpp is a reformatted version of the .rul and the line number do not line up but you should be able to tell what entry it is.
If might be the disable/enable direct control. Like I said I've not attempted to use them myself so don't know if they work or if they take more info.. if it's them then I'd say try putting in
But it could be any other entry in your file so find the line in the .cpp file first so you know what it is your actually trying to fix.
Who needs a user title?
10th January 2007
That's weird, I checked the script interface, but it says DisableDirectControl() doesn't take any arguments. So it's probably something else with a wrong argument. Hm, but why do you have to disable direct control? Remember the very first mission? At the very beginning, when you're supposed to scan that planet, your engines are disabled and you can't do anything about it.
I have always found the scriptinterface.h to be accurate too, which is why I think he should certainty check the .cpp file.
STL12 uses DisableDirectControl();. If just use DisableEngines() the player still can control the ship and make it move..
He asked for the the ship to drift to the hole and be destroyed after it gets closer. The first way to do the drift would be have the script cause the ship to move under impulse. If engines are disabled the goto() command will not work. If the player can control the ship they will be able to override the goto() command with normal controls, so that's why I suggested it.
I accidentally had "DisableEngines(GetNearestVehicle(Handle), 0)" in there it shouldn't be. Atleast with how I intended it.
Still having issues with the rul file, If you remove the S_Lost rule altogether, it builds the mission, but obviously nothing happens when you approach the Black Hole, in the mission. The rul file is not compiling, not sure how to correct it?
Think I have found the problem, for some reason the rul file wont accept Ship_Lost, I substituted this with Mission_fail, obviously the mission then comes to an abrupt end if you are the Enterprise! I think the best way around this is to make the ship fall into the black hole using a cinematic, so instead of Mission_Fail, it will play a cinematic that way even if the Enterprise goes too close to the Black Hole, you will still be able to watch helplessly while the pride of starfleet is pulled into a Black Hole!
You must change the "(Handle, Distance, TeamNum)" to be correct.
My guess is your not setting up the Handle properly.
Also I put in duplicate entries for the Rules. You must make the unique names with uniquely named actions. They were examples only not to be taking 100% literally.
I did put unique names for the Handles:
RULE S_Lost if( ALWAYS_EVALUATE &&((CountUnitsNearObject(mblkhole1166, 1500.0, 1) > 0) then Ship_Lost END_RULE
This wont work when I try to build mission, however, if I change the bottom line from Ship_Lost, to Mission_fail, it builds the mission, my solution to this was to create a Mission_Fail_2, with its own cinematic shot of the Enterprise flying into the Black Hole and blowing up so far inside, this works fine, this cinematic wont play if you are destroyed by the enemy ship, only if you fly within a certain distance of the Black Hole.