Re: Information desired!
Posted: Wed Jul 24, 2024 10:01 am
If you figure it out please let me know - I've been trying without success to do the same thing to control the actions of a number of wingmen (Lance Fournie).Cholmondely wrote: ↑Tue Jul 23, 2024 11:40 pm
But what I want to achieve is to have the switch in AI made as a response to the BCC. Which presumably requires different coding.
I followed the BCC example given on https://wiki.alioth.net/index.php/BroadcastComms_MFD, which I coded as:
this.shipWillLaunchFromStation = function() {
this.broadcastcontrol();
}
this.broadcastcontrol = function() {
var w = worldScripts.BroadcastCommsMFD;
w.$createMessage({
messageName:this.name + "myMessage1",
callbackFunction:this.$broadcastCallback.bind(this),
displayText:"Evacuation message",
messageText:"Attention all ships. Please evacuate the area and move to a safe distance.",
transmissionType:"broadcast",
deleteOnTransmit:true,
delayCallback:4});
}
this.$broadcastCallback = function () {
this.ship.switchAI("feudal-attack5AI.plist");
};
The code is fine for in as far as getting BCC to broadcast the message but I haven't figured out how to get the ships receiving the broadcast to switch to my desired AI, i.e. the "feudal-attack5AI.plist" in the BCC procedure call. I presume I need some event handler command that the wingman ships (i.e. this.ship) can react to.
p.s. I needed to change some stuff: The Wiki page example under the 'dark side' heading has a typo: distplayText:"Evacuation message",
I had to change this to: displayText:"Evacuation message",
Hope you eventually get the scripting to work - I'm stuck at the moment.
p.p.s. Got it working with:
this.$broadcastCallback = function (){
this.ship = player.ship.target;
this.ship.switchAI("feudal-attack5AI.plist");
};
The ship I target now switches its AI to feudal-attack5AI.plist
However, I don't want to target each wingman individually to send instructions such as 'follow me', 'attack my aggressor', etc
Need to figure out how to broadcast a message so that all wingmen respond.