iTrafficCreation and iScriptedOrders
19 years 7 months ago #12713
by Cougaris
Replied by Cougaris on topic iTrafficCreation and iScriptedOrders
So when the pods are released by the station, I presume they travel down the conveyer and then just float off?
Please Log in or Create an account to join the conversation.
- GrandpaTrout
- Offline
- King of Space
19 years 7 months ago #12714
by GrandpaTrout
Replied by GrandpaTrout on topic iTrafficCreation and iScriptedOrders
Well, I don't know the what happens with the spew command but, to drive around pods you need to install an AI pilot and then issue the pod a docking order. Which gives you a place to start reading the POG SDK document.
iShip.InstallAIPilot and
iAI.GiveDockOrder
I find it is easier to understand things when I am working toward a goal. Like getting a group of pods to dock with a freighter. Of course, if Jaffs is your freighter, then the player would just need to tag the pods.
iShip.InstallAIPilot and
iAI.GiveDockOrder
I find it is easier to understand things when I am working toward a goal. Like getting a group of pods to dock with a freighter. Of course, if Jaffs is your freighter, then the player would just need to tag the pods.
Please Log in or Create an account to join the conversation.
19 years 7 months ago #12715
by Joco
Replied by Joco on topic iTrafficCreation and iScriptedOrders
No - you need to detach to get the pod off. I'll be posting working code tonight (6-8hrs time) to spit cargo pods of type X off of stations that have a spewer.
Please Log in or Create an account to join the conversation.
- GrandpaTrout
- Offline
- King of Space
19 years 7 months ago #12716
by GrandpaTrout
Replied by GrandpaTrout on topic iTrafficCreation and iScriptedOrders
I just wanted to say how great it is to have some pog programmers around here! I was missing you guys and I didn't even know you!
Please Log in or Create an account to join the conversation.
19 years 7 months ago #12717
by MajorTom
Replied by MajorTom on topic iTrafficCreation and iScriptedOrders
I've done lots of cargo pod stuff so here is an idea to make the spewer "swallow" the pods:
Enjoy
Iwar2 Multiplayer Fan Site
Code:
// hsim where = iSim.Cast( //your spewer on the station)
// Assumption: the spewer has a dock port
// you'll need some kind of polling function to trigger the task
task SwallowMultiplePods(hsim where)
{
hship tough_luck;
list unlucky_pods = List.FromSet ( iSim.SimsInRadius ( iSim.Cast ( where ), 10000, T_CargoPod ) );
int j, pods_around = List.ItemCount ( unlucky_pods );
hobject dead_meat;
for (j=0;j<pods_around;++j)
{
dead_meat = List.GetNth( unlucky_pods, j );
tough_luck = iShip.Cast(dead_meat);
iShip.InstallAIPilot(tough_luck);
iAI.GiveDockOrder(tough_luck, where);
while (! iSim.IsDocked( tough_luck ))
{
Task.Sleep( Task.Current(), 0.5 );
}
Sim.SetHidden( tough_luck, true );
Sim.Destroy ( tough_luck);
}
}
That'll dock all the pods within 10km range of the spewer one after
the other, and as they are docked, silently remove them from the
game.
To make freighters undock thier pods when they are within 10 km
radius of the spewer you could use the same method of creating a
list of sims, but in this case use T_Freighter as the identifier
(instead of T-CargoPod as shown above)
Once you have created a list of the freighter(s) in the radius of
you could use this:
ship = iShip.Cast(//the ship you found in the list);
pod_count = Sim.ChildCount(ship );
if (pod_count != 0)
{
for ( n = 0; n< pod_count; ++n )
{
iShip.UndockSelf(ship);
}
}
Note: A)you do have to give the ship an undock command for
[u]each[/u] pod in this case. 2)Any ship in the radius that is
docked to a structure will also undock itself, so you might want to
check if thats the case and exclude it from the undock routine
3)Some ships may have the Docking latch on, so you might want to
unlock them like this:
pod_count = Sim.ChildCount(ship );
for ( n = 0; n< pod_count; ++n )
{
sim2 = Sim.NthChild( ship, n );
iSim.SetDockingLock( iSim.Cast( ship ), iSim.Cast( sim2 ), false );
}
Note: yep, you have to unlock each pod individually
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.
19 years 7 months ago #12718
by Joco
Replied by Joco on topic iTrafficCreation and iScriptedOrders
Here are my efforts to date for spewing pods from a station that has a spewer.
--- code superceded ---
--- code superceded ---
Please Log in or Create an account to join the conversation.