iTrafficCreation and iScriptedOrders
* new ldsi ini file to support pirate ldsi trap explosion (thanks MajorTom)
* code tweaked for this new sim
* tested need for delay between lds disrupt and sfx placement. Doesn't seem to be a need.
Cheers,
Joco.
Please Log in or Create an account to join the conversation.
I have this working.
Very simple process. I have a master monitor task that you can start and stop, and can set the delay between checks. When it is running it looks to see if the player is in remote pilot mode. If you are AND the ship you are in has docked it kicks you out of remote pilot mode. I tested it by piloting/docking a cargo pod to my own ship. Worked like a charm.
Will just clean the code a little then will post.
Cheers,
Joco.
Please Log in or Create an account to join the conversation.
Theoretically a player could dock the pod to something else besides
the mothership (if he accidently targeted another pod instead of the
mothership and pressed F8). Your code would deactivate the remote
connection, but the player would never be able to re-connect to one
of the pods and re-route it because the task would deactivate the
connection momentarily. (he would lose two pods because they would
both be blocked).
You could use iSim.IsDockedTo( hsim sim1, hsim sim2 ); and either
call iShip.UndockSelf if you wanted (so the player could reconnect)
or simply not deactivate the connection until the player finally
figures out whats going on.
In your StopCargoPilot function: I think I read somewheres you are
supposed to destroy globals to prevent memory leaks. More important
in this case, if you don't destroy the global, the next time you run
the StartCargoPilot function, pog will silently fail to create a
global (because the global already exists) and you could end up with
a whole bunch of tasks running that are never stopped (because each
task you start still has it's own handle even though you can't "see" it).
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.
I believe it is. At least when I get back into the normal player ship the cargo pod is docked and pressing undock detaches it.Originally posted by MajorTom
You might want to check to see if the pod is actually docked to the mothership:
True. I had not written this code as a complete system. Just as a method to check if a player has docked then to kick them back to the original craft. Now if the auto kicking was not something desired then doing a key binding approach might work. Would that be preferable to auto returning? Mind you I am not saying that I can get that approach to work. Also the current code allows you to set the pause between tests. So with a 10-15 sec pause you could reconnect and hit undock before getting kicked back again.Theoretically a player could dock the pod to something else besides
the mothership (if he accidently targeted another pod instead of the
mothership and pressed F8). Your code would deactivate the remote
connection, but the player would never be able to re-connect to one
of the pods and re-route it because the task would deactivate the
connection momentarily. (he would lose two pods because they would
both be blocked).
You could use iSim.IsDockedTo( hsim sim1, hsim sim2 ); and either
call iShip.UndockSelf if you wanted (so the player could reconnect)
or simply not deactivate the connection until the player finally
figures out whats going on.
I've just assumed you are on the money and have cleaned things in both the caropilot and pirate code to test/clean the globals I am setting. At this point this code is written for single player in mind. It probably wont work for multiplay.In your StopCargoPilot function: I think I read somewheres you are
supposed to destroy globals to prevent memory leaks. More important
in this case, if you don't destroy the global, the next time you run
the StartCargoPilot function, pog will silently fail to create a
global (because the global already exists) and you could end up with
a whole bunch of tasks running that are never stopped (because each
task you start still has it's own handle even though you can't "see" it).
Thanks for the feedback.
Cheers,
Joco.
Please Log in or Create an account to join the conversation.
I meant the first sentence about checking if it is docked to the
mothership in combination with the next paragraph because the player
may have docked to another pod (or a station or whatever)
I personally think auto kicking on the dock event would beOriginally posted by Joco
Now if the auto kicking was not something desired then doing a
key binding approach might work. Would that be preferable to auto
returning? Mind you I am not saying that I can get that approach to work.
preferable immediatly after hearing that satisfying "clunk" when it
docks. (but not 10-15 secs later [xx(]
You could do a keybind to deactivate the remote connection easily
enough. Just call iRemotePilot.DeactivateConnection (); in the
function that the key activates.
I dunno, if you can target a pod if it is docked to another pod,Also the current code allows you to set the pause between tests. So with a 10-15 sec pause you could reconnect and hit undock before getting kicked back again.
so you may not be able to re-connect? (Subtargeting does not work
on pods in MP, I've never tried it in SP)
The downside of the pause means you are possibly sitting there from
10 - 14.9 secs looking at the dockport of your freighter before your
remote connection to the pod is released? If thats the case you
could try something like this:
while( ! iSim.IsDocked( iSim.Cast(remote) ) )
{
Task.Sleep( Task.Current(), 0.5 );
}
iRemotePilot.DeactivateConnection ();
To make it even more explicit you could use:
while (!iSim.IsDockedTo (iSim.Cast(remote),iSim.Cast(iShipfindPlayerShip()) )
As far as destroying globals goes it's the same in MP or SP.At this point this code is written for single player in mind. It probably wont work for multiplay.
Actually, your code wouldn't work in MP for several reasons(*),
but thats not a problem since we have all the code for rem
connecting and docking pods already working in the Epic Online
multiplay mod. Thats why I can offer advice on this subject here.
* In A MP game there would be be several players simultanously Rem
connecting and docking. So you have to be careful not to deactivate
the connection for all the players whenever just one of them has
docked his pod. (or rem connect everyone to the same pod )
Also in MP you should be able to dock a pod to another players ship
if you want to do teamwork. But, you can't allow people to dock pods
malicously to stations where they would be unretrievable for others.
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.
Right - off to the next puzzle.
Please Log in or Create an account to join the conversation.