localhero oxp ALPHA

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

Moderators: another_commander, winston

Post Reply
User avatar
Svengali
---- E L I T E ----
---- E L I T E ----
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

localhero oxp ALPHA

Post by Svengali »

Hail to all Oolite scripters.

Currently I'm writing a mission-pack for oolite v1.69.1 and I think that some help would be nice. I'm not a native english speaker and I need some assistance in writing understandable missiontext/descriptions and improving my custom AIs. It's a alpha version and not balanced!

Missiontext:
- should be viewable on one page (think about the picture!)
- I'm not familiar with pronounces (please correct it, grammaticaly too)

AIs:
- sometimes (not often) the harkovshuttle gets idle on approching the station. I can't figure out what is happening
- maybe some states are not needed. Just give me a hint and I'll remove it.

Unfortunately I can't place a link here (cause I'm new here).
Maybe the moderator can place it for me. If he wants to, I'll send him a pm.

If it's all finished I'll upload it to the WIKI.

Cheers Svengali...

User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6402
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post by Disembodied »

Hi Svengali. Regarding mission text, I and numerous other pedants people will leap upon any chance to suggest corrections to English usage. As for AIs etc., there are lots of members who can give useful advice. You can always paste up the AI code here on the boards if you want -- just place it between <code></code> tags (except use [] instead of <>).

I also think that new posters can post links now... after the introduction of new anti-spam technology, I think Ahruman lifted the restrictions on link-posting. I could be wrong, though -- try it and see!

User avatar
Captain Hesperus
Grand High Clock-Tower Poobah
Grand High Clock-Tower Poobah
Posts: 2312
Joined: Tue Sep 19, 2006 1:10 pm
Location: Anywhere I can sell Trumbles.....

Re: localhero oxp ALPHA

Post by Captain Hesperus »

Svengali wrote:Hail to all Oolite scripters.
Hail and well met, Svengali!

Good luck with the OXP. If you need any help, then just copy and paste the piece of your code that's got you stuck and the friendly local code monkeys (they might even be gibbons) will tear it to shreds look over it and laugh cruelly steer you right.
From the topic header, it sounds like an interesting OXP. What's it about?
Regarding the Wiki, you will need to pm Winston as he locked the Wiki's new member joining function to stop spamming.

And welcome to the boards!

Captain Hesperus
"See, I didn't even mention selling him a cute and fluffy Trumble companion, only Cr30!"
The truth, revealed!!
Image

User avatar
TGHC
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

Hey there Svengali, welcome to the boards, and the development team, looking forward to your OXP.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"

User avatar
Svengali
---- E L I T E ----
---- E L I T E ----
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Thanks for your answers. So let me clear something:

Captain Hesperus wrote:
From the topic header, it sounds like an interesting OXP. What's it about?
This work is intended as an mission builder for multi-missions. With somewhat few changes a scripter can generate a complete new mission pack. (Currently there are 30 missions, the last one is not finished and the game is not balanced at all)

Main story:
Confederacy planets got some trouble with an ex-general and his pirate group. General Harkov's group seems to be well equiped and even better informed. Your mission is to support the local police to find, destroy and capture Harkov and his group.

It's a multi-mission-pack and there is a ranking system, some special missions and a bonus system integrated. Difficulty is easy for the first few missions, but it's getting harder if you succeed.

Here is a small list of questions:

1. There is a special mission to escort a police shuttle safely to the station. When the shuttle has docked some mission_variables should be set to a new state. I first tried to change the variables by script_actions in
shipdata.plist. But nothing happened. Maybe this kind of action isn't executed for NPCs on docking. Next try was the DOCKED-State in AI before performDocking and exitAI is executed. Even with a new target nothing again. Then I thought checking for distance to the station could be the solution. I put a lot of commsMessages in the AI and it seems that in the last stage of docking no action is executed and changing the target is not performed or it does unpredictable results. But sometimes appears a radio wave on the radar but without any message in commsLog. Maybe the station gets complete control over the ship and ignores or blocks all AI-methods from incoming ships.
But when is the DOCKED-Message sent to the AI? Is it player-related and only sent when the player has docked (status_string equal STATUS_DOCKED) or is it possible to use it for NPCs?

2. Is it possible to change the planet_description temporarly?
- GET planet description (local_variable)
- ADD Currently there is no CONFED MISSION available
- SET new planet description

3. Can I really check for GUI_SCREEN_MARKET?
It doesn't seem to work for me (WIN XP, Oolite 1.69.1)?

-----------------
Hello Disembodied...
Regarding mission text, I and numerous other pedants people will leap upon any chance to suggest corrections to English usage.
Another head of the hydra has to be taken out.

If you like to take a deeper look:
http://wiki.alioth.net/index.php/Localhero_OXP

EDIT: Link changed to the WIKI
Last edited by Svengali on Sat Jan 05, 2008 1:53 pm, edited 1 time in total.

User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Welcome to the board Svengali. All new mission OXP are highly appreciated. There are a lot readers around that might have worked on similar problems and will help when possible.
Svengali wrote:1. There is a special mission to escort a police shuttle safely to the station. When the shuttle has docked some mission_variables should be set to a new state. I first tried to change the variables by script_actions in
This is a nice one were I worked on myself. In the UPS-courier.OXP I have a NPC ship where mission variables are set on docking. But I used a complete different approach. My NPC ship sets a mission_variable in its death_actions. So whenever the player docks I look if the mission is active. If yes I count the NPC ships in the system. When this is zero and the death_actions were not executed, I assume the NPC ship is docked. Because of the used AI there are in my case no other solutions why the ship could have disappeared from the system.
I check this on docking of the player, but it could also be done IN_FLIGHT.

Normal script commands don't work in AI-scripting but only work for the player. And this last makes one exception possible:
When the NPC ships finds the player he can use the command: "performScriptActionOnTarget: set: mission_variable xx". performScriptActionOnTarget will allow to use all normal script commands as long as the target is the player.

User avatar
Svengali
---- E L I T E ----
---- E L I T E ----
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Thanks a lot Eric.

I think your way is a safer way (and much more elegant) than mine and I'll change it immediately.

While playing with the commsMessages I found that DESIRED_RANGE_ACHIEVED in GO_TO_COORDS is executed 8 times (as a minimum) on docking without interfering or aborting the docking procedure. Every time this State is executed the variables will be changed. I've tested this over 40 times and it seems to be working. But the player gets the chance to oversize his bonus by forcing the shuttle to abort the docking procedure. So I've included a maximum check for ..._bonus in script.plist and if it's greater than the maximum value the player gets a bonus-penalty and a message.

But now I got another question:
Is it possible to define mission_variables/local_variables as an integer?
That could cause the programm to allocate less memory and work can be done faster.

User avatar
Svengali
---- E L I T E ----
---- E L I T E ----
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Eric, If I understand your post right it would look like:

shipdata.plist

Code: Select all

	<key>death_actions</key>
		<array>
			<string>set: mission_localhero_special FAILED</string>
		</array>
script.plist

Code: Select all

	conditions = ("status_string equal STATUS_IN_FLIGHT");
	do = (
		"checkForShips: shuttleone",
		{
		conditions = ("shipsFound_number equal 0");
		do = (
			{
			conditions = ("mission_localhero_special equal FAILED");
			do = ();
			else (
				"commsMessage: MISSION ACCOMPLISHED",
				AND ANY OTHER CODE...
			);
			}
		);
		}
	);

User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Currently it's not possible to check if the player or an NPC has killed a specific ship.
Look at my route1UpsTraderAI.plist. I have build in that test into it. But not foolproof. I only can check that the player fired a shot at the NPC ship and are assuming he also killed it. But at least he was involved in it in some way.
So it had to make a compromise. While playing with the commsMessages I found that
DESIRED_RANGE_ACHIEVED in GO_TO_COORDS is executed 8 times (as a minimum) on docking without interfering or aborting the docking procedure.
I think it are 9 times. On approaching the dockingslit the docking computer user 9 setponts with speed, range an coordinates the ship has to fly by. Each one with its own margin of error. Giles wrote a real flight-path program for docking. (maybe it is 8 as the last pobably gives no response as endpoint)

But I want to get the
MISSION ACCOMPLISHED-Message, so it is necessary to change the ..._goal state while flying.
That's why any escape-pods have to be set to CARGO_SCRIPTED_ITEM in shipdata.plist, because
script_actions should be executed on scooping an escape-pod.
I don't get this. I use several "real" characters as pilots. Once scooped the always execute their script on docking of the player. But yes with your method you can already set thing on scooping.

Your script looks great, so I don't want to look to much at the code before it spoils any playing surprises.

Code: Select all

APPROACH_START		not used in V1.69.1
APPROACH_STATION		not used in V1.69.1
Not even working since 1.55. Aegidian probably changed something in the code without changing the AI. I already mentioned this in the behemoth topic. Both commands are changed for new ones. There was also a bug in the current dockingAI.plist. that will be fixed in the next release.
I put some effort in understanding how docking works. I put an explanation on the wiki with name: "Docking Instructions". It is linked from the HowTo AI page. I only wrote down things you need to know when scripting. Other details I left.

User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Eric, If I understand your post right it would look like:
Yes, but it needs one addition you probably thought of yourself. On adding your ship "shuttleone" to the universe, you must also set a variable: "set: mission_localhero_shipadded YES". Than the next code will react properly.

Code: Select all

   conditions = ("status_string equal STATUS_IN_FLIGHT", "mission_localhero_shipadded equal YES"); 
   do = ( 
      "checkForShips: shuttleone", 
      { 
      conditions = ("shipsFound_number equal 0"); 
      do = ( 
         { 
         conditions = ("mission_localhero_special equal FAILED"); 
         do = (); 
         else ( 
            "commsMessage: MISSION ACCOMPLISHED", 
            AND ANY OTHER CODE... 
         ); 
         } 
      ); 
      } 
   );
Or ever shorter when using the same variable."set: mission_localhero_special SHIP_ADDED" on addition of ship. then:

Code: Select all

   conditions = ("status_string equal STATUS_IN_FLIGHT", "mission_localhero_special equal SHIP_ADDED"); 
   do = ( 
      "checkForShips: shuttleone", 
      { 
      conditions = ("shipsFound_number equal 0"); 
      do = ( "commsMessage: MISSION ACCOMPLISHED", 
            AND ANY OTHER CODE...
      ); 
      } 
   );

User avatar
Disembodied
Jedi Spam Assassin
Jedi Spam Assassin
Posts: 6402
Joined: Thu Jul 12, 2007 10:54 pm
Location: Carter's Snort

Post by Disembodied »

Hi Svengali. I've been through your missiontext plist and I've done a small amount of editing, shortening the text where possible. I didn't do anything to the "\n"s as frankly I don't know what they are... :oops: I assume something to do with line breaks? Anyway, you can adjust these to suit if you want to use any of the amended text:

Code: Select all

<plist version="1.0">
<dict>
	<key>LOCALHERO_SETUP</key>
	<string>Welcome to [%H], Commander [commander_name].\n\nI'm Major Hurst, GalCop Intelligence.\nCommander, we need your assistance.\n\nThe Thargoids have started a major offensive\nand every military vessel is required to meet\nthis threat. Unfortunately this is not our only\nproblem. Renegades have been reported along our trade-routes: a group of pirates, under the command of a so-called General Harkov, are attacking GalCop ships. He has over 50 pilots under his command, veterans all.\n\nThe Confederation Government has sent me in to destroy this gang and arrest their leaders.\n\nStep to the System Data Screen and wait for a few seconds if you are interested.</string>

	<key>LOCALHERO_NOEQUIP</key>
	<string>Sorry, Commander [commander_name].\n\nYour ship needs a Fuel Scoop.\n\nWithout one you won't be able to capture\nany of those damned pirates.</string>
	
	<key>LOCALHERO_FIRSTOFFER</key>
	<string>Commander: we need your help.\n\nThe Traders' Alliance is demanding better protection.\nBut the pirates' scanners can detect\nGalCop ships at about 75 klicks, so we\nneed an unmarked vessel...\n\n...and a Commander with your reputation.\nIt won't be easy: they are well equipped.\n\nYour mission:\nfind them, and destroy their ships.\nWe'll pay a bonus if you manage to take at least one renegade pilot alive.\n\nWill you do it, Commander?</string>
	<key>LOCALHERO_OFFERMISSION</key>
	<string>[LOCALHERO_OFFER1]\n\nI hope you're ready for action: I've got a job for you.\n[LOCALHERO_OFFER2]\n\n[LOCALHERO_INFOGATHERED]\nWe need more information about Harkov and his\ndamned pirate gang.\n\nYour mission:\nfind them, destroy their ships and capture at least one of them.\n\nWill you do it, Commander?</string>
	<key>LOCALHERO_SPECIAL1</key>
	<string>[LOCALHERO_OFFER1]\n\nWe've got an incoming shuttle with a committee\nof universal governmental regulators.\nThey are on an inspection tour through the galaxy.\n\nYour mission:\nfind the shuttle and escort it to the station.\nDestroy any hostile ships and capture the offenders.\n\nWill you do it, Commander?</string>
	<key>LOCALHERO_SPECIAL2</key>
	<string>[LOCALHERO_OFFER1]\n\nThe situation is critical.\n[LOCALHERO_PLUS1]\n[LOCALHERO_PLUS2]\nSo get out there and kick some asses!\n\nYour mission:\nprotect the station, destroy as many enemy ships as possible and take at least one pirate alive.\n\nWill you do it, Commander?</string>
	<key>LOCALHERO_SPECIAL3</key>
	<string>[LOCALHERO_OFFER1]\n\nWe've got a big problem.\n[LOCALHERO_PLUS1]\n[LOCALHERO_PLUS2]\nSo get out there and burn some bad guys!\n\nYour mission:\nprotect the station, destroy as many enemy ships as possible and capture at least one of them.\n\nWill you do it, Commander?</string>
	<key>LOCALHERO_SPECIAL4</key>
	<string>[LOCALHERO_OFFER1]\n\nThe situation is critical.\n[LOCALHERO_PLUS1]\n[LOCALHERO_PLUS2]\nTime to make a stand!\n\nYour mission:\nprotect the station, destroy as many hostiles as possible and take at least one alive.\n\nWill you do it, Commander?</string>
	<key>LOCALHERO_SPECIAL5</key>
	<string>[LOCALHERO_OFFER1]\n\nHARKOV! This is our chance!\nHe's leading a major strike force\nheading for this station.\n\nYour mission:\nprotect the station, destroy his henchmen and capture General Harkov.\n\nWill you do it, Commander?</string>

	<key>LOCALHERO_RUNNING</key>
	<string>Ehm, Commander.\n\nI don't expected to see you again without\n one of Harkov's scum in your hold.\n\nI there some sort of problem? Should I entrust\nthis mission to another captain?\n\nDo you want to step back?</string>
	<key>LOCALHERO_SPECIALRUNNING</key>
	<string>Commander!\n\nThe situation is critical and it's vital\nyou do your job.\nYou have got your orders!\n\nOr should I entrust\nthis mission to someone else?\n\nDo you want to step back?</string>
	<key>LOCALHERO_GOAL</key>
	<string>Commander!\n\nYou have unfinished business.\n\nYou've got your orders: we'll contact you\nwhen your task is done.\nAre you up to this? Or should I entrust\nthis mission to another pilot?\n\nDo you want to step back?</string>

	<key>LOCALHERO_FAILED</key>
	<string>Commander [commander_name]!\n\nThere is nothing more to say!\n\nGet out of here!</string>
	<key>LOCALHERO_RESCUEDBUTFAILED</key>
	<string>[LOCALHERO_OFFER1]\n\nExcellent escort job. The shuttle\nhas arrived his destination without\na scratch. Unfortunately you failed\nto capture one of the offenders.\n\nBetter luck next time...</string>
	<key>LOCALHERO_SPECIALFAILED</key>
	<string>Commander [commander_name]!\n\nDefending the station was the\nmain mission goal for you.\n\nUnfortunately you failed to capture one\nof those damned pirates.\n\nBetter luck next time...</string>
	<key>LOCALHERO_KILLED</key>
	<string>[LOCALHERO_OFFER1]\n\nYou've done an excellent job. Killing those\nrenegades is the only way to handle this threat. Unfortunately\nyou failed to capture one of them.\n\nBetter luck next time...</string>

	<key>LOCALHERO_CAPTURED</key>
	<string>Strike, Commander!\n\nYou captured those damned pirates\nand earned [mission_localhero_bonus].0 Credits as special bonus.\n\nOur Intelligence Service will gain valuable information about Harkov\nand his cursed renegades.</string>
	<key>LOCALHERO_SPECIALCAPTURED</key>
	<string>What a fight, Commander!\n\nYou crushed the pirates\nand earned [mission_localhero_bonus].0 Credits as special bonus.\n\nOur Intelligence Service will gain valuable information about Harkov\nand his criminal band.</string>
	<key>LOCALHERO_RESCUEDCAPTURED</key>
	<string>Yes, Commander!\n\nYou brought the shuttle in\nand earned [mission_localhero_bonus].0 Credits as special bonus.\n\nOur Intelligence Service will gain valuable information about Harkov\nand his pirate scum.</string>

	<key>LOCALHERO_PLUSRANK1</key>
	<string>\n\nFor your services, it's a pleasure for me to award you the rank of CONFED GUARD.</string>
	<key>LOCALHERO_PLUSRANK2</key>
	<string>\n\nFor your services, I'm delighted to award you the rank of CONFED OFFICER.</string>
	<key>LOCALHERO_PLUSMEDAL1</key>
	<string>\n\nFor your brave services, it's a great pleasure to award you the CONFED STAR MEDAL.</string>
	<key>LOCALHERO_PLUSMEDAL2</key>
	<string>\n\nFor your brave services, it's an honour to award you the PIRATES DEAD MEDAL.</string>

	<key>LOCALHERO_CURRENT_STATUS</key>
	<string>\nYour Statistics\nSuccessful Missions --- [mission_localhero_success]\nDestroyed Pirates ------- [mission_localhero_kills]</string>
	<key>LOCALHERO_RANK0</key>
	<string>Current Rank -------------- NONE</string>
	<key>LOCALHERO_RANK1</key>
	<string>Current Rank -------------- GUARD</string>
	<key>LOCALHERO_RANK2</key>
	<string>Current Rank -------------- OFFICER</string>
	<key>LOCALHERO_MEDAL0</key>
	<string>Current Medal ------------- NONE</string>
	<key>LOCALHERO_MEDAL1</key>
	<string>Current Medal ------------- CONFED STAR MEDAL</string>
	<key>LOCALHERO_MEDAL2</key>
	<string>Current Medal ------------- PIRATES DEAD MEDAL</string>
	<key>LOCALHERO_COMEBACK</key>
	<string>\nCheck your System Data Screen on Confederacy worlds for more offers.</string>

	<key>LOCALHERO_MISSIONCHOICE</key>
		<dict>
			<key>LOCALHERO_ACCEPTED</key>
			<string>Yes, I will.</string>
			<key>LOCALHERO_REFUSED</key>
			<string>No, I won't.</string>
		</dict>
</dict>
</plist>

User avatar
Arexack_Heretic
Dangerous Subversive Element
Dangerous Subversive Element
Posts: 1878
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 »

Nice to see a new face amongst the coders :D
Feel welcome Svengali.


edit:
Don't worry about your use of english too much, as already said many of us are real stifflers for correct spelling.
You could use your 'dialect' as an asset and use it to create flavourfull character-interactions or even a whole planet full of human colonists who speak your native language.
Last edited by Arexack_Heretic on Thu Oct 25, 2007 8:49 am, edited 1 time in total.
Riding the Rocket!

User avatar
Commander McLane
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Hi, Svengali, and welcome to the boards, to this great game and--wow!--among the scripters! :D That's an impressing ascent!

What I'm reading here looks very promising. I'm looking forward to it!

And again, welcome! :D :D :D

User avatar
Commander McLane
Intergalactic Spam Assassin
Intergalactic Spam Assassin
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Hmmm, there may be an issue with continuity in the Ooniverse. Let me explain.

I haven't fired up the whole thing yet, just read through the readme and the developer notes. But from there I got the impression that you are referring to the planets with government type "Confederacy" as being linked together, as all being sort of members of the same confederation.

I am not too sure about that. I think all the government types are referring to the sort of government each planet as such has internally. So in case of a Dictatorship the whole planet is under the rule of a dictator, in case of a Democracy the planet is--well--a democracy, in case of a Corporate State political rule doesn't matter much, the corporations run the place, and in case of a Confederacy the planet may consist of several semi-autonomous regions with a central, but more or less balanced government. At least that's how imagine it to be.

For me none of the government types implies that various planets of the same type would be linked together in any way. All planets are linked with each other through being members of GalCoop, or else they wouldn't be on the galactic map in the first place. Then we may have some factions or groups of planets introduced by various OXPs, but usually these are locally connected. Up to now there is no galaxy-wide sub-division of GalCoop-worlds. Even the Communist or Dictatorship worlds, while sharing some common features (if you have the respective OXPs by Dr Nil and Ramon installed), are in my understanding not directly connected by a superior authority other than GalCoop itself (which is not really "superior", as it usually doesn't interfere with intraplanetary issues).

I am not saying that this absolutely prevents Confederacy worlds from being connected to each other. But in my opinion, if your OXP has something like a Confederation of Confederacies as a prerequisite, then this is something new in the Ooniverse, which wasn't there before. And therefore it should have a background story and explanation behind it.

If I am getting you wrong, then just forget this remark. But then, why should only all Confederacy planets get into the same sort of trouble, just all of them, but nobody else?

User avatar
Svengali
---- E L I T E ----
---- E L I T E ----
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Disembodied wrote:
I've been through your missiontext plist and I've done a small amount of editing, shortening the text where possible.
Thanks a lot. I've now implemented it and added your name in the READMEs.
I didn't do anything to the "\n"s as frankly I don't know what they are...
Yes, this is a carriage return (Line break). In the upper right corner of the mission_screen is a picture. So I had to do this (\n) to prevent it from being overlayed by the text.

Eric Walch wrote:
(maybe it is 8 as the last pobably gives no response as endpoint)
That's a somewhat strange thing. Sometimes it seems to executed but not everytime. So I calculated with 8 times.
I don't get this. I use several "real" characters as pilots. Once scooped the always execute their script on docking of the player.
That's the point. ON DOCKING. But the message should be sent while the player is IN_FLIGHT so he knows that everything is alright. The player gets his DEBRIEF on docking.

Post Reply