Ritualistic Forums

Go Back   Ritualistic Forums > Ritual Entertainment Games > Star Trek Elite Force II > EF2 Editing Forum

Reply
 
Thread Tools Display Modes
Old 02-26-2011, 02:33 PM   #1
110576
Rookie
 
110576's Avatar
 
Join Date: May 2010
Location: Heiloo
Posts: 19
Send a message via Skype™ to 110576
Question gametype as integer?

Hello,
An idea of mine was that I'd create a script that, based on the gametype it would seal off (activate forcefields)different areas. Only looking at the documentation didn't reveal anything useful. So is there a variable that changes with game-types? (integer/float if possible) Or is my approach totally wrong?

--------------------
Hetzers gona hetz!

Last edited by 110576 : 02-26-2011 at 02:36 PM.
110576 is offline   Reply With Quote
Old 02-26-2011, 07:24 PM   #2
Chriss
Veteran
 
Chriss's Avatar
 
Join Date: Jul 2006
Location: Germany
Posts: 399
Send a message via AIM to Chriss Send a message via Yahoo to Chriss Send a message via Skype™ to Chriss
Default Re: gametype as integer?

Correct approach.
You might find that download handy as it includes all the gametypes and gamemodifier variables: http://eliteforce2.filefront.com/fil..._Configs;84489

PHP Code:
//g_gametype is for sp/multiplayer
//use mp_gametype

void anyfreefunctionnamehere()
{
float fMpGameType;

//pack it in a variable, so the cvar has to be read just once
//this is faster and better for performance
fMpGameType getCvarInt("mp_gametype");

//deathmatch 0
if(fMpGameType == 0)
{
 print(
"dm\n");
}
//teamdeathmatch 1
else if(fMpGameType == 1)
{
 print(
"tdm");
}
//capture the flag
else if(fMpGameType == 2)
{
 print(
"ctf\n");
}
//bomb defusion
else if(fMpGameType == 3)
{
 print(
"bd\n");
}


Chriss is offline   Reply With Quote
Old 02-27-2011, 06:12 AM   #3
110576
Rookie
 
110576's Avatar
 
Join Date: May 2010
Location: Heiloo
Posts: 19
Send a message via Skype™ to 110576
Default Re: gametype as integer?

My attempts are giving the following errors:
Code:
maps/glassmaze.scr(16) : not a function maps/glassmaze.scr(17) : "}" is not a type maps/glassmaze.scr(24) : "}" is not a type maps/glassmaze.scr(28) : "}" is not a type maps/glassmaze.scr(32) : "}" is not a type maps/glassmaze.scr(36) : "}" is not a type maps/glassmaze.scr(43) : "blueBD" is not a type maps/glassmaze.scr(44) : "wait" is not a type maps/glassmaze.scr(45) : "redBD" is not a type maps/glassmaze.scr(46) : "blueBD" is not a type maps/glassmaze.scr(47) : "}" is not a type Compile failed. function main was not defined function vSwitchTDM was not defined function vSwitchBD was not defined function vSwitchDM was not defined function vSwitchCTF was not defined ******************** ERROR: Compile failed. ******************** ----- Server Shutdown -----
Script (.scr) used:
PHP Code:
void main();
void vSwitchTDM();
void vSwitchBD();
void vSwitchDM();
void vSwitchCTF();
void vActForceField1;

float fMpGameType;

#include "maps/global_scripts/global_common.scr"

void main()
{
    
soundtrack"sound/music/glassmaze" );
    
fMpGameType getCvarInt("mp_gametype");
    
thread vActForceField1();
}

void vActForceField1() 
{
    if(
fMpGameType == 0)
    {
        
thread vSwitchDM();
    }
    if(
fMpGameType == 1)
    {
        
thread vSwitchTDM();
    }
    if(
fMpGameType == 2)
    {
        
thread vSwitchCTF();
    }
    if(
fMpGameType == 3)
    {
        
thread vSwitchBD();
    }
    
}

void vSwitchBD() //Set forcefield arrangement for gametype BD
{
    
$redBD.notSolid();
    
$blueBD.notSolid();
    
wait(0.1);
    
$redBD.hide();
    
$blueBD.hide();
}
void vSwitchTDM() //Set forcefield arrangement for gametype TDM
{
    
$redBD.notSolid();
    
$blueBD.notSolid();
    
wait(0.1);
    
$redBD.hide();
    
$blueBD.hide();
}
void vSwitchCTF() //Set forcefield arrangement for gametype CTF
{
    
$redCTF.notSolid();
    
$blueCTF.notSolid();
    
wait(0.1);
    
$redCTF.hide();
    
$blueCTF.hide();
}
void vSwitchDM() //Set forcefield arrangement for gametype DM
{
    
$redBD.notSolid();
    
$blueBD.notSolid();
    
wait(0.1);
    
$redBD.hide();
    
$blueBD.hide();


--------------------
Hetzers gona hetz!
110576 is offline   Reply With Quote
Old 02-27-2011, 06:16 AM   #4
Chriss
Veteran
 
Chriss's Avatar
 
Join Date: Jul 2006
Location: Germany
Posts: 399
Send a message via AIM to Chriss Send a message via Yahoo to Chriss Send a message via Skype™ to Chriss
Default Re: gametype as integer?

Line 6, you declared "vActForceField1" as variable of the type VOID, not as function.

Correct would be:
void vActForceField1();

You are simply missing the brackets ^^

I know that stuff can be pretty distracting errors like these happen very fast .
Chriss is offline   Reply With Quote
Old 03-04-2011, 08:03 AM   #5
110576
Rookie
 
110576's Avatar
 
Join Date: May 2010
Location: Heiloo
Posts: 19
Send a message via Skype™ to 110576
Unhappy Another problem

Thanks, indeed those small things are overlooked easily. The script is finished. But now I have another problem. At random times in MP (when issuing a console command (any)) the map just crashes. First I thought it was something that might have triggered the script again. But that's not possible since the main function was completed, otherwise the forcefields wont go up. There was no error message, the entire game just crashed. Is this map related or script related?

Here's the script:
PHP Code:
void main();
void vSwitchTDM();
void vSwitchBD();
void vSwitchDM();
void vSwitchCTF();
void vActForceField1();

float fMpGameType;

#include "maps/global_scripts/global_common.scr"

void main()
{
    
soundtrack"sound/music/glassmaze" );
    
fMpGameType getCvarInt("mp_gametype");
    
thread vActForceField1();
}

void vActForceField1() 
{
    if(
fMpGameType == 0)
    {
        
thread vSwitchDM();
    }
    if(
fMpGameType == 1)
    {
        
thread vSwitchTDM();
    }
    if(
fMpGameType == 2)
    {
        
thread vSwitchCTF();
    }
    if(
fMpGameType == 3)
    {
        
thread vSwitchBD();
    }
    
}

void vSwitchBD() //Set forcefield arrangement for gametype BD
{
    
$redBD.notSolid();
    
$blueBD.notSolid();
    
wait(0.1);
    
$redBD.hide();
    
$blueBD.hide();
}
void vSwitchTDM() //Set forcefield arrangement for gametype TDM
{
    
$redTDM.notSolid();
    
$blueTDM.notSolid();
    
wait(0.1);
    
$redTDM.hide();
    
$blueTDM.hide();
}
void vSwitchCTF() //Set forcefield arrangement for gametype CTF
{
    
$redCTF.notSolid();
    
$blueCTF.notSolid();
    
wait(0.1);
    
$redCTF.hide();
    
$blueCTF.hide();
}
void vSwitchDM() //Set forcefield arrangement for gametype DM
{
    
$redBD.notSolid();
    
$blueBD.notSolid();
    
wait(0.1);
    
$redBD.hide();
    
$blueBD.hide();

Also, can the wait commands be removed?

--------------------
Hetzers gona hetz!
110576 is offline   Reply With Quote
Old 03-04-2011, 08:19 AM   #6
Chriss
Veteran
 
Chriss's Avatar
 
Join Date: Jul 2006
Location: Germany
Posts: 399
Send a message via AIM to Chriss Send a message via Yahoo to Chriss Send a message via Skype™ to Chriss
Default Re: gametype as integer?

It doesn't look like the script creates a error, to me.
Perhaps the map is, it depends on how many entities you have on the map, there are certain restrictions, but most ppl never make interactive maps like this.
- Yes, you can remove the wait commands.
- You could also use, would make the script faster, not that it really matter, but just for teh records:

PHP Code:
if(fMpGameType == 0)
{
  
thread vSwitchDM();
}
else if(
fMpGameType == 1)
{
  
thread vSwitchTDM();
}
else if(
fMpGameType == 2)
{
  
thread vSwitchCTF();
}
else
{
  
thread vSwitchBD();

Chriss is offline   Reply With Quote
Old 03-04-2011, 09:56 AM   #7
110576
Rookie
 
110576's Avatar
 
Join Date: May 2010
Location: Heiloo
Posts: 19
Send a message via Skype™ to 110576
Default Re: gametype as integer?

That's a method too yea
I'll try limiting the entities and see what will happen.

--------------------
Hetzers gona hetz!
110576 is offline   Reply With Quote
Old 03-09-2011, 09:20 AM   #8
Chriss
Veteran
 
Chriss's Avatar
 
Join Date: Jul 2006
Location: Germany
Posts: 399
Send a message via AIM to Chriss Send a message via Yahoo to Chriss Send a message via Skype™ to Chriss
Default Re: gametype as integer?

Did you fix the issue ?
If not you can send me the map and script so I can take a look at it.

You can also take a closer look when you enable these:

//log events into a file
logfile 1

//enable cheats, in order to activate developer modus
cheats 1

//enable developer in order to enable warnings
developer 1

//print all warnings
com_printwarnings 1

//show every single event that happens in game (in singleplayer g_gametype 0)
//do not enable with one of the scr_ commands

g_showevents 1

//show each call of a script function
//do not use this is you have enabled g_showevents

scr_printfunccalls 1

//show each call of a event from script
//do not use this is you have enabled g_showevents

scr_printeventcalls 1

I can't tell you what you have to look for, but I can tell you when I see it. Stupid, I know but there are so many possibilities.
Chriss is offline   Reply With Quote
Old 04-30-2011, 04:28 AM   #9
110576
Rookie
 
110576's Avatar
 
Join Date: May 2010
Location: Heiloo
Posts: 19
Send a message via Skype™ to 110576
Default Re: gametype as integer?

I think I solved it by removing most of the decorative objects.
I usually test it in SP first and when I think its ready for intensive testing I ask people to test it with me in MP, so the bug might still be there, Ill see it at the next MP test

--------------------
Hetzers gona hetz!
110576 is offline   Reply With Quote
Reply


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 -5. The time now is 12:59 AM.


Powered by vBulletin® Version 3.6.3
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.