You are an unregistered user, you can register here
Navigation

Information

Site

Donations
If you wish to make a donation you can by clicking the image below.


 
Go Back   The Unreal Admins Page > Forums > Unreal Admins > General > General Chat

Reply
Thread Tools Display Modes
  #1  
Unread 8th July, 2017, 11:49 PM
Ninbushi Ninbushi is offline
Forum Newcomer
 
Join Date: Jul 2017
Posts: 5
Unhappy UT2004 Scripting Problems

Hi all.

I dont know if this is the right thread to post my Problem, or if theres anyone able to help me.

Ok, here is my Problem:

We are doing sonn a LARP Game, where we need additional UT2004.
We do have a LAN Setup ( a Dedicated Server, a Switch, and 1 or to Client PCs, no connection to Internet or anything)

We setup different dedicated servers with different Names, each shall provide a game for a single player with bots. The Player has to win the Game, to receive Information which helps him proceeding in the LARP.

And thats my Problem.

I need to figure out, how i am able to add thsi Information in the YouHave Won Message at the End of the Game.

I want to do this via HudBase/HudBDeathMatch.

I want to compare the Server name with a Predefined String.
If the Server name compares to a given String, it shall choose the correct message.

My Problem is if i try this in HudBDeathMatch:

Code:
if ( UnrealPlayer(Owner).bDisplayWinner ||  UnrealPlayer(Owner).bDisplayLoser )
	{
		if ( UnrealPlayer(Owner).bDisplayWinner )
		{ 
			if (String(GameReplicationInfo.ShadowrunServerName) ~=  ShadowrunServ )
				InfoString = ShadowrunPass;
			else
				InfoString = YouveWonTheMatch;
		}
i get the Error Bad or Missing expression in if.

It looks like for me, i dont get access to the Variable in another class.

How could i do this?
Whats my Error?

Could someone help me?

I have to have this fixed until 20th of Juli 17


Greetings

Nin
Reply With Quote
  #2  
Unread 9th July, 2017, 01:53 AM
ShaiHulud ShaiHulud is offline
Dominating
 
Join Date: Mar 2012
Posts: 164
Default

ShadowrunServerName is not a property of the GameReplicationInfo class - so I'm guessing you want ServerName there instead? Something like (and although this might pass the syntax test, I'm not sure whether the script will do what you want ir to do):

Code:
if (UnrealPlayer(Owner).bDisplayWinner ||  UnrealPlayer(Owner).bDisplayLoser)
{
  if (UnrealPlayer(Owner).bDisplayWinner)
  { 
    if (String(GameReplicationInfo.ServerName) ~= "ShadowrunServ")
      InfoString = ShadowrunPass;
    else
      InfoString = YouveWonTheMatch;
  }
...
Reply With Quote
  #3  
Unread 9th July, 2017, 10:35 AM
Ninbushi Ninbushi is offline
Forum Newcomer
 
Join Date: Jul 2017
Posts: 5
Default

Hi.
Thanks for your Answer.

I will definitly try this.

Well i should add, that i added Var String Shadowrunservername to GamereplicationInfo. and added also a
Shadowrunservername = ServerName to PostBeginPlay.

And added String Var Shadowrunserv to HUDBase.

My most Problem is, yes, i want to have the ServerName from Gamereplicatin info into this If Statement.

or should i try to enter another Replication Block into HUDBDeathMatch like this:
Code:
Replication
{
reliable if  (Role==ROLE_Authority)
ServerName;
}
and access then directly in the IfStatement to the ServerName?

Would this Work?



Greetings

Nin

Last edited by Ninbushi : 9th July, 2017 at 11:32 AM.
Reply With Quote
  #4  
Unread 9th July, 2017, 11:44 AM
Ninbushi Ninbushi is offline
Forum Newcomer
 
Join Date: Jul 2017
Posts: 5
Default

Well, i tried this , and for Syntax checking it worked.

Now i need to test if it works like this.

Will see.

Greetings
Nin
Reply With Quote
  #5  
Unread 9th July, 2017, 06:14 PM
Ninbushi Ninbushi is offline
Forum Newcomer
 
Join Date: Jul 2017
Posts: 5
Default

Hi all, once again me.

Now i got the Problem with the Errors during compiling.

But im not able to ucc make this script, so that im able to test it.

Could someone help me with that?

Its really annoying,

all runs fine, during make, but at the End i got an Error, that an Texture is missing/cannot be imported.

Im getting Nuts..

Im Working with the Unreal Editor,

and exporting the changed script.

i got a Folder which is named XInterface, where a folder is inside with Classes, where alll related classes are.

Then i delete the Xinterface U file, cause i want to compile my changed Xinterface.

I do UCC make, and then got at the end the error for the missing Texture.

Greetings

Nin
Reply With Quote
  #6  
Unread 10th July, 2017, 12:07 AM
ShaiHulud ShaiHulud is offline
Dominating
 
Join Date: Mar 2012
Posts: 164
Default

EPIC obviously changed things around a bit in the version of UnrealScript used in UT2004, there are some references here that I'm not familiar with.

But going back to your original question, I think (I'm not certain, but this is what I'm getting from your description) that you want to change the GameEndedMessage string for the Game type?

Maybe you could just make a small mutator, something like (untested):

Code:
class MyMutator extends Mutator;

var config string strCode;

function postBeginPlay()
{
  DeathMatchPlus(Level.Game).GameEndedMessage = strCode;
  
  super.postBeginPlay();
}

defaultproperties
{
  strCode=
}
And then in the command-line for the server you'd include:

Code:
ucc server CTF-SomeMap?game=Botpack.CTFGame?mutator=MyMutator.MyMutator
...and in the System folder for each server you'd put a .ini file called "MyMutator.ini" with a message containing the code for the next server

Code:
[MyMutator.MyMutator]
strCode=Congratulations! The code for the next part is ABRACADABRA
Reply With Quote
  #7  
Unread 11th July, 2017, 08:41 PM
Ninbushi Ninbushi is offline
Forum Newcomer
 
Join Date: Jul 2017
Posts: 5
Default

Hi Shai Hulud.

Well, thats a cool idea, but we want to do several dedicated servers on one PC, which should run all from the same folder.

im not sure how to include there a new ini file.

And i need to change the End Message by server name defined.

Im not sure how to do this by a Mutator.

I thought about to add a Class to the HudBDeathMatch class, to do something like this:

Code:
Class ShadowrunServer estends HudBDeathMatch

var() globalconfig string ServerName;
var string ShadowrunServer;
var string ShadowrunPass;

replication
{
 reliable if  (Role==ROLE_Authority)
ServerName;
}

simulated function ChangeServerName ()
{
if (ServerName ~= ShadowrunServer)
      YouveWonTheMatch = ShadowrunPass;
else
break;
}


simulated function PostNetBeginPlay()
{
ChangeServerName ();
}
But im absolutley not sure if i have
A: Access to YouveWonTheMatch
string, cause its a localized file and
B: If its possible to use PostNetBeginPlay
in this way, cause i didnt understand the Super command at least.

i thought it will ovverride the PostNetBeginnPlay fully, and if i use super, the original would no longer work?

Or does it mean, it pauses the original PostNetBeginnPlay, executes my PostNetBeginPlay, and returns then to the original PostNetBeginPlay?



Oh, and i gave up recompiling the Original Files, that would take forever :-)

Well, the Idea with an Mutator is cool, but im not sure the intention you thought about would help me, because of the Setup i planned for this.


I mean, the most important thing for me, is to access the YouHaveWon String, and change its value depending on which LAN server the Game is Played.

Would this be possible with an Mutator?


Ill Try to figure out an Code and Post it here, maybe you could help me with getting it to work?


edit..
I tried it out with my code above, and after UCC Make runs, i got at last another Error: Error opening File.

Did i do something wrong?









Greetings

Nin

Last edited by Ninbushi : 11th July, 2017 at 10:36 PM.
Reply With Quote
  #8  
Unread 12th July, 2017, 08:53 AM
ShaiHulud ShaiHulud is offline
Dominating
 
Join Date: Mar 2012
Posts: 164
Default

I'm not sure - HudBDeathMatch doesn't exist in UnrealScript for UT99, so I don't feel confident about answering.

OK, so you're running several servers from the same folder - do they each have a different game type? If so - and if all of the game types are ancestors of DeathMatchPlus, which may or may not be the case, you could do something like:

Code:
class MyMutator extends Mutator;

function string getLevelClass()
{
  local string result;
  local int i;
  
  result = string(Level.Game.class);
  i = instr(result, ".");

  if (i >= 0)
    result = mid(result, i + 1);

  return Caps(result);
}

function postBeginPlay()
{
  local string levelClass;

  levelClass = getLevelClass();
  switch (levelClass)
  {
    case "DEATHMATCHPLUS":
      DeathMatchPlus(Level.Game).GameEndedMessage = " Congratulations. The code for the next stage is ABC"; break;
      break;

    case "CTFGAME":
      DeathMatchPlus(Level.Game).GameEndedMessage = " Congratulations. The code for the next stage is DEF"; break;
      break;

    case "DOMINATION":
      DeathMatchPlus(Level.Game).GameEndedMessage = " Congratulations. The code for the next stage is GHI"; break;
      break;

    case "ASSAULT":
      DeathMatchPlus(Level.Game).GameEndedMessage = " Congratulations. The code for the next stage is MNO"; break;
      break;
  }

  super.postBeginPlay();
}
...that way the GameEndedMessage text would be set depending upon the game type (Capture the Flag, Death Match, Assault, or Domination).

Another thing you could try would be to set the port in the command line start-up command for each server:

Code:
ucc server CTF-Coret?game=Botpack.CTFGame?MaxPlayers=10 ini=UnrealTournament.ini port=7770
...then you could choose the end text based on the server port number:

Code:
class MyMutator extends Mutator;

function string getGamePort()
{
  local UdpBeacon beacon;
  local string result;

  foreach AllActors(class'UdpBeacon', beacon)
    break;

  if (beacon != none)
    result = string(beacon.UDPserverQueryPort - 1);

  return result;
}

function timer()
{
  switch (getGamePort())
  {
    case "7770":
      DeathMatchPlus(Level.Game).GameEndedMessage = " Congratulations. The code for the next stage is ABC"; break;
      break;

    case "7780":
      DeathMatchPlus(Level.Game).GameEndedMessage = " Congratulations. The code for the next stage is DEF"; break;
      break;
  }
}

function postBeginPlay()
{
  // Wait 10 seconds to allow the server time to bind the port
  SetTimer(10, false);

  super.postBeginPlay();
}
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:03 AM.


 

All pages are copyright The Unreal Admins Page.
You may not copy any pages without our express permission.