Slavers_are_scum.oxp

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Slavers_are_scum.oxp

Post by Cmdr. Maegil »

I wouldn't work with conditions at all in an AI. I'm not even sure it's possible. At least AFAIK there is no AI like this out there.
I seem to recall scripting in an AI...or rather a shipdata.plist's *_actions section, it involves calling the method 'performScriptAction' <array> IIRC.
However generally using script in the AI is not recomended as this only updates every 'somany' seconds.
I think this may be a case of "nonconformist newcomer prooves that the Earth is round"... Is it really impossible to use conditions in the AI.plist or simply never tried before, thus believed to be impossible?

Maybe because of old habits, programming without conditions feels akward... especially in an AI...
What you want to do can be achieved much easier with the usual set of AI methods. You just have to define three states instead of your single state and roll between them.

So: first state "IDENTIFY_SLAVER" has "scanForNearestShipWithRole: slaver" in the ENTER-part. Then it needs a "TARGET_FOUND" with whatever you want to do to that target, e.g. setTargetToFoundTarget, "commsMessage: ...". Then it needs a "NOTHING_FOUND", which serves as the else-part of your condition and contains a "setStateTo: IDENTIFY_POLICE".
EDIT:scanForNearestShipWithRole: won't do as the point is to identify who's shooting and send the proper reply. It would be all right for the most part, but when it returns the final scan returns "NOTHING_FOUND", it would simply take no action against a non slaver/pirate/police hostile.

So far I've C&Pd the shipdata and characters form renegades.oxp, written the descriptions and am currently tinkering with the AI.

My idea is this:
Create 1~3 slavers in the system (script, I know)
Seek and destroy the slavers, and engage any pirates found along the way while looking for slavers.
When fighting a slaver, comm any attackers without changing target. If no slaver is around, dish out the usual way. With the method suggested by CmL, i'd have to prioritize the targets and engage them in order (1-slavers, 2-pirates, 3-other attackers and 4-police), which may not be a bad idea.
Have different messages for each of the four types of attacker
When out of slavers, sunskim keeping the same Rules of Engagement :wink: and exit.

Now for the real fun part on the script:
As a death action, eject a pod and a crate of computers.
If the crate is captured or destroyed, funny things :twisted: would happen when the player docked (I'll PM LB, AH and CmL in due time for advice as I really don't want to scare you give spoilers yet - or even know if what I want is possible).
The pod being destroyed, captured or left alone would alter the funny things to different outcomes.


As for the Spartacus Brotherhood, I won't even think about that for now...
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2882
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

Proabley the simplest way would be to have a general "Attack Ship" state like this:-

Code: Select all

{
"ATTACK_SHIP" = {
        ENTER = (performAttack); 
        "ATTACKED" = (setTargetToPrimaryAggressor); 
        "ENERGY_LOW" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP");
        "TARGET_DESTROYED" = ("commsMessage: [erebel-chat]", "setStateTo: LOOK_FOR_TARGETS"); 
        "TARGET_LOST" = ("commsMessage: [erebel-chat]", "setStateTo: LOOK_FOR_TARGETS"); 
        EXIT = (); 
	  UPDATE = (performAttack); 
     };
This general attack ship makes the ship fight to the death, but if you wanted to make him a bit more senisble, you could have Energy Low switch to a run away state or a witch space out state.

To make him select targets have some look for targets states like this:-

Code: Select all

"LOOK_FOR_TARGETS" = {
ENTER = ("scanForNearestShipWithRole: imperial");
        "ATTACKED" = (setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile, setTargetToPrimaryAggressor, "setStateTo: ATTACK_SHIP"); 
		"TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ATTACK_SHIP"); 
        	"NOTHING_FOUND" = ("setStateTo: LOOK_FOR_TARGETS2"); 
EXIT = ();
	UPDATE = ("scanForNearestShipWithRole: imperial");
	};
Look for Targets2 would just be a C&P with the role of the next priory target.

I'd have a look at the native pirateAI as well, as there's lots of cool states (like scan for loot and witchspace out) there that could be C&Ped in. EG if no targets are found, you might want to have him scoop up the liberated slaves!

By having the ATTACKED in all states means he will respond to an attack by a ship that isn't one of his prefered targets (like the player or an NPC bounty hunter), even when he is fighting a target or looking for them.

I'd define him in shipdata but give him a unique role. That way he'll only be added when your script specificaly calls him. Eg if you want to use the Renegade Asp. Then C&P its entry (and also the sub-entries it uses) into Shipdata:-

Code: Select all

<key>hardasp</key>
  <dict>
	<key>aft_eject_position</key>
	<string>0.0 -8.0 -21.5</string>			
	<key>cargo_type</key>
	<string>CARGO_NOT_CARGO</string>
	<key>cargo_carried</key> 
	<string>Gold</string>	
	<key>energy_recharge_rate</key>
	<real>4.5</real>
	<key>exhaust</key>
	<array>
	<string>0.0 0.0 -35.0 8.0 6.0 8.0</string>
	</array>
	<key>likely_cargo</key>
	<integer>3</integer>
	<key>max_cargo</key>
	<integer>5</integer>
	<key>max_energy</key>
	<real>400</real>
	<key>max_flight_pitch</key>
	<real>1</real>
	<key>max_flight_roll</key>
	<real>2</real>
	<key>max_flight_speed</key>
	<real>420</real>
	<key>max_missiles</key>
	<integer>1</integer>
	<key>missile_launch_position</key>
	<string>0.0 -5.9 17.5</string>
	<key>missiles</key>
	<integer>1</integer>		
	<key>thrust</key>
	<real>50</real>
	<key>view_position_aft</key>
	<string>0.0 5.0 -35.0</string>
	<key>view_position_forward</key>
	<string>0.0 5.31 17.5</string>
	<key>view_position_port</key>
	<string>-27.0 5.0 0.0</string>
	<key>view_position_starboard</key>
	<string>27.0 5.0 0.0</string>
	<key>weapon_position_aft</key>
	<string>0.0 -5.0 -35.0</string>
	<key>weapon_position_forward</key>
	<string>0.0 0.0 22.5</string>
	<key>weapon_position_port</key>
	<string>-32.5 0.0 -7.0</string>
	<key>weapon_position_starboard</key>
	<string>32.5 0.0 -7.0</string>
	<key>subentities</key>
	<array>
	<string>greengun		5.0 0.0 22.5		1 0 0 0</string>
	<string>bluegun			1.0 0.0 22.5		1 0 0 0</string>
	<string>cyangun			-5.0 0.0 22.5		1 0 0 0</string>
	<string>yellowturret		-32.5 0.0 -7.0		1 0 0 0</string>
	<string>yellowturret		32.5 0.0 -7.0		1 0 0 0</string>
	</array>		
	<key>bounty</key>
	<integer>950</integer>
	<key>model</key>
	<string>asp_redux.dat</string>
	<key>has_shield_booster</key>
	<real>1.0</real>
	<key>has_shield_enhancer</key>
	<real>1.0</real>
	<key>has_energy_unit</key>
	<real>1.0</real>
	<key>has escape_pod</key>
	<real>1.0</real>
	<key>has_fuel_injection</key>
	<real>1.0</real>
	<key>fuel</key>
	<integer>5</integer>
	<key>has_ecm</key>
	<true/>
	<key>has_scoop</key>
	<real>1.0</real>
	<key>missile_role</key>
        <string>EQ_HARDENED_MISSILE</string>				
	<key>roles</key>
	<string>hardpirate</string>
	<key>name</key>
	<string>Renegade Asp Mark II</string>
	<key>forward_weapon_type</key>
	<string>WEAPON_NONE</string>
	<key>aft_weapon_type</key>		
	<string>WEAPON_MILITARY_LASER</string>
	<key>port_weapon_type</key>
	<string>WEAPON_NONE</string>
	<key>starboard_weapon_type</key>
	<string>WEAPON_NONE</string>						
	<key>laser_color</key>
	<string>magentaColor</string>	
	<key>ai_type</key>
	<string>hardpirateAI.plist</string>
	<key>smooth</key>
	<true/>
	<key>unpiloted</key>
	<false/>
	<key>pilot</key> 
	<string>hard_pirate13</string>
	<key>death_actions</key>
	<array>
	<string>commsMessage: [renegade-threat]</string>
	<string>spawn: EQ_QC_MINE 1</string>
	</array>		
	</dict>
Then change the entry, name, role, AI etc. You'll need to copy the entries for the sub-entries into your shipdata and also the models and textures for the Big Guns bolted to the sides and the Tri-lasers at the front![/code]
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

Doesn't "scanForNearestShipWithRole" need to have a range defined to find the ships on the system?
From what I read on the wiki, its default is only the scanner's range.
use the Renegade Asp. Then C&P its entry (and also the sub-entries it uses) into Shipdata:-
I did, thanks
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2882
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

Don't think you need to put in a range, but it will only find the ships the ship can see on its scanner. The check for ships does return how many ships are in the system, but I don't think the ship can attack them if they are out of scanner range. You can increase the scanner range from 25km to any value you want though in shipdata. So if you set it to somthing silly like 999999, then I guess he would spot any ships in the system however far away they are.

If you want to make it a bit more realistic, another way to make the ship hunt down targets, after the various Look for Targets, scoop loot etc, scan for offences etc states put in a general "Head_for_planet" state. That way, the ship will check to see if they are any targets on scanner or loot to be scooped around. If so it attacks or scoops the loot. Have the final "doing stuff" state set to a "Head for planet" state if no target is found.

That way if there is nothing to do, the ships heads towards the planet, rescanning as it goes for stuff to do. So if there are some slavers in the space lane 50km for the w/s beacon when the ship enters the system from hyperspace, at first it doesn't see them the state goes to check for pirates, if found attacks if not check for police etc. Once there are no living interesting targets in scanner range, the ship heads for the planet and keeps doing so until the slavers come in range. Then it attacks. (This is basically how the native ThargoidAI works, although it just looks for anything that is not a Thargoid to attack.)
Last edited by LittleBear on Tue Jun 05, 2007 7:30 pm, edited 1 time in total.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

This is the current state.
The maegilscoopAI will be a sun scoop AI with this modified combat behaviour. Maybe the GLOBAL state could help, but I don't know what it does...

Comments, suggestions and corrections are welcome.

Code: Select all

"HEAD_FOR_PLANET" = 
{
	ENTER = (setCourseToPlanet, "setDesiredRangeTo: 80000.0", checkCourseToDestination);
	"COURSE_OK" = ("setSpeedFactorTo: 1.0", performFlyToRangeFromDestination);
	"WAYPOINT_SET" = ("setAITo: gotoWaypointAI.plist");
	"DESIRED_RANGE_ACHIEVED" = ("setAITo: maegilscoopAI");
        ATTACKED = (fightOrFleeHostiles, "setStateTo: ID_HOSTILE1"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile,"setStateTo: ID_HOSTILE1"); 
        "TARGET_FOUND" = (setTargetToFoundTarget, "setStateTo: ID_HOSTILE1"); 
	EXIT = ();
UPDATE = (setCourseToPlanet, "setDesiredRangeTo: 80000.0", checkCourseToDestination, "scanForNearestShipWithRole: slaver, pirate", "pauseAI: 1.0");
}; 

"ID_HOSTILE1" = 
{
	ENTER = ("scanForNearestShipWithRole: slaver");
	"NOTHING_FOUND" = ("setStateTo: ID_HOSTILE2");
        "ATTACKED" = (fightOrFleeHostiles); 
        "INCOMING_MISSILE" = (fightOrFleeMissile);
        "ENERGY_LOW" = ("commsMessage: [maegil-plea]", "setStateTo: FLEE");
	"TARGET_FOUND" = (fightOrFleeHostiles, setTargetToFoundTarget, "commsMessage: [maegil-mark]", ATTACK_SLAVER); 
        "TARGET_DESTROYED" = ("commsMessage: [maegil-victory]"); 
        "TARGET_LOST" = ("setStateTo: HEAD_FOR_PLANET"); 
	EXIT = ();
UPDATE = ("scanForNearestShipWithRole: slaver");
}; 

"ATTACK_SLAVER" = {
        ENTER = (performAttack);
        "ATTACKED" = (fightOrFleeHostiles, "commsMessage: [maegil-nuisance]"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile, "commsMessage: [maegil-nuisance]");
        "ENERGY_LOW" = ("commsMessage: [maegil-plea]", "setStateTo: FLEE");
        "TARGET_DESTROYED" = ("commsMessage: [maegil-victory]", "setStateTo: ID_HOSTILE1"); 
        "TARGET_LOST" = ("setStateTo: ID_HOSTILE1"); 
        EXIT = ();
UPDATE = (performAttack);
}; 

"ID_HOSTILE2" = 
{
	ENTER = ("scanForNearestShipWithRole: pirate");
	"NOTHING_FOUND" = ("setStateTo: ID_HOSTILE3");
        "ATTACKED" = (fightOrFleeHostiles, "commsMessage: [maegil-nuisance], "setStateTo: ID_HOSTILE1"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile, "commsMessage: [maegil-nuisance], "setStateTo: ID_HOSTILE1"); 
        "ENERGY_LOW" = ("commsMessage: [maegil-plea]", "setStateTo: FLEE");
	"TARGET_FOUND" = (fightOrFleeHostiles, setTargetToFoundTarget, "commsMessage: [maegil-pirate]", performAttack); 
        "TARGET_DESTROYED" = ("setStateTo: ID_HOSTILE1"); 
        "TARGET_LOST" = ("setStateTo: ID_HOSTILE1"); 
	EXIT = ();
UPDATE = ("scanForNearestShipWithRole: pirate");
}; 

"ID_HOSTILE3" = 
{
	ENTER = ("scanForNearestShipWithRole: police");
	"NOTHING_FOUND" = ("setStateTo: ID_HOSTILE4");
        "ATTACKED" = (fightOrFleeHostiles, "setStateTo: ID_HOSTILE1"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: ID_HOSTILE1"); 
        "ENERGY_LOW" = ("commsMessage: [maegil-plea]", "setStateTo: FLEE");
	"TARGET_FOUND" = (fightOrFleeHostiles, setTargetToFoundTarget, "commsMessage: [maegil-police]", "setStateTo: ATTACK_SHIP"); 
        "TARGET_DESTROYED" = ("setStateTo: ID_HOSTILE1"); 
        "TARGET_LOST" = ("setStateTo: ID_HOSTILE1"); 
	EXIT = ();
UPDATE = ("scanForNearestShipWithRole: police");
}; 

"ID_HOSTILE4" = 
{
	ENTER = (scanForHostiles);
	"NOTHING_FOUND" = ("setStateTo: SCOOP_SURVIVORS");
        "ATTACKED" = (fightOrFleeHostiles, "setStateTo: ID_HOSTILE1"); 
        "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: ID_HOSTILE1"); 
        "ENERGY_LOW" = ("commsMessage: [maegil-plea]", "setStateTo: FLEE");
	"TARGET_FOUND" = (fightOrFleeHostiles, setTargetToFoundTarget, "commsMessage: [maegil-threat]", "setStateTo: ATTACK_SHIP"); 
        "TARGET_DESTROYED" = ("setStateTo: ID_HOSTILE1"); 
        "TARGET_LOST" = ("setStateTo: ID_HOSTILE1"); 
	EXIT = ();
UPDATE = (scanForHostiles);
}; 

"ATTACK_SHIP" = 
{
        ENTER = (performAttack);
	"ATTACKED" = (fightOrFleeHostiles, "setStateTo: ID_HOSTILE1");
        "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: ID_HOSTILE1");
        "ENERGY_LOW" = ("commsMessage: [maegil-plea]", "setStateTo: FLEE");
        "TARGET_DESTROYED" = ("commsMessage: [maegil-victory]", "setStateTo: ID_HOSTILE1"); 
        "TARGET_LOST" = ("setStateTo: ID_HOSTILE1"); 
        EXIT = ();
UPDATE = (performAttack);
}; 

"SCOOP_SURVIVORS" = 
{
	ENTER = ("scanForNearestShipWithRole: slave");
	"TARGET_FOUND" = (setTargetToFoundTarget , "setAITo: collectLootAI");
	"NOTHING_FOUND" = ("setStateTo: HEAD_FOR_PLANET");
	"ATTACKED" = (fightOrFleeHostiles, "setStateTo: ID_HOSTILE1");
        "INCOMING_MISSILE" = (fightOrFleeMissile, "setStateTo: ID_HOSTILE1");
        "ENERGY_LOW" = ("commsMessage: [maegil-plea]", "setStateTo: FLEE");
        EXIT = ();
UPDATE = ("scanForNearestShipWithRole: slave");
}; 

FLEE = {
	"ENERGY_FULL" = ("setStateTo: LOOK_FOR_SLAVER"); 
	"TARGET_LOST" = ("setStateTo: LOOK_FOR_SLAVER"); 
        "TARGET_DESTROYED" = ("setStateTo: LOOK_FOR_SLAVER"); 
	ENTER = (performFlee); 
        EXIT = ();
        "ATTACKED" = (fightOrFleeHostiles, "setStateTo: FLEE");
        "INCOMING_MISSILE" = (fightOrFleeMissile, "commsMessage: [maegil-plea]", "setStateTo: EXIT_SYSTEM"); 
        "ENERGY_LOW" = ("commsMessage: [maegil-plea]", "setStateTo: EXIT_SYSTEM");
        UPDATE = (); 
	}; 
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2882
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

Looks good! 8)

BTW heres are really simply testship.oxp that I use a lot testing ships AIs.

Just make a folder called testship.oxp. In this make a folder called Config. In this save the below as a script.plist

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict> 
   <key>testship</key> 
   <array> 
      <dict> 
         <key>conditions</key> 
         <array> 
            <string>status_string equal STATUS_EXITING_WITCHSPACE</string> 
         </array> 
         <key>do</key> 
         <array> 
	   <string>addShipsWithinRadius: Maegil 1 wpm 0 0 4000 10000</string>
	   <string>addShipsWithinRadius: slaver 1 wpm 0 0 4000 10000</string>
	   <string>addShipsWithinRadius: pirate 2 wpm 0 0 4000 10000</string>
         </array> 
      </dict> 
   </array> 


</dict> 
</plist>
This puts the ships with the role specified within 10km of the witchspace beacon every time you make a hyperspace jump. Then just watch em to see that they are doing what you mean them to. :wink:

Just change the roles or add more with <string> </string> so you can see how they behave.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

There is really no need to scanfor and attack police, if you have a bounty on your head or (il)legal status , they will attack regardless.
They will also respond to distresscalls from slavers honest traders and attack you.
Riding the Rocket!
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

Arexack_Heretic wrote:
There is really no need to scanfor and attack police, if you have a bounty on your head or (il)legal status , they will attack regardless.
They will also respond to distresscalls from slavers honest traders and attack you.
If I don't use it, the AI will just use the scanForHostiles and Maegil won't express his indignation for the police being against him.

Code: Select all

<key>maegil-police</key>
	<array>
	<string>You should be HELPING me! I'm with the GOOD guys!<string>
	<string>The LAW may be corrupt, but JUSTICE shall prevail!</string>
	<string>Heey! Are you blind? We're supposed to be on the same side!</string>
	<string>WHAT do you think you are doing?!</string>
	<string>Can you deny that the Ooniverse is better off without that slavist scum?</string>
	<string>I can't believe this attitude! I was only cleaning up after you people!</string>
	<string>Don't try to stop me! I'm the messenger to Heaven's righteous wrath!</string>
	<string>Hey! I'm the guy who cleans the dirt that falls through YOUR legal loopholes!</string>
	<string>You cannot stop me. TENCHU cannot be swayed!</string>
	<string>Heaven's punishment must be carried out!</string>
	<string>You may have the LAW by your side, but I represent JUSTICE!</string>
	<string>I stop monsters from hurting even more innocents! You should be HELPING me!</string>
	</array>

You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2882
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

Sorry, looking at the AI again, think that using setAITo: gotoWaypointAI.plist could be a problem. I think when you set and AI to another one, it doesn't return to the orginal AI. Might therefore need to do it as a SetState to GO TO WAYPOINT and c&p in the stuff from gotoWaypointAI into the custom AI, otherwise he may stop doing customAI stuff.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

LittleBear wrote:
do it as a SetState to GO TO WAYPOINT and c&p in the stuff from gotoWaypointAI into the custom AI, otherwise he may stop doing customAI stuff.
Point taken, thanks.

@Selezen: Do you have a, unused military camo Asp that I can use as Maegil's ship? I it's not too much bother, could you create a Spartacus marking (gray stylized fist holding gladius, shackle with two chain rings hanging from the wrist)? I have absolutely no artistic gifts...
Last edited by Cmdr. Maegil on Wed Jun 06, 2007 8:37 pm, edited 1 time in total.
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

unless it refers to an AI that is not your own, you can just use the method 'exitAI' to end an AI and return to the previous one.
(Same STATE and with the message 'RESTARTED': for reference check the patrollAI's and interceptAI)

So to temporarily use anotherAI for some specific (reusable) function, use "setAITo: someAI.plist",
to irrevocably EXIT and START a new AI use "switchAITo: someAI.plist"
(you could percievably use this to link back to the previous one, but the AI would start in state = GLOBAL)

just making things clear. :)
Riding the Rocket!
User avatar
Cmdr. Maegil
Sword-toting nut-job
Sword-toting nut-job
Posts: 1294
Joined: Tue Feb 27, 2007 10:28 pm
Location: On the mend in Western Africa

Post by Cmdr. Maegil »

Arexack_Heretic wrote:
unless it refers to an AI that is not your own, you can just use the method 'exitAI' to end an AI and return to the previous one.
(Same STATE and with the message 'RESTARTED': for reference check the patrollAI's and interceptAI)
Got it.
So to temporarily use anotherAI for some specific (reusable) function, use "setAITo: someAI.plist",
to irrevocably EXIT and START a new AI use "switchAITo: someAI.plist"
(you could percievably use this to link back to the previous one, but the AI would start in state = GLOBAL)
What does GLOBAL do? Or better yet, is still a good idea to learn ObjectiveC or should I start studying Javascript?
You know those who, having been mugged and stabbed, fired, dog run over, house burned down, wife eloped with best friend, daughters becoming prostitutes and their countries invaded - still say that "all is well"?
I'm obviously not one of them.
User avatar
LittleBear
---- E L I T E ----
---- E L I T E ----
Posts: 2882
Joined: Tue Apr 04, 2006 7:02 pm
Location: On a survey mission for GalCop. Ship: Cobra Corvette: Hidden Dragon Rated: Deadly.

Post by LittleBear »

This GLOBAL is just where Oolite starts reading the AI when the ship is spawned.
OXPS : The Assassins Guild, Asteroid Storm, The Bank of the Black Monks, Random Hits, The Galactic Almanac, Renegade Pirates can be downloaded from the Elite Wiki here.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Cmdr. Maegil wrote:
What does GLOBAL do? Or better yet, is still a good idea to learn ObjectiveC or should I start studying Javascript?
AIs are not written in Objective-C. :-)

As it stands, I don’t expect to change AIs. They well be supplemented by JavaScript ship scripts, but porting the state-machine stuff to JS seems unnecessary.
User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1876
Joined: Tue Jun 07, 2005 7:32 pm
Location: [%H] = Earth surface, Lattitude 52°10'58.19"N, longtitude 4°30'0.25"E.
Contact:

Post by Arexack_Heretic »

LittleBear wrote:
This GLOBAL is just where Oolite starts reading the AI when the ship is spawned.
I believe it is the standard state where any AI starts, be it on spawning of the ship that owns the AI or switchAITo:/setAITo:.

Oh.
You were answering his question, not attacking my religion. sorry.
yes, GLOBAL is just the default STATE in which the AI-stateengine starts.
Nothing to do with the GLOBAL in programming languages.

(as far as I know. I'm a code chimp, not a monkey...hmm no a code-worm really, chimps are apes more intelligent than the average monkey)
Last edited by Arexack_Heretic on Wed Jun 06, 2007 9:42 pm, edited 1 time in total.
Riding the Rocket!
Post Reply