I'm assuming it might have been A actually. But that leads me to another question, is there any way of checking if there is enough room for a passenger? So that if there wasn't it could warn the player that they cannot accept a passenger contract?Eric Walch wrote:Looking at the code, there are only two reasons when adding a contract fails:Pleb wrote:For reasons unknown I've managed to get my code to work now. I still can't explain why it wasn't working, but I think it was to do with the time...however it is working now so never mind cheers anyways though.
A: When there is no free passenger cabin.
B: When that passenger is already present.
I assume B can easily happen during testing. At least it should be added to the wiki that there can not be two passengers with the same name. (edit: done)
Scripters cove
Moderators: winston, another_commander
Re: Scripters cove
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Re: Scripters cove
Yes - passengerCapacity and passengerCountPleb wrote:I'm assuming it might have been A actually. But that leads me to another question, is there any way of checking if there is enough room for a passenger? So that if there wasn't it could warn the player that they cannot accept a passenger contract?
- Smivs
- Retired Assassin
- Posts: 8408
- Joined: Tue Feb 09, 2010 11:31 am
- Location: Lost in space
- Contact:
Re: Scripters cove
You can count the ship's passengers, then if the number of passengers is less than the number of berths, contracts can be taken, otherwise don't offer them.
<ninja'd>
<ninja'd>
Commander Smivs, the friendliest Gourd this side of Riedquat.
Re: Scripters cove
Ah, that was pretty obvious to find sorry about that but thank you very much!cim wrote:Yes - passengerCapacity and passengerCountPleb wrote:I'm assuming it might have been A actually. But that leads me to another question, is there any way of checking if there is enough room for a passenger? So that if there wasn't it could warn the player that they cannot accept a passenger contract?
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Re: Scripters cove
Sorry I have another question, on a different subject this time. Say, for example, the player is reporting to a marker beacon (essentially a buoy) to investigate something. I need it so that when the player gets within a certain distance of the buoy the player receives a communication telling him/her to get the hell out of there! Is this possible, as when I tried to modify an exisitng AI file (like I have with the Taxi Station or Corporate Trading Outpost) so that when the buoy spots the player it sends a communication, but this communication can't come from the buoy, it needs to be a scipted comm message (so that it is in the comm log but not from the buoy). Is this possible?
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Re: Scripters cove
Yes - player.commsMessage will send a message from no apparent source.Pleb wrote:Sorry I have another question, on a different subject this time. Say, for example, the player is reporting to a marker beacon (essentially a buoy) to investigate something. I need it so that when the player gets within a certain distance of the buoy the player receives a communication telling him/her to get the hell out of there! Is this possible, as when I tried to modify an exisitng AI file (like I have with the Taxi Station or Corporate Trading Outpost) so that when the buoy spots the player it sends a communication, but this communication can't come from the buoy, it needs to be a scipted comm message (so that it is in the comm log but not from the buoy). Is this possible?
Re: Scripters cove
Okay but how do I get this script command to launch when the player gets near the buoy? Sorry I didn't explain myself very well!cim wrote:Yes - player.commsMessage will send a message from no apparent source.Pleb wrote:Sorry I have another question, on a different subject this time. Say, for example, the player is reporting to a marker beacon (essentially a buoy) to investigate something. I need it so that when the player gets within a certain distance of the buoy the player receives a communication telling him/her to get the hell out of there! Is this possible, as when I tried to modify an exisitng AI file (like I have with the Taxi Station or Corporate Trading Outpost) so that when the buoy spots the player it sends a communication, but this communication can't come from the buoy, it needs to be a scipted comm message (so that it is in the comm log but not from the buoy). Is this possible?
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Re: Scripters cove
Ah, right. You need the buoy's AI to start in a state that scans for the player (they're the only ship with primary role "player") - plenty of examples in other OXPs for how to do that. When it finds them, it switches into a different state, the ENTER of which has aPleb wrote:Okay but how do I get this script command to launch when the player gets near the buoy? Sorry I didn't explain myself very well!
sendScriptMessage
call.The buoy then has a ship script attached, from which a function can be called by sendScriptMessage. That function sends the anonymous comms message, and presumably also calls back to your worldscript(s) to trigger the next stage of the investigation.
Re: Scripters cove
Ah okay I was on the right track then. I will try this out tonight when I finish work - looking forward to the bank holiday weekend whoooo! Thank you very much cim!
Desktop PC: CPU: Intel i7-4790K Quad Core 4.4GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1080Ti RAM: 32GB DDR3
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Laptop PC: CPU: Intel i5-10300H Quad Core 4.5GHz (Turbo-Charged) GPU: Nvidia GeForce GTX 1650 RAM: 32GB DDR4
Re: Scripters cove
Look at Traffic Control OXP or Welcome Mat OXP for examples.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Scripters cove
The important point (which was probably not very clear in cim's answer) is that what you want to do is better done in a ship script, and not with an AI. The best solution is to give your buoy a simple nullAI, and attach a script to it that will do the searching and the message sending. For that you need a timer in the ship script that starts as soon as the buoy is spawned and is stopped as soon as the player ship is detected inside a defined distance from the buoy, at which point the message is sent via the command that cim gave you (which is a JS-script command, not an AI command).cim wrote:Ah, right. You need the buoy's AI to start in a state that scans for the player (they're the only ship with primary role "player") - plenty of examples in other OXPs for how to do that. When it finds them, it switches into a different state, the ENTER of which has aPleb wrote:Okay but how do I get this script command to launch when the player gets near the buoy? Sorry I didn't explain myself very well!sendScriptMessage
call.
The buoy then has a ship script attached, from which a function can be called by sendScriptMessage. That function sends the anonymous comms message, and presumably also calls back to your worldscript(s) to trigger the next stage of the investigation.
- Griff
- Oolite 2 Art Director
- Posts: 2483
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
Re: Scripters cove
I was picking through Commander McLane's 3d_asteroids script to see if i had enough brainpower to adapt it into a 'C64 version of Elite Anarchies.oxp' that would spawn pirates in a cloud around you no matter whatever direction you were flying and i ended up on a wiki page that listed a setshaders javascript command and it got me thinking can you test if the player has a certain piece of equipment installed and if so change the shaders that will be used for eg. the cargo pods? I was thinking of a piece of equipment that made cargo pods more visible by using shaders to draw a flashing wireframe box around them (it needen't be yet another piece of equipment it could be a function of the scanner target enhancement or something like that). Has anybody done an oxp that does somethiing like this already (test for player equipment and change shaders/materials on an NPC ship/object?)
Wiki homepage for my OXP: http://wiki.alioth.net/index.php/Griff_Industries
Re: Scripters cove
It would be fairly easy to do - equipment checking is standard for most scripted equipment (so it only works when you have it installed and it's not damaged) and the other stuff's just a scan and shader application.
If you can do the shader bits I can knock up a script for you.
If you can do the shader bits I can knock up a script for you.
My OXPs via Boxspace or from my Wiki pages .
Thargoid TV
Dropbox Referral Link
Thargoid TV
Dropbox Referral Link
- Commander McLane
- ---- E L I T E ----
- Posts: 9520
- Joined: Thu Dec 14, 2006 9:08 am
- Location: a Hacker Outpost in a moderately remote area
- Contact:
Re: Scripters cove
Isn't that basically what Deep Space Pirates OXP is already doing? I think it would at the very least be a better starting point.Griff wrote:I was picking through Commander McLane's 3d_asteroids script to see if i had enough brainpower to adapt it into a 'C64 version of Elite Anarchies.oxp' that would spawn pirates in a cloud around you no matter whatever direction you were flying
- Griff
- Oolite 2 Art Director
- Posts: 2483
- Joined: Fri Jul 14, 2006 12:29 pm
- Location: Probably hugging his Air Fryer
Re: Scripters cove
ahh T! i was hoping you'd pop in Smashing, i'll try out some ideas for the shaders over the next few days and post them up, if they look OK i'll hassle you for the script bits!
Wiki homepage for my OXP: http://wiki.alioth.net/index.php/Griff_Industries