Nexus Modding > Scripting
The AI and You
The_Small_Time_Modder:
heres the file your asking for.
--- Code: ---//Basic objective structure:
//mission terminates, if either one of the two sides has no ships left
MACHINE "Objectives"
//main STATE
//majority of code is executed here
STATE monitor
RULE event In
:action
//OBJECTIVE INITIALISATION
//make sure, that both objectives are counted as "primary objectives"
SetObjectivePrimary(1, 1);
SetObjectivePrimary(2, 1);
//make sure, that both objectives are counted as "uncompleted"
MissionObjective(1,#OBJECTIVE_UNCOMPLETED);
MissionObjective(2,#OBJECTIVE_UNCOMPLETED);
:end
END
//the even FatalDamaged gets executed every time, a ship is being evacuated or even destroyed
RULE event FatalDamaged
//it is only executed, if the FatalDamaged ship is a player ship
condition E.ship:race=#race_player
:action
//Selects all player ships
SelectShips(1, s.race=#race_player);
//IF there are no player ships left
//THEN change STATE to Mission_failed
If(AllNumOf(1)=0, ChangeState(Mission_failed,0));
:end
END
//the even FatalDamaged gets executed every time, a ship is being evacuated or even destroyed
RULE event FatalDamaged
//it is only executed, if the FatalDamaged ship is an enemy ship
condition E.ship:race=#race_raptor
:action
//Selects all enemy ships
SelectShips(2, s.race=#race_raptor);
//IF there are no enemy ships left
//THEN change STATE to Mission_won
If(AllNumOf(2)=0, ChangeState(Mission_won,0));
:end
END
END //STATE monitor
STATE Mission_failed
RULE event In
:action
//Show a "Mission_lost" title
Title(0,0,0,"Mission_lost");
//Set both objectives to "failed"
MissionObjective(1, #OBJECTIVE_FAILED);
MissionObjective(2, #OBJECTIVE_FAILED);
//wait 10 seconds before quitting the mission
Delay(0,10,uQuitMission(0),0);
:end
END
END //STATE Mission_failed
STATE Mission_won
RULE event In
:action
//Show a "Mission_won" title
Title(0,0,0,"Mission_won");
//Set both objectives to "completed"
MissionObjective(1, #OBJECTIVE_COMPLETED);
MissionObjective(2, #OBJECTIVE_COMPLETED);
//wait 10 seconds before quitting the mission
Delay(0,10,uQuitMission(1),0);
:end
END
END //STATE Mission_won
END //MACHINE "Objectives"
--- End code ---
I hope im giving you the information thats helping you out man. I also appreciate you taking time to reply to my posts on here, for which i applaud you. :D
EDIT: i also want to say i havent touched this file either, though i plan to soon, again with your assistance, if able... ;)
The_Small_Time_Modder:
OH WAIT A SECOND.... :o
When you were talking about this...
--- Quote ---Couple of things: you have two machines that are named the same, check that.
--- End quote ---
did you mean this part? if so i didnt change that! :o
--- Code: ---MACHINE "INNER_AI"
#include "default_ai.mach"
END
--- End code ---
That may be the problem right there! :D
Mularac:
Try changing the name of that machine to something else.
And if that doesn't work, I'm gonna have to see the content of the default_ai.mach file.
The_Small_Time_Modder:
Do you have any suggestions/reccomendations as to what i should name it? Im thinking SECONDARY_AI...
Mularac:
I would leave that as Inner_AI (as it is, in fact, an inner ai) and name the upper one to MAIN_AI or RAPTOR_AI
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version