Difference between revisions of "CollectLootAI"

From Elite Wiki
m
(script example from Oolite -> scripting page)
Line 6: Line 6:
  
 
  {
 
  {
    LOOT = {
+
GLOBAL =
        ATTACKED = (exitAI);  
+
{
        "COLLISION" = (exitAI);  
+
ENTER = ("setStateTo: LOOT");
        "CARGO_SCOOPED" = (exitAI);
+
};
        ENTER = (performCollect);  
+
        EXIT = ();  
+
LOOT =
        "HOLD_FULL" = (exitAI);  
+
{
        "INCOMING_MISSILE" = (fightOrFleeMissile, exitAI);  
+
ENTER = (performCollect);
        "TARGET_LOST" = (exitAI);  
+
ATTACKED = ("exitAIWithMessage: ATTACKED");
        UPDATE = ();  
+
"COLLISION" = (exitAI);
    };
+
"CARGO_SCOOPED" = ("exitAIWithMessage: CARGO_SCOOPED");
    GLOBAL = {ENTER = ("setStateTo: LOOT"); EXIT = (); UPDATE = (); };  
+
"HOLD_FULL" = ("exitAIWithMessage: HOLD_FULL");
 +
"INCOMING_MISSILE" = (fightOrFleeMissile, "exitAIWithMessage: INCOMING_MISSILE");
 +
"TARGET_LOST" = (exitAI);
 +
};
 
  }
 
  }
  
 
'''[[AI|BACK]]'''
 
'''[[AI|BACK]]'''
  
[[Category:Oolite]]
+
[[Category:Oolite scripting]]

Revision as of 12:01, 2 January 2011

A specialised jobAI. Just two states.

Upon starting, it will imdeately redirect to the second state LOOT Which will locate the loot and collect it. All other messages will result in exitAI.

{
	GLOBAL =
	{
		ENTER = ("setStateTo: LOOT");
	};

	LOOT =
	{
		ENTER = (performCollect);
		ATTACKED = ("exitAIWithMessage: ATTACKED");
		"COLLISION" = (exitAI);
		"CARGO_SCOOPED" = ("exitAIWithMessage: CARGO_SCOOPED");
		"HOLD_FULL" = ("exitAIWithMessage: HOLD_FULL");
		"INCOMING_MISSILE" = (fightOrFleeMissile, "exitAIWithMessage: INCOMING_MISSILE");
		"TARGET_LOST" = (exitAI);
	};
}

BACK