Nexus Modding > Scripting

The AI and You

<< < (11/20) > >>

Mularac:
Just use the command PlayMusic();
In the file const.ini there is a list with the constants of each track.

The_Small_Time_Modder:
Okey dokie.

I have two vardrag ships in the mission, and thanks to old dragon i know how to link objectives involving commandos to each of them...

I also managed to get the objective stuff in for the mission, again, thanks to old dragon.

however, how would you assign a secret to a ship, and how would you have the script tell the mission to have the commandos scan the ship for it?

I also want to make it so that the ship does not have any 'Security' and thus doesnt cause the commandos to take casualties.

Furthermore, i managed to get away with this coding, not sure if anyone else has tried this, but here it is...

--- Code: ---EnableEvacBoats(M.Ship.1 ,disable);

--- End code ---
The M.Ship.X (x for the number) or E.ship OR P.ship can be used where i put it. Not sure if this is what everyone else does. but for those who have no idea, heres your answer.  ;)

UPDATE:
 I managed to figure out some of the music stuff on my own, i also added in a small gorg fleet to the mission i am focusing on. However, im not quite sure how to code for this gorg fleet to jump in when all the raptor ships (or at least a number of them) have been critically damaged and/or destroyed. Any ideas as to how this can be done?

The Old Dragon:
With regards to ship security, you'll probably have to edit the Tacticstypes.ini and add a new shipclass and shiptype for the raptor ships that you want (unless you want it to affect all of the Raptor ships).

Here's a little script that brings in some "Gorg" ships when the "Raptors" are damaged...


--- Code: ---MISSION 004
name "Machine Testing"

DefLocation "nav_Pluto"

OBJECTIVES

END

RULES

RULE event SceneInit

:action

//Set the scene size.

SetSceneRadius(200000);

//Ship Naming...

M.R1:=GetSceneObj("Raptor 1");
M.R2:=GetSceneObj("Raptor 2");
M.R3:=GetSceneObj("Raptor 3");
M.R4:=GetSceneObj("Raptor 4");

M.GL:=GetSceneObj("Gorg Lead");

M.GorgFleet:=GetFreeSel();
SelectShips(M.GorgFleet,S.race=#race_Gorg_B);

//make the Raptors and Gorgs visible...

M.Visible:=GetfreeSel();
SelectShips(M.Visible,S.race=#race_Raptor|S.race=#race_Gorg_B);
ExecList(M.Visible,
MakeFullyKnown(S.this);
FreezeReconState(S.this,1);
);

CamLocate(M.R1,2,5000,1000,1000,M.GL,2,0,0,0,0,0);

//Hide the gorgs away...

ExecList(M.GorgFleet,HideShip(S.this));
Dump(M.GorgFleet);

//Call this machine.

M:=GetMachine("Director"):ChangeState(Start,0);

:end //end action

END //end rule

RULE event cheat0

:action

//Damage Raptor 1...

M.R1:damage:=51;

:end //end action

END //end rule

RULE event cheat1

:action

//Damage Raptor 2...

M.R2:damage:=51;

:end //end action

END //end rule

RULE event cheat2

:action

//Damage Raptor 3...

M.R3:damage:=51;

:end //end action

END //end rule

RULE event cheat3

:action

//Damage Raptor 4...

M.R4:damage:=51;

:end //end action

END //end rule

MACHINE "Director"

STATE Start

RULE event In

:action

:end //end action

END //end rule

RULE event CO_HullLow

condition E.Ship:Race=#race_Raptor

:action

Debug("Raptor Damaged");

M.RaptorThreshhold:=2; //Set the damaged ship limit...


//Now count up any Raptor ships with more 50% health...

M.RaptorCount:=GetFreeSel();
SelectShips(M.RaptorCount,S.race=#race_Raptor&S.this:Damage<50);
Dump(M.RaptorCount);

//Once the number of said ships gets below the threshhold, call in the Gorgs...

If(AllNumOf(M.RaptorCount)<M.RaptorThreshhold, LocalEvent(CallGorg));

:end //end action

END //end rule

RULE event CallGorg

:action

//Set up the direction that the ships will arrive; in this case, the direction that the lead ship has been placed...

JumpVector:=VNeg(R2Vec(M.GL:Orientation));

Debug("Gorgs coming!!");

//Refresh this list so that the required ships arrive...

M.GorgFleet:=GetFreeSel();
SelectShips(M.GorgFleet,S.race=#race_Gorg_B);

//Now activate the IP drives...

ExecList(M.GorgFleet,
SetLongRangeDir(s.this,JumpVector,0,0);
LongRangeArrive(S.this);
);

:end //end action

END //end rule

END //end state

END //end machine


END


ENTITIES

SHIP
Name "The Observer"
Race #race_Player
ShipType #Stype_F107_Dragon
Position 17964.2 1469.06 6201.78
Orientation 0 0 0
END

SHIP
Name "Raptor 1"
Race #race_Raptor
ShipType #styp_ep1_OSEC_Longsword_corvette
Position 12149.1 17999.1 -21419
Orientation 0 0 0
END

SHIP
Name "Raptor 2"
Race #race_Raptor
ShipType #styp_ep1_OSEC_Longsword_corvette
Position 12856.6 17999.1 -21772.8
Orientation 0 0 0
END

SHIP
Name "Raptor 3"
Race #race_Raptor
ShipType #styp_ep1_OSEC_Longsword_corvette
Position 12149.1 18706.6 -21772.8
Orientation 0 0 0
END

SHIP
Name "Raptor 4"
Race #race_Raptor
ShipType #styp_ep1_OSEC_Longsword_corvette
Position 11441.6 17999.1 -21772.8
Orientation 0 0 0
END

SHIP
Name "Gorg 2"
Race #race_Gorg_B
ShipType #styp_ep1_Kissaki_frigate
Position 587.514 0 -293.757
Orientation 0 0 0
END

SHIP
Name "Gorg 3"
Race #race_Gorg_B
ShipType #styp_ep1_Kissaki_frigate
Position -587.514 0 -293.757
Orientation 0 0 0
END

SHIP
Name "Gorg Lead"
Race #race_Gorg_B
ShipType #styp_ep1_Kissaki_frigate
Position 0 0 0
Orientation 0 0 0
END

END
--- End code ---

You'll probably need to tweak a few things here and there to get it to work in your script, but it should provide the answers...

The_Small_Time_Modder:
Thanks for the reply old dragon, each chunk of scripting i manage to finish for this mission im currently focusing on is making the mission all the better. I'll add in a modified version into my mission file.

I think i figured out how to alter the security though... i have yet to test it, but im about to anyway.

heres the code i put in...


--- Code: ---
M.Ship.0:=GetSceneObj("Paradise");
M.Ship.0:Damage:=55 ;
M.Ship.0:security:=0 ;

--- End code ---

That is of one of the vardrag ships i have in the current mission, by the way.
the damage coding i put in for it worked like a charm, so im sure the security would work as well... even though i have yet to test it.

Also, heres what the heck im doing in the mission, i have two vardrags ships (which are abandoned and damaged hull integrity wise, have yet to modify damage of devices). Im trying to make it so that you have to find the second one, called 'Atlantis' because it has intel on board of the location of a second gate in the arcturus (a custom one i made) system (i wanted to assign a secret to the Atlantis but i am unsure of wether to use an existing one or just make a whole new one specifically for this mission). the scene is in an asteroid field littered with a layer of vardrag and raptor ship debris. The SOS nav point i have in this mission is supposed to be not only a guide, but also in the script acts as a way for the raptors (which are hiding behind large asteroids) to spring a trap on the player's ships. Thanks to your coding above, i can now have the gorgs arrive in via IP drive to the scene, right where the player's ships started, the reason i added them in there is because they too want the location of the gate, so they can beat the player to the gate and the system it leads to. Unfortunately since Mularac has yet to find a way to put a gate in a standalone custom mission, i cannot add them in.

anyway i hope that got you and mularac up to pace as to the intentions of the mission im working on.

Also, is that actually part of a mission YOU created? That f107_Dragon type definitely isnt in the vanilla version of Nexus: TJI.

And on a side note, if i can fully complete ALL the SP setting missions i have, i might plan on linking them together into a sort of 'sequel campaign', like a nexus 1.5 if you will.

The_Small_Time_Modder:
Oh great... now the DIRECTOR machine isnt cooperating....

Heres what i got, reply back and highlight anything i need to replace/fill in.


--- Code: ---RULES

RULE event sceneInit
:action
SetSceneRadius(100000);

SetRelation(#race_player, #race_raptor, 2);
SetRelation(#race_raptor, #race_player, 2);
SetRelation(#race_vardrag, #race_player, 3);
SetRelation(#race_player, #race_vardrag, 3);
SetRelation(#race_vardrag, #race_raptor, 3);
SetRelation(#race_raptor, #race_vardrag, 3);
SetRelation(#race_player, #race_gorg, 2);
SetRelation(#race_gorg, #race_player, 2);
SetRelation(#race_vardrag, #race_gorg, 3);
SetRelation(#race_gorg, #race_vardrag, 3);
SetRelation(#race_raptor, #race_gorg, 2);
SetRelation(#race_gorg, #race_raptor, 2);

PShip.0 := GetSceneObj("Darkstar");
PShip.1 := GetSceneObj("Vanguard");
PShip.2 := GetSceneObj("Eringuard");
PShip.3 := GetSceneObj("Kings Arch");

R.Ship.0 := GetSceneObj("Highlander");
R.Ship.1 := GetSceneObj("Skirmisher");
R.Ship.2 := GetSceneObj("Stingray");
R.Ship.3 := GetSceneObj("Hellstorm");
R.Ship.4 := GetSceneObj("Ball");
R.Ship.5 := GetSceneObj("Chain");
R.Ship.6 := GetSceneObj("Assassin");
R.Ship.7 := GetSceneObj("Rambler");
R.Ship.8 := GetSceneObj("Baron");

G.Ship.1 := GetSceneObj("Argentum");
G.Ship.2 := GetSceneObj("Predator");
G.Ship.3 := GetSceneObj("Warmonger");
G.Ship.4 := GetSceneObj("Exile");
G.Ship.5 := GetSceneObj("Decay");

V.Ship.0:=GetSceneObj("Paradise");
V.Ship.0:Damage:=55 ;
V.Ship.0:security:=0 ;
V.Ship.1:=GetSceneObj("Atlantis");
V.Ship.1:Damage:=20 ;
V.Ship.1:security:=0 ;
V.Ship.1:secret:=0 ;
V.Ship.1:missingSecretPoints:=5000 ;

M.SOS:=GetSceneObj("SOS");
MakeFullyKnown(M.SOS);
FreezeReconState(M.SOS, 1);

Playmusic(22);

GetMachine("Director"):ChangeState(start, 0);
GetMachine("Objectives"):ChangeState(monitor, 0);
GetMachine("ATLANTIS_AI"):ChangeState(idle, 0);
GetMachine("GORG_AI"):ChangeState(battle, 0);
GetMachine("MAIN_AI"):ChangeState(start, 0);

M.GorgFleet:=GetFreeSel();
SelectShips(M.GorgFleet,S.race=#race_Gorg);

//Hide the Gorgs away...

ExecList(M.GorgFleet,HideShip(S.this));
Dump(M.GorgFleet);
END

MACHINE "Director"

STATE start

RULE event CO_HullLow
condition R.Ship:Race=#race_raptor
:action
Debug("Raptor Damaged");

R.ShipThreshhold:=2;

R.ShipCount:=GetFreeSel();
SelectShips(R.ShipCount, S.race=#race_raptor&S.this:Damage<50);
Dump(R.ShipCount);

IF(AllNumOf(R.ShipCount)<M.RaptorThreshold, LocalEvent(CallGorg));
:end
END

RULE event CallGorg
:action
JumpVector:=VNeg(R2Vec(M.GL:Orientation));

M.GorgFleet:=GetFreeSel();
SelectShips(M.GorgFleet, S.race=#race_gorg);

ExecList(M.GorgFleet,
SetLongRangeDir(S.this, JumpVector, 0, 0);
LongRangeArrive(S.this);
);
:end
END
END
END

#include "11_inner_ai.mach"
#include "11_default_obj.mach"
#include "11_default_ai.mach"
#include "11_music_ai.mach"
#include "11_gorg_ai.mach"
#include "11_atlantis_ai.mach"

END

--- End code ---

R.Ships = Raptor ships
PShips = Player ships (obviously)
G.Ships = Gorg Ships
V.Ships = Vardrag Ships
M.Ships = Other

Im guessing the spot where i put 'Orientation' needs to be replaced. Am i right?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version