![]() |
|
|
|
#1
|
|||
|
|||
|
I am unable to get the script to work, I've downloaded the example mission and loaded on my host machine (not dedicated server), started the mission as multiplayer (coop) and then have a client try and join the mission. The host is able to select an aircraft but the client, typing any of the three commands sees nothing. An following error is shown on the client machine: *WPF.Unavailable puppet place error. I'm not sure if I am doing this correctly so any help would be appreciated.
|
|
#2
|
|||
|
|||
|
Quote:
Code:
[rts] scriptAppDomain = 0 Is there any entry in the log file? |
|
#3
|
|||
|
|||
|
That was it, added the RTS scriptAppDomain and it worked like a charm. Thanks
|
|
#4
|
|||
|
|||
|
Thank you Kodiak, Much appreciated
|
|
#5
|
|||
|
|||
|
Sorry, when You say "before last bracket" do you mean like so?
Code:
using System;
using System.Collections.Generic;
using System.Text;
using maddox.game;
using maddox.game.world;
//$reference parts/core/gamePlay.dll
public class Mission : AMission
{
public override void OnBattleInit()
{
base.OnBattleInit();
if (GamePlay is GameDef)
{
(GamePlay as GameDef).EventChat += new GameDef.Chat(Mission_EventChat);
}
}
void Mission_EventChat(IPlayer from, string msg)
{
if (msg.StartsWith("!help"))
{
Chat("Commands: !aircraft, !select#", from);
}
if (msg.StartsWith("!aircraft") || msg.StartsWith("!select"))
{
List<Tuple<AiAircraft, int>> aircraftPlaces = new List<Tuple<AiAircraft, int>>();
if (GamePlay.gpArmies() != null && GamePlay.gpArmies().Length > 0)
{
foreach (int army in GamePlay.gpArmies())
{
if (GamePlay.gpAirGroups(army) != null && GamePlay.gpAirGroups(army).Length > 0)
{
foreach (AiAirGroup airGroup in GamePlay.gpAirGroups(army))
{
if (airGroup.GetItems() != null && airGroup.GetItems().Length > 0)
{
foreach (AiActor actor in airGroup.GetItems())
{
if (actor is AiAircraft)
{
AiAircraft Aircraft = actor as AiAircraft;
for (int place = 0; place < Aircraft.Places(); place++)
{
aircraftPlaces.Add(new Tuple<AiAircraft, int>(Aircraft, place));
}
}
}
}
}
}
}
}
if (msg.StartsWith("!aircraft"))
{
int i = 0;
foreach (Tuple<AiAircraft, int> aircraftPlace in aircraftPlaces)
{
string playerName = "";
Player player = aircraftPlace.Item1.Player(aircraftPlace.Item2);
if (player != null)
{
playerName = " " + player.Name();
}
Chat("#" + i + ": " + aircraftPlace.Item1.Name() + " " + aircraftPlace.Item1.TypedName() + " " + aircraftPlace.Item1.CrewFunctionPlace(aircraftPlace.Item2) + " " + playerName, from);
i++;
}
}
else if (msg.StartsWith("!select"))
{
msg = msg.Replace("!select", "");
int i = -1;
if (int.TryParse(msg, out i) && i < aircraftPlaces.Count)
{
Tuple<AiAircraft, int> aircraftPlace = aircraftPlaces[i];
if (aircraftPlace.Item1.Player(aircraftPlace.Item2) == null)
{
from.PlaceEnter(aircraftPlace.Item1, aircraftPlace.Item2);
}
else
{
Chat("Place occupied.", from);
}
}
else
{
Chat("Please enter a valid aircraft number, e.g. !select0, !select1, !select2, ...", from);
}
}
}
}
public void Chat(string line, IPlayer to)
{
if (GamePlay is GameDef)
{
(GamePlay as GameDef).gameInterface.CmdExec("chat " + line + " TO " + to.Name());
}
}
public override void OnTrigger(int missionNumber, string shortName, bool active)
{
base.OnTrigger(missionNumber, shortName, active);
AiAction action = GamePlay.gpGetAction(ActorName.Full(missionNumber, shortName));
if (action != null)
{
action.Do();
}
}}
Last edited by Punch_145; 10-28-2012 at 12:09 PM. |
|
#6
|
|||
|
|||
|
Quote:
|
![]() |
|
|