Page 2 of 70

Posted: Tue Jan 01, 2008 8:51 pm
by Eric Walch
If anybody (including an NPC) scoops the pod then his script_actions get activated, so I need to make sure the player scooped him.
Within the legacy scripting system there is a method to distinguish between scooping by player or NPC. I put it on the wiki as a link from script_actions in shipdata.plist. A_H is using it in his latest cargo_wreck_teaser. Only he uses there local variables that have a bug in 1.70. But with mission variables it works well. Ahruman showed also a demo-script for this in JS somewhere.

EDIT: added the link you found in the next massage: http://wiki.alioth.net/index.php/Script ... n_shipdata

Posted: Tue Jan 01, 2008 9:08 pm
by LittleBear
Found the link. Cunning! Basically I can ditch all the playernear checks and just have one check in deathactions and one check in script actions (and NOT check in the AI at all). As long as a make sure the player is set to the mark's target (which he will be if the player attacked him) then his death actions can make the test. If the player was his target at the fatal moment then the variable is set to a playerkill. If he was attacked by an NPC then the NPC will be the target and so the playerkill is not set. That why no checks are necessary in AI. Ok the whole of the scripts get a tickle on the death of the mark. But one running when the mark blows up rather than hundres of runnings in flight should speed things up! :D

Posted: Tue Jan 01, 2008 9:37 pm
by Eric Walch
Little Bear wrote:
Basically I can ditch all the playernear checks and just have one check in deathactions and one check in script actions (and NOT check in the AI at all).
With scooping (script_actions) it works, with death_actions I am not sure. But in JS all the internal variables of Oolite are easier accessible without designing special functions for that as in legacy script.
So it must be no problem to call in JS-death_actions what the target of the player was at that moment. Also in script_actions you can call for the identity of the scooper. I think this is a better approach for a 1.70+ only version.

Posted: Fri Jan 04, 2008 5:03 pm
by JensAyton
Detecting whether the scooper is the player in JavaScript:

Code: Select all

this.shipWasScooped = function(scooper)
{
    if (scooper == player)
    {
        // scooper is player
    }
    else
    {
        // scooper is NPC
    }
}
(Alternatively, scooper.isPlayer could be used. Use whichever you feel is more intuitive. The isPlayer approach would be useful for a multiplayer version, but that ain’t happening in this universe.)

Two for the Price of One

Posted: Fri Jan 04, 2008 6:53 pm
by davcefai
During my second hit I got to the system where the baddie was in her Supercobra and duly extinguished her. After I entered the system my frame rate went variable - 35 to 50 fps.

When Fra Whatereverhernamewas ejected using a Worm the frame rate dropped to <13fps and went back up to 50-80fps after the explosion.

My Status Screen confirmed that I had terminated the miscreant.

Chapter 2

I proceeded towards the planet, swatting the odd Boa on the way. Then, close to the station, my quarry appeared again!
This time the frame rate stayed high and the pilot did not manage to eject.

My status screen again confirmed "mission successful" (The wording of the message had changed).

On docking I was rewarded but I suspect that I was paid twice, once before the congratulations screen and once after. I cannot be certain of this but my mattress felt lumpier than I expected :D

Posted: Sat Jan 05, 2008 12:22 am
by LittleBear
I need to check the code of the OXP, but I think the mark may be being re-added by Oolite 1.70 itself. On 1.69 if a mark (or any other ship for that matter) jumped a clone was added by the w/s beacon. So Ahruman added the command performWitchSpaceExitWithoutReplacing to stop this (and the marks in Random Hits use this when they jump - so when they jump they really have left the building and the only way to catch them is entering their wormhole.). The OXP only adds a mark if the status = RUNNING and the variable AddMark is TRUE and you are exiting witchspace or launhing. Once the mark is added the AddMark is set to false, so the OXP shoudn't respawn a dead mark, but it may be that Oolite's native code is doing it. As soon as the mark dies / jumps / pods the status changes.

? to Ahruman / Another Commander / Eric am I right in thinking that Oolite is respawning the mark as its noticed that a ship with the role random_hits_mark_boa (or whatever has died) so adds another ship with the role random_hits_mark_boa to replace it?

It will be a faily easy fix for 1.1 though. Once the status mark is dead / podded, I'll get it to spawn a cargo cannister in the middle of nowhere. The cargo cannister has a scanner range that covers the whole system and an AI that searches for random_hits_mark_ship then tells the pesky clone to exit without replacing, meaning once he's dead he stays dead!

The frame rate slowdown will be fixed for 1.1. It just means chnaging the command thats setting the variables from scriptActionOnTarget to a Java Command. The slowdown is caused because ALL your OXP scripts a being run everytime the mark scans for the player or is attacked. Which its doing about 8 times a second! 1.1 should run at the full 80 fps. Probabley get this done next weekend.

You only get paid when you dock, so I suspect you only got paid once, but he / she shouldn't have risen, Mosser-like, from the dead! As with everything in the OXP the mission failed / killed / captured message is randomly generated so will be different every time you play a mission. :wink:

More Feedback

Posted: Sun Jan 06, 2008 7:13 pm
by davcefai
1. Some ships near the bars are not tagged as "clean", "offender" or "fugitive". Is this deliberate or an oversight when you create the ships?

2. Do you make docking insanely difficult deliberately or is it just that you don't have problems docking? I may be in a minority here but I get destroyed 2 times out of 3 when docking with a Space Bar and I gave up visiting Black Monk Monasteries because of the difficulty in docking.

Otherwise I'm enjoying Random Hits.

Cheers

Posted: Sun Jan 06, 2008 7:44 pm
by LittleBear
1. Hunters launched by the Bar (either in defence or to hunt down pirates / thargoids / offenders) are launched with the "launchshipwithRole: random_hits_patrol"). Although they are in fact Clean, as they were launched with this command for some reason Oolite doesn't display the legal status in brackets. When they've cleaned up the town (ie no bugs / pirates / offenders are left alive within 25kms of the bar), they switch AIs and either go off on a long patrol or scoop up any left over cargo pods and witch out. Once they switch AIs then their Clean legal status is then displayed. Just one of those oddities!

2. Gorden Bennet this one doesn't even rotate! :wink: The docking bay is the same size as the standard one on all the native stations. However you don't have a Nav beacon to line up with as you would with a main station, so it is harder to line yourself up correctly (no tricker than manual docking in classic Elite though). You can auto-dock though as long as you have a docking 'puter. Target the Bar and then hit SHIFT C. Playtesting I used the docking computer and didn't get blown up. Overfly the bar first though (as the puter is a bit dumb) and just get yourself underneath the bar before turning it on. Same trick works with the black monk stations.

Posted: Sun Jan 06, 2008 7:56 pm
by davcefai
Re point 2:

The docking bay seems smaller. probably the problem for me is due to the fact that since there is no marker for the centre of the bay and the the layout of stuff in the bay is asymmetrical it is extremely difficult to line up properly.

Posted: Sun Jan 06, 2008 8:05 pm
by LittleBear
There's an H on it like a helicopter landing pad, think if you line up with this it should be easier. Could just put a Nav Beacon in for V1.1 though.

Posted: Mon Jan 07, 2008 5:06 am
by Cmdr. Maegil
Don't do that! The navbeacons cost money, besides I don't think that anyone uncapable of performing a simple manoeuvre such as docking would be well received by the local patrons...

Posted: Mon Jan 07, 2008 6:46 pm
by davcefai
It's really a pity that Oolite isn't multiplayer. I wouldn't put out a contract on Commander Maegil. I'd reserve the pleasure for myself :D :D :D

Seriously though I find the docking with the Space Bars difficult, much more so than with a station.

Posted: Mon Jan 07, 2008 7:21 pm
by LittleBear
Think it party depends on the ship you are flying. My Imperial Courier will only just fit in the dock (due to the extended underslung engines on the wings), so I have to be lined up exactly or lose a wing! In a Cobra, the docking port is much more forgiving of not been lined up exactly right. Without the beacon it is tricky to get lined up perfectly if you are in a big ship or one with lots of underhanging sub-entries. If all else fails though, just use the docking 'puter. :wink:

The pic of the "Furry Feline" on the Wiki page shows the bar properly lined-up.

Posted: Mon Jan 07, 2008 9:48 pm
by Eric Walch
LittleBear wrote:
Think it party depends on the ship you are flying. My Imperial Courier will only just fit in the dock (due to the extended underslung engines on the wings), so I have to be lined up exactly or lose a wing!
The docking bay is perfectly. I haven't seen any problems with alignment. (And I am flying a big boa MK2). But it may depend how you are aligning. I am not used to look at the back of the bay, but always make sure I see as much from the bottom as of the top of the bay.
LittleBear wrote:
to Ahruman / Another Commander / Eric am I right in thinking that Oolite is respawning the mark as its noticed that a ship with the role random_hits_mark_boa (or whatever has died) so adds another ship with the role random_hits_mark_boa to replace it?
Oolite is not replacing killed ships with new ships with the same role. (He only does it with witchspace jumping). When it happens, it is programmed in the oxp. I also had it that I hunted a victim, scooped the escape pod and than the saw a new mark appearing. There was a message, but I didn't manage to read it. I think it says something about escaping, so I think it was intentional. The new ship however turned in a blue circle. The first think that spring in mind was "Q-bomb" and I rushed away. Until I realised it was a witchspace tunnel trough witch my victim was escaping. I turned but came to late.

Today I did a level 3 mark. It could be that there is a bug? I could not find anything and with an entity dump I noticed there was no ship in the system with a "randomhits_something" AI. There should have been one I think. I did several docking's and launches and everytime he said I had to kill Captain Hesperus"

Posted: Mon Jan 07, 2008 10:14 pm
by LittleBear
Ok, with the clones, that means it a bug somewhere in the OXP. Its ment to add an escape carft (if the mark managed to eject in time - done with a dice role), but NOT a clone of the mark's ship. Looks like you got a pod and a clone of the ship. Will check that. With not adding the level three mark, that most likely is me not typing his role in correctly in script. What was the name of the ship he was meant to be flying? I've basicaly got a load of AddMark = true, missionstoreship = Adder, add random_hits_mark_adder. So if I've mistyped the name of role it won't be added. Easy to do with fifty of the blighters!

EDIT : Criminals in Asp Explorers not appearing is a known bug (fixed for V1.1), but if its another type of ship then thats a new one.