Nexus Modding > Scripting

The AI and You

<< < (14/20) > >>

The_Small_Time_Modder:
OF COURSE!!! why didnt i see that?!?!   :o

Thanks a bunch for noticing that Old Dragon!  ;)

EDIT: AARRRGG!  >:(

the error STILL lives....

alright, thats it... heres the ENTIRE mission file (excluding asteroids)... all in one piece, HAVE AT IT BOYS!  :-X


--- Code: ---MISSION 11
Name "The Atlantis"
DefLocation "ASTFLD_ARCTURUS IID"

OBJECTIVES
1 // At least one ship must survive
2 // Eliminate any hostiles that encroach the area
3 // Search any derelict vessels or structures
4 // Investigate the 'Paradise' for intel
5 // Investigate the 'Atlantis' for Intel
END

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");

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

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

M.Ship.5:=GetSceneObj("Paradise");
M.Ship.5:Damage:=55 ;
M.Ship.5:security:=0 ;
M.Ship.6:=GetSceneObj("Atlantis");
M.Ship.6:Damage:=20 ;
M.Ship.6:security:=0 ;

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
END
END

MACHINE "Director"

STATE start

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

E.ShipThreshhold:=4;

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

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

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

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

ExecList(M.GorgFleet,
SetLongRangeDir(S.this, JumpVector:-7892.72, 5615.88, -22831.7);
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


ENTITIES

SHIP
Name "Eringuard"
Race #race_Player
Class #cls_Cruiser
Position -6338.39 7170.22 -20331.7
Orientation 0 0 0
Devices #weap_eShell3 #weap_eShell3 #weap_heLaser3 #weap_heLaser3 #weap_plasma3 #weap_plasma3 #weap_flak3 #weap_flak3 #shld_v_c125/125 #eng_bAmatEng #eng_secPlasEng #eng_mjumpDrive #eng_comDrive #supp_ecm2 #supp_eccm2 #supp_mSGen3 #supp_mSGen3 #supp_res4 #supp_res4 #supp_res4 #supp_longRange #supp_cWGen3 #weap_aFighter #weap_aFighter #weap_aFighter ;
END

SHIP
Name "Vanguard"
Race #race_Player
Class #cls_Cruiser
Position -7892.72 5615.88 -20331.7
Orientation 0 0 0
Devices #weap_eShell3 #weap_eShell3 #weap_heLaser3 #weap_heLaser3 #weap_plasma3 #weap_plasma3 #weap_flak3 #weap_flak3 #shld_v_c125/125 #eng_bAmatEng #eng_secPlasEng #eng_mjumpDrive #eng_comDrive #supp_ecm2 #supp_eccm2 #supp_mSGen3 #supp_mSGen3 #supp_res4 #supp_res4 #supp_res4 #supp_longRange #supp_cWGen3 #weap_aFighter #weap_aFighter #weap_aFighter ;
END

SHIP
Name "Kings Arch"
Race #race_Player
Class #cls_Battleship
Position -6338.39 5615.88 -19554.5
Orientation 0 0 0
Devices #weap_gh_heLaser #weap_gh_heLaser #weap_plasma3 #weap_plasma3 #weap_plasma3 #weap_plasma3 #weap_eTorp #weap_eTorp #weap_sigLaser #weap_flak3 #weap_flak3 #shld_v_c125/125 #eng_bAmatEng #eng_secPlasEng #eng_acomDrive #eng_mjumpDrive #supp_ecm2 #supp_eccm2 #supp_bSGen3 #supp_bSGen3 #supp_mSGen3 #supp_res4 #supp_res4 #supp_res4 #supp_res4 #supp_res4 #supp_res4 #supp_bWGen3 #weap_aFighter #weap_aFighter #weap_aFighter #weap_aFighter ;
END

SHIP
Name "Darkstar"
Race #race_Player
Class #cls_AngelwingM
Position -4784.05 5615.88 -20331.7
Orientation 0 0 0
Devices #weap_eShell3 #weap_eShell3 #weap_gh_heLaser #weap_gh_heLaser #weap_plasma3 #weap_plasma3 #weap_flak3 #weap_flak3 #weap_angels_mecha #shld_v_c125/125 #eng_bAmatEng #eng_secPlasEng #eng_ucomDrive #supp_ecm2 #supp_eccm2 #supp_mSGen3 #supp_sensor #supp_res4 #supp_res4 #supp_res4 #supp_longRange #supp_cWGen3 #weap_marine #weap_aFighter #weap_aFighter ;
END

SHIP
Name "Ball"
TechCat 21 20
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Hunter
Position -3603.25 5287.34 19509.6
Orientation -178.2 22.0841 -7.04962
END

SHIP
Name "Chain"
TechCat 21 20
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Hunter
Position -3789.32 5280.72 19544
Orientation -177.718 23.0759 2.27053
END

SHIP
Name "Highlander"
TechCat 21 20
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Hunter
Position -18226.1 11036.3 25970.8
Orientation -98.1635 -5.24808 -15.8153
END

SHIP
Name "Skirmisher"
TechCat 21 20
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Hunter
Position -18094.5 11081.7 26147.3
Orientation -98.1635 -5.24808 -15.8153
END

SHIP
Name "Assassin"
TechCat 21 30
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Killer
Position -1058.6 21567.8 24387.7
Orientation -114.473 -26.0238 -56.4949
END

SHIP
Name "Hellstorm"
TechCat 21 30
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Killer
Position 12457.9 10486.4 15584
Orientation 119.146 -10.0708 -2.43697
END

SHIP
Name "Rambler"
TechCat 21 30
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Killer
Position -1007.56 21740.1 24592.4
Orientation -114.014 -51.5109 -55.456
END

SHIP
Name "Stingray"
TechCat 21 30
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Killer
Position 12469.3 10476 15331.1
Orientation 119.146 -10.0708 -2.43697
END

SHIP
Name "Baron"
TechCat 21 40
TechPointsScanned 0
Race #race_Raptor
ShipType #styp_ep2_Master
Position -24736.8 12269.3 13453.2
Orientation -39.2563 -13.9692 -6.39179
END

SHIP
Name "Decay"
TechCat 31 20
TechPointsScanned 0
Race #race_Gorg
Class #cls_gorg_Destroyer
Position -6138.48 3237.42 -907.067
Orientation -179.136 0.585114 0.68406
Devices #weap_g_liLaser #weap_g_liLaser #weap_g_heLaser #weap_g_eShell #weap_g_flak #shld_g_s123/123 #eng_sPlasEng #eng_secPlasEng #eng_tacDrive #supp_ecm #supp_eccm #supp_sSGen #supp_sensor #supp_ipblocker #supp_res #supp_res #supp_res #supp_longRange #supp_tWGen ;
END

SHIP
Name "Exile"
TechCat 31 20
TechPointsScanned 0
Race #race_Gorg
Class #cls_gorg_Destroyer
Position -6102.67 6275.68 -875.467
Orientation -179.136 0.585114 0.68406
Devices #weap_g_liLaser #weap_g_liLaser #weap_g_heLaser #weap_g_eShell #weap_g_flak #shld_g_s123/123 #eng_sPlasEng #eng_secPlasEng #eng_tacDrive #supp_ecm #supp_eccm #supp_sSGen #supp_sensor #supp_ipblocker #supp_res #supp_res #supp_res #supp_longRange #supp_tWGen ;
END

SHIP
Name "Predator"
TechCat 31 20
TechPointsScanned 0
Race #race_Gorg
Class #cls_gorg_Cruiser
Position -4601.53 4738.41 -868.567
Orientation -179.136 0.585114 0.68406
Devices #weap_g_liLaser #weap_g_liLaser #weap_g_liLaser #weap_g_heLaser #weap_g_heLaser #weap_g_heLaser #weap_g_flak #weap_g_flak #shld_g_b123/123 #eng_bPlasEng #eng_secPlasEng #eng_comDrive #supp_ecm #supp_eccm #supp_mSGen #supp_sensor #supp_res #supp_res #supp_res #supp_longRange #supp_cWGen ;
END

SHIP
Name "Warmonger"
TechCat 31 20
TechPointsScanned 0
Race #race_Gorg
Class #cls_gorg_Cruiser
Position -7639.62 4774.69 -913.967
Orientation -179.136 0.585114 0.68406
Devices #weap_g_liLaser #weap_g_liLaser #weap_g_liLaser #weap_g_heLaser #weap_g_heLaser #weap_g_heLaser #weap_g_flak #weap_g_flak #shld_g_b123/123 #eng_bPlasEng #eng_secPlasEng #eng_comDrive #supp_ecm #supp_eccm #supp_mSGen #supp_sensor #supp_res #supp_res #supp_res #supp_longRange #supp_cWGen ;
END

SHIP
Name "Argentum"
TechCat 31 30
TechPointsScanned 0
Race #race_Gorg
Class #cls_gorg_Battleship
Position -6109.12 4764.31 -1650.77
Orientation -179.136 0.585114 0.68406
Devices #weap_g_heLaser #weap_g_heLaser #weap_g_plasma #weap_g_plasma #weap_g_plasma #weap_g_plasma #weap_g_eTorp #weap_g_eTorp #weap_g_flak #weap_g_flak #shld_g_b123/123 #eng_bPlasEng #eng_secPlasEng #eng_comDrive #supp_ecm #supp_eccm #supp_bSGen #supp_sensor #supp_res #supp_res #supp_res #supp_res #supp_res #supp_res #supp_longRange #supp_bWGen ;
END

SHIP
Name "Paradise"
TechCat 61 50
TechPointsScanned 0
Race #race_Vardrag
Class #cls_var_CityShip
Position -2069.99 3914.59 21530.5
Orientation 179.866 3.32864 39.832
END

SHIP
Name "Atlantis"
TechCat 61 25
TechPointsScanned 0
Race #race_Vardrag
Class #cls_var_Multi
Position 12026.7 5357.2 61686.2
Orientation -115.552 -22.225 43.9163
END

SHIP
Name "SOS"
Class #Navigation_Point
Behaviour 5
Color 2 2 0
Position -5407.25 5181.96 10249.5
Orientation 0 0 0
END

--- End code ---

I also forgot to mention something, How is it that you get an error if you copy the NPC of a ship from one mission to a similar ship on another mission? Perhaps a bug in the system? ive done this with some other things and it works completely fine...

Mularac:
Could you just rar your entire mod and upload it somewhere?
At this point I think that the only way we can hunt down that bug is if we know everything about your mod.

EDIT: Nevermind, found the error.

You've ended your Sceneinit rule with two ends, basically ending the RULES block with it.

it should be:

--- Code: ---RULES
RULE event SceneInit
:action
<... etc ...>
:end
END

MACHINE "Director"
<... etc ...>

--- End code ---

The_Small_Time_Modder:
BINGO!!!!!  :D

that was the problem right there!!!!

Thanks a bunch mularac!  ;D

ill reply back again as soon as i asses how the mission runs...  ;)

The_Small_Time_Modder:
Ok, now i ran into an odd problem...

the mission works fine now... but the gorg ships, EVEN THOUGH YOU CANT SEE THEM, are shooting lasers at my ships, i have them right behind the player's ships... should i move them further back, or is there a way to prevent this from happening?

Edit: Nevermind, managed to fix it myself, just had to put the GetMachine code that recalls the GORG_AI into the coding that calls for the jump arrival of the gorg fleet.

The_Small_Time_Modder:
Now another problem.... the gorgs wont jump in!  >:(

heres what i have that calls the event....


--- Code: ---RULE event CallGorg
:action
JumpVector:=VNeg(R2Vec(M.Ship.0:Orientation));

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

ExecList(M.GorgFleet,
SetLongRangeDir(S.this, JumpVector:-7892.72, 5615.88, -22831.7);
LongRangeArrive(S.this);
GetMachine("GORG_AI"):ChangeState(battle,0);
);
:end

--- End code ---

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version