What code is used to have the player attack the target for the mission to be successful.
EDIT: I think I know, you use shpOrderAttack! (correct me if I'm wrong.)
Question concerning missions
- dvlenk6
- Militia Captain
- Posts: 519
- Joined: Sun Mar 05, 2006 6:56 am
- Location: Sanctuary and beyond
- Contact:
shpOrderAttack sets the guide pointer (like the pointer that points to a sung transport in those missions where you have to kill one of those) on the screen for playership. For an non player ship, that is used to target something.Fatboy wrote:What code is used to have the player attack the target for the mission to be successful.
EDIT: I think I know, you use shpOrderAttack! (correct me if I'm wrong.)
shpOrderEscort will do the same thing for the player ship. For NPC ships, then they will escort the target ship.
It is an <event>...</event> in a station that makes the missions succesful or failures.
<OnObjDestroyed> ... </>
Look at the events (below <StaticData> ... </>) of a CSC Task Force in CommonwealthFleet.xml for examples.
I found (shpOrderEscort gPlayerShip gTarget) (and the target was a station.)It is an <event>...</event> in a station that makes the missions succesful or failures.
<OnObjDestroyed> ... </>
Look at the events (below <StaticData> ... </>) of a CSC Task Force in CommonwealthFleet.xml for examples.
And I was trying to make a mission that had the player destroy a station.[/quote]
- dvlenk6
- Militia Captain
- Posts: 519
- Joined: Sun Mar 05, 2006 6:56 am
- Location: Sanctuary and beyond
- Contact:
shpOrderEscort gPlayerShip gTarget that is setting the target into the computer, for the pointer on the screen.Fatboy wrote:...I found (shpOrderEscort gPlayerShip gTarget) (and the target was a station.)
And I was trying to make a mission that had the player destroy a station.
In CommonwealthFleet.xml; Look at mission4a; 'Destroy Ares Station':
In the first block:
(setq gTarget (random (sysFindObject gSource "T:aresMajor;A")))
sets the variable 'gTarget' to the result of the system search for an Ares station.
In the second block (where it gives you your wingmen), there is a shpOrderAttck command, and that would make the pointer to the target station appear on the screen.
Notice this line:
(objSetObjRefData gSource "Target" gTarget)
That sets a data field in gSource (the CSC) for "Target" to the gTarget variable from the system search...
Now scroll down to the <OnObjectDestroyed> tag in the <Event> section for the CSC. Down to this line in the switch:
(and (eq missionID "mission4a") (eq aObjDestroyed (objGetObjRefData gSource "Target")))
The objGetRefData... If the object being destroyed equals the ref data "Target" from above (and mission4a is the current mission), then the script block that follows is activated.
That is the way to make a mission to destroy an enemy station.
You can usually find an example in the existing xml, copy it, paste it into your mod, and change what you need to change to make it work the way you want.