Nexus Modding > Scripting
The AI and You
The_Small_Time_Modder:
Laugh out loud... XD
Hey, i just tested the 'Area activates AI' coding you provided for me earlier.
MACHINE "INNER_AI"
STATE Start
RULE event in
:action
SetAreaAbs(0, <-4000> , <-1000> , <-500> , <2250>);
//We declare here the areas in the scene.
:end
END
//For example, we want to boot the ai when one of the players ships reach the 0 area
RULE event AreaEntered
condition e.ship:race=#race_player&e.area=0
:action
M:GetMachine("INNER_AI"):ChangeState(Battle,
e.ownMachine := M:GetMachine("INNER_AI");
e.oRace := #race_raptor;
e.oRaceList := -1;
e.oShipList := -1;
e.eRace := #race_player;
e.eRaceList := -1;
e.eShipList := -1;
e.parentMachine := M:GetMachine("AI");
);
//Simple declaration of the AI, this will make the raptor ships launch towards the player ships.
:end
END
END
END
MACHINE "INNER_AI"
#include "default_ai.mach"
END
For some reason my finiky copy thinks what i put in red for you doesn't exist, what i put in lime green is what i predict it also thinks doesnt exist, any ideas?
Edit: The battleship i tried to code to be capturable wasnt a wreck, it was simply sitting there, like a sleeping duck, if you want to call it that ;)
Mularac:
Couple of things: you have two machines that are named the same, check that.
Also, you wrote this:
SetAreaAbs(0, <-4000> , <-1000> , <-500> , <2250>);
I put the "<,>" in my example to say what you were supposed to put in them, they don't have to be there!
It should be like this:
SetAreaAbs(0, -4000 , -1000, -500 , 2250);
The "<,>" are comparators, for example, putting 2>3 will return 0, and 4<8 will return 1. They are used in conditions and ifs
The_Small_Time_Modder:
OH....
whoops! ::)
my bad, i guess i shouldnt have put them there in the first place.
Ill take 'em off and try again, thanks for clearing that up man. ;)
Edit: ok, thats been fixed, i also fixed the #include code (i didnt specify for which mission's AI i wanted to include, easy fix). But now its saying that the 11_default_ai.mach has an invalid keyword, and of all of the things it picked, it picked the very first word MACHINE. I hate how it somehow comes up with random errors like that. >:(
Mularac:
Can you give us some context?
where in the .mission file did you include the 11_default_ai.mach file? can you give us a short description of where each file is located and the contents of each?
The_Small_Time_Modder:
Sure Mularac...
heres the top section of the .mission file....
MISSION 11
Name "The Atlantis"
DefLocation "ASTFLD_ARCTURUS IID" ((this is part of a custom system i made, one of three, the other two are Ouroboros and Nexor, after the games name, Nexus ;) ))
OBJECTIVES
1
2
END
RULES
RULE event sceneInit
:action
SetSceneRadius(100000);
SetRelation(#race_player, #race_raptor, 2);
SetRelation(#race_raptor, #race_player, 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");
Playmusic(21);
GetMachine("Director"):ChangeState(IntroMovie, 0);
GetMachine("Objectives"):ChangeState(monitor,0);
GetMachine("AI"):ChangeState(battle,0);
GetMachine("ATLANTIS_AI"):ChangeState(idle,0);
:end
END
MACHINE "Director"
STATE IntroMovie
RULE event In
:action
:end
END
END
END
#include "11_default_obj.mach"
#include "11_default_ai.mach"
#include "11_atlantis_ai.mach"
#include "11_inner_ai.mach"
END
I let the explorer (the program used to look into files on your computer) order them all alphebetically in the missions file of the Skirmisher SP settings, here it is in a list... (exactly as it is in the folder)
11_atlantis_ai.mach (this AI controls the single vardrag explorer in the scene)
11_default_obj.mach (this is what the Skirmisher put in)
11_inner_ai.mach (The area activated AI that you suggested)
11_The Atlantis.mission (the file partly shown above)
Does that help you? ???
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version