iTrafficCreation and iScriptedOrders
19 years 7 months ago #12783
by Joco
Replied by Joco on topic iTrafficCreation and iScriptedOrders
Re checked the taffic scripts using this model to set up the ship:
Worked just the same as when using the iPilotSetup call. So long as you install an AI pilot you are sorted.
Code:
ship1 = iShip.Create( "ini:/sims/ships/utility/puffin", "Caroline");
//iPilotSetup.Generic( ship1 );
iShip.InstallAIPilot( ship1, .5, .5, .5, "", "", "", "" );
Group.AddSim( traffic_group, ship1 );
Sim.PlaceNear( ship1, station, 1km );
Worked just the same as when using the iPilotSetup call. So long as you install an AI pilot you are sorted.
Please Log in or Create an account to join the conversation.
19 years 7 months ago #12792
by EricMan64
Replied by EricMan64 on topic iTrafficCreation and iScriptedOrders
If I remember correctly, iPilotSetup is just a bunch of handler functions to call iShip.InstallAIPilot(), so you shouldn't have any trouble. You could even make your own version of the iPilotSetup package.
Please Log in or Create an account to join the conversation.
19 years 7 months ago #12793
by Joco
Replied by Joco on topic iTrafficCreation and iScriptedOrders
EricMan - quite correct. Any scenario mod wanting to replace default ship behaviours would want to setup its own set of functions doing essentially the same thing as the iPilotSet package. You might even use iPilotSetup to get the base config for a ship done then over-write the behaviour functions with custom stuff.
heh heh heh I must say I am getting a real kick out of getting my head around all this stuff again.
Keep the research areas comming else give me something to build ... come on come on ... I dear ya!
heh heh heh I must say I am getting a real kick out of getting my head around all this stuff again.
Keep the research areas comming else give me something to build ... come on come on ... I dear ya!
Please Log in or Create an account to join the conversation.
19 years 7 months ago #12796
by MajorTom
Replied by MajorTom on topic iTrafficCreation and iScriptedOrders
The mod you men are building is your stuff and I'm not butting in, but if you're looking for a challenge: How about a tractor beam? I think it was mentioned above as something nice to have.
since pog can't directly "see" if you have pulled the trigger and also can't return which weapon is selected, that might be rather interesting to find a solution.
Iwar2 Multiplayer Fan Site
since pog can't directly "see" if you have pulled the trigger and also can't return which weapon is selected, that might be rather interesting to find a solution.
Iwar2 Multiplayer Fan Site
Please Log in or Create an account to join the conversation.
- GrandpaTrout
- Offline
- King of Space
19 years 7 months ago #12797
by GrandpaTrout
Replied by GrandpaTrout on topic iTrafficCreation and iScriptedOrders
There are a few more items worth understanding better.
I wanted the player to be able to remote pilot cargo pods and dock them to his own freighters etc. But (if I remember correctly) the player gets trapped forever in the remote pilot connection once the pod docks. You could write a player watch loop that looks for the condition where the player is remote piloting a docked cargo pod (or a dead or dying sim) and moves the player back into his prior ship. There are some iRemotePilot function calls to find out the players prior ship. You might have to set the player pilot back in the ship directly. If this cannot be done, some other cargo handling method will need to be invented.
A traffic script I would like to write is a pirate ambush. The pirates knock the players group of ships out of LDS. My first try was to shoot an LDSI missile at the group (long ago) but I have since seen functions to disrupt a whole group at once. So here is the goal: Write a function that finds all the ships near a player that is LDSing, and disrupt all of them reliably. If the function does not work well the players group will be scattered (which we do not want). The function will need to find the ships, because the player could be escorting anyone - not just a prior created group.
How about a generic "cargo catcher" for the Tug? I wrote a function that allows the tug to latch onto moving objects and then it slows them to a hault (if they have no pilot). The goal was to allow capturing drifting ship wrecks and cargo pods that don't slow themselves down. This idea would go well with your debris concept. Basically, when the player presses the tractor beam button, a waypoint is placed ~100 meters behind the tug. The player must keep this waypoint in contact with the same target ship for ~10 seconds. If he does, then a watch loop attaches the player as a child sim to the object. And he can undock normally. (if you don't think that is a challenge, try to keep the rear of your ship in contact with a rotating object for 10 seconds without collision).
The watch loop will also check if the object has no pilot, and then it will slow the object to a zero speed. (sadly, we cannot query rotation speed, but that needs to reach zero as well). If the object has a pilot, then the two are just docked normally, and the largest one wins control.
Such a function is useful for boarding actions, scrap collecting, rescue operations (your debris package could drop life pods), and paid salvage missions. And even better, it makes the Tug a very unique and useful ship.
My old code was not flexible. It only allowed docking with specially prepared ships.
Any of those catch your fancy?
[Edit]
MajorTom and I were thinking alike!
[Edit2]
I just checked an my original code (called the "Claw") was lost. It mutated into a asteroid sounding script back before I was using version control.
The function is easiest to trigger just using a keybind. If you want to actually have the game track on weapons fire - that is kind of possible. What you do is poll looking for the sim that is created by the weapon. In this case, a beam weapon could be used to simulate the tractoring effect.
While I think looking for the sim is a cool solution, I don't like it because it makes a mess of checking if the player is attacking something. It will come true that the player is attacking a ship (with the beam weapon) when the player might really be trying to perform a rescue operation. Which further makes a mess out of the reputation code. So I would go for the keybind!
I wanted the player to be able to remote pilot cargo pods and dock them to his own freighters etc. But (if I remember correctly) the player gets trapped forever in the remote pilot connection once the pod docks. You could write a player watch loop that looks for the condition where the player is remote piloting a docked cargo pod (or a dead or dying sim) and moves the player back into his prior ship. There are some iRemotePilot function calls to find out the players prior ship. You might have to set the player pilot back in the ship directly. If this cannot be done, some other cargo handling method will need to be invented.
A traffic script I would like to write is a pirate ambush. The pirates knock the players group of ships out of LDS. My first try was to shoot an LDSI missile at the group (long ago) but I have since seen functions to disrupt a whole group at once. So here is the goal: Write a function that finds all the ships near a player that is LDSing, and disrupt all of them reliably. If the function does not work well the players group will be scattered (which we do not want). The function will need to find the ships, because the player could be escorting anyone - not just a prior created group.
How about a generic "cargo catcher" for the Tug? I wrote a function that allows the tug to latch onto moving objects and then it slows them to a hault (if they have no pilot). The goal was to allow capturing drifting ship wrecks and cargo pods that don't slow themselves down. This idea would go well with your debris concept. Basically, when the player presses the tractor beam button, a waypoint is placed ~100 meters behind the tug. The player must keep this waypoint in contact with the same target ship for ~10 seconds. If he does, then a watch loop attaches the player as a child sim to the object. And he can undock normally. (if you don't think that is a challenge, try to keep the rear of your ship in contact with a rotating object for 10 seconds without collision).
The watch loop will also check if the object has no pilot, and then it will slow the object to a zero speed. (sadly, we cannot query rotation speed, but that needs to reach zero as well). If the object has a pilot, then the two are just docked normally, and the largest one wins control.
Such a function is useful for boarding actions, scrap collecting, rescue operations (your debris package could drop life pods), and paid salvage missions. And even better, it makes the Tug a very unique and useful ship.
My old code was not flexible. It only allowed docking with specially prepared ships.
Any of those catch your fancy?
[Edit]
MajorTom and I were thinking alike!
[Edit2]
I just checked an my original code (called the "Claw") was lost. It mutated into a asteroid sounding script back before I was using version control.
The function is easiest to trigger just using a keybind. If you want to actually have the game track on weapons fire - that is kind of possible. What you do is poll looking for the sim that is created by the weapon. In this case, a beam weapon could be used to simulate the tractoring effect.
While I think looking for the sim is a cool solution, I don't like it because it makes a mess of checking if the player is attacking something. It will come true that the player is attacking a ship (with the beam weapon) when the player might really be trying to perform a rescue operation. Which further makes a mess out of the reputation code. So I would go for the keybind!
Please Log in or Create an account to join the conversation.
19 years 7 months ago #12798
by Joco
Replied by Joco on topic iTrafficCreation and iScriptedOrders
Hmmmm .... nice juicy stuff in there. I'll start working through some of those.
The tractor beam one looks a little too hairy to start off with but I WILL get to it and have a crack at it.
The LDS interupt function should be very doable based on my reading/experiments to date - that is on the list now.
Generic cargo catcher for Tug? Sure - will look at it.
Remote pilot of Pods to dock with own freighter .... hmmm will have a look ... my gut tells me there should be a better/faster way to do that. Will think on it.
But great stuff - thanks for this. At this point I have no firm mod plans of my own so more than happy to help out with anything just give me a yell.
Cheers,
Joco.
The tractor beam one looks a little too hairy to start off with but I WILL get to it and have a crack at it.
The LDS interupt function should be very doable based on my reading/experiments to date - that is on the list now.
Generic cargo catcher for Tug? Sure - will look at it.
Remote pilot of Pods to dock with own freighter .... hmmm will have a look ... my gut tells me there should be a better/faster way to do that. Will think on it.
But great stuff - thanks for this. At this point I have no firm mod plans of my own so more than happy to help out with anything just give me a yell.
Cheers,
Joco.
Please Log in or Create an account to join the conversation.