November 26 2024 08:49:05
Navigation
· Home
· Articles
· Downloads
· FAQ
· Discussion Forum
· Web Links
· News Categories
· Contact Me
· Photo Gallery
· Search
· Gameservers
Languages
Users Online
· Guests Online: 44

· Members Online: 0

· Total Members: 1,134
· Newest Member: Brody
Teamspeak 3
Last Seen Users
· hackepter10:19:18
· GONZO16:25:43
· Intruder16:52:26
· Sully 1 day
· desintegrator 2 days
· WEZ 2 days
· Homi 3 days
· The ACE 4 days
· xhc 1 week
· dRgiGGLeZ 1 week
· El Dookie 1 week
· Melber 2 weeks
· SGT PEPPER 2 weeks
· martyr 2 weeks
· Terminator 2 weeks

View Thread: MP sync. script discussion
Vietcong.Info » Vietcong General Discussion » Maps & Mapping
Who is here? 3 Guests
Current Rating: (Total: 1 rating)  
 Print Thread
MP sync. script discussion
Ando
Here is my level.c :
Spoiler:
Download source  Code
//default level.c


#include <inc\sc_global.h>
#include <inc\sc_def.h>
#include <inc\mplevel.inc>

dword gphase = 0;


int ScriptMain(s_SC_L_info *info){
   float fl;
   int i;
   s_SC_initside initside;
   s_SC_initgroup initgroup;
   c_Vector3 vec;
   char txt[32];      
   BOOL hide_weapons,hide_CTF_flags,teamgame,hideRW;
   void *c4nod;




      info->next_exe_time  = 10.0f;





   switch (info->message)
   {

   case SC_LEV_MES_INITSCENE:
      

      InitScene(info);
         

      // hide C4
      c4nod = SC_NOD_GetNoMessage(NULL,"c4");
      if (c4nod) SC_DUMMY_Set_DoNotRenHier2(c4nod,TRUE);

      switch(SC_ggi(GVAR_MP_MISSIONTYPE)){

         case GVAR_MP_MISSIONTYPE_ATG:         
            switch(SC_ggi(GVAR_MP_MISSIONSUBTYPE)){
               case 1:SC_SetObjectScript("bombplace","ini\\multiplayer\\scripts\\atg_dobj.c");break;
               case 2:SC_SetObjectScript("bombplace","ini\\multiplayer\\scripts\\bomb_dobj_vc.c");break;
            }// switch(SC_ggi(GVAR_MP_MISSIONTYPE))
            
            break;
         case GVAR_MP_MISSIONTYPE_COOP://COOP_US
            
            SC_SetObjectScript("sampan","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_ANM_MWP_BOAT.c");   // sampan
            break;
         case 10://custom COOP_VC


            break;

      } //switch(SC_ggi(GVAR_MP_MISSIONTYPE))

      SC_SetObjectScript("door_2","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_DOOR_2.7.c");            //door
            //SC_SetObjectScript("change_scs_tool","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\CHANGE_SCS_test.c");
            //SC_SetObjectScript("pramice","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\BOAT_ANM_1.5.c");
      //__________TRAPS
      SC_SetObjectScript("punji_pit_trap#0","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_PUNJI_PIT_TRAP_RANDOM.c");      //hole cover
      SC_SetObjectScript("punji_pit_trap#1","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_PUNJI_PIT_TRAP_RANDOM.c");      //hole cover
      SC_SetObjectScript("punji_pit_trap#2","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_PUNJI_PIT_TRAP_RANDOM.c");      //hole cover
      SC_SetObjectScript("punji_pit_trap#3","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_PUNJI_PIT_TRAP_RANDOM.c");      //hole cover
      SC_SetObjectScript("punji_pit_trap#4","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_PUNJI_PIT_TRAP_RANDOM.c");      //hole cover
      SC_SetObjectScript("punji_pit_trap#5","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_PUNJI_PIT_TRAP_RANDOM.c");      //hole cover

      SC_SetObjectScript("_mace_trap#0","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_MACE_TRAP_RANDOM.c");      //

      
      SC_SetObjectScript("_whip_trap#0","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WHIP_TRAP_RANDOM.c");
      SC_SetObjectScript("_whip_trap#1","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WHIP_TRAP_RANDOM_2.c");

      SC_SetObjectScript("ammobox",      "LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_ADD_AMMO_.c");   //ammobox
      SC_SetObjectScript("ammobox#1",      "LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_ADD_AMMO_.c");   //ammobox

      SC_SetObjectScript("us_first_aid",   "LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_FIRST_AID_.c");   //us_first_aid
      SC_SetObjectScript("us_first_aid#1",   "LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_FIRST_AID_.c");   //us_first_aid

      SC_SetObjectScript("killer",      "LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WOUNDED_COMA_DEAD.c");   //killer

      
      SC_SetObjectScript("de_lamp_switch","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_LIGHT_switch_2.1.c");   //LIGHT_switch
      SC_SetObjectScript("de_duck_refl","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_DUCK_SWIM_ANM.c");   //Duck
      
      //SC_SetObjectScript("de_bird_wings","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\DE_bird_wings.c");   //BIRD

      SC_SetObjectScript("ivq_lahev_srumem2","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_DESTR_disapear.c");   // bottle
      SC_SetObjectScript("ivq_lahev_srumem","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_DESTR_disapear.c");   // bottle
      SC_SetObjectScript("ivq_lahev_benzin","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_DESTR_disapear.c");   // bottle
      SC_SetObjectScript("ivq_lahev_slihem","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_DESTR_disapear.c");   // bottle

      

      break;



   case SC_LEV_MES_TIME:
      switch (gphase)
      {
      case 0:                     //first time init
                           //various inits
         CLEAR(initside);
         CLEAR(initgroup);

         initside.MaxHideOutsStatus = 32;
         initside.MaxGroups = 8;
         SC_InitSide(SC_P_SIDE_VC,&initside);   

         initside.MaxHideOutsStatus = 32;      //init sides and groups
         initside.MaxGroups = 8;
         SC_InitSide(SC_P_SIDE_US,&initside);

         initside.MaxHideOutsStatus = 5;
         initside.MaxGroups = 8;
         SC_InitSide(3,&initside);



         initgroup.SideId = 3;      //NEUTRAL
         initgroup.GroupId = 0;
         initgroup.MaxPlayers = 5;   
         SC_InitSideGroup(&initgroup);

   //US Groups - for COOP_VC mode
         initgroup.SideId = SC_P_SIDE_US;      //US a-team
         initgroup.GroupId = 0;
         initgroup.MaxPlayers = 64;   // nemenit !!! Erik.
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 1;
         initgroup.MaxPlayers = 8;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 2;
         initgroup.MaxPlayers = 6;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 3;
         initgroup.MaxPlayers = 6;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 4;
         initgroup.MaxPlayers = 6;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 5;
         initgroup.MaxPlayers = 8;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 6;
         initgroup.MaxPlayers = 8;
         SC_InitSideGroup(&initgroup);


   //VC Groups - for COOP_US mode
         initgroup.SideId = SC_P_SIDE_VC; //generic Vietcong
         initgroup.GroupId = 0;
         initgroup.MaxPlayers = 32;   // nemenit !!! Erik.
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 1;
         initgroup.MaxPlayers = 8;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 2;
         initgroup.MaxPlayers = 6;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 3;
         initgroup.MaxPlayers = 6;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 4;
         initgroup.MaxPlayers = 6;
         SC_InitSideGroup(&initgroup);

         initgroup.GroupId = 5;
         initgroup.MaxPlayers = 8;
         SC_InitSideGroup(&initgroup);

         
         gphase = 1;
         break;
      }// gphase switch
         break;

   case SC_LEV_MES_RADIOUSED:
      switch(info->param1){
      }
      break;

   case SC_LEV_MES_SPEACHDONE:
      switch(info->param1)
      {
      }
      break;
   }//switch (info->message){

   return 1;

}// int ScriptMain(void)



 
Chavez_US
I see, you you refer to the first type of whip trap (the swinging bamboo with spikes) script within your mapname/data/sublevelname/scripts/obj_s folder:

SC_SetObjectScript("_whip_trap#0","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WHIP_TRAP_RANDOM.c"Wink;

SC_SetObjectScript("_whip_trap#1","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WHIP_TRAP_RANDOM_2.c"Wink;

The second declaration script refers to the other type of whip trap (the one with the swinging spiked log, correct? and the script for that one is the "_WHIP_TRAP_RANDOM_2.c" you must have named to refer to this type of trap...

I was copy/pasting the whip_trap script "into" my level.c script as per your suggestion in the other section... "add script to trap object in level.c script
"...I misinterpreted what you were saying, and i was doing it wrong...


I will try to add the sc_def.h, that you mentioned in a PM, to even see if my script works this way (just out of curiousity)...If it doesn't, then i will do your method...I don't see any reason why it wouldn't work after this...

Rick (Chavez_US)
Edited by Chavez_US on 02-11-2011 03:08
 
Ando

SC_SetObjectScript("_whip_trap#0","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WHIP_TRAP_RANDOM.c"Wink;

SC_SetObjectScript("_whip_trap#1","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WHIP_TRAP_RANDOM_2.c"Wink;

The second declaration script refers to the other type of whip trap (the one with the swinging spiked log, correct?


No, there is 2x that random whip trap.

Mace trap ( swinging spiked log) is using another script (_MACE_TRAP_RANDOM.c)
 
apfelbaum
i know there are a more scripts like eg the turntable script (constant rotating object). is it needed to write it in level.c or synchronize it (especially this script)?
 
Chavez_US
Ando wrote:

SC_SetObjectScript("_whip_trap#0","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WHIP_TRAP_RANDOM.c"Wink;

SC_SetObjectScript("_whip_trap#1","LEVELS\\DEAD_END\\DATA\\MAP_D\\scripts\\obj_s\\_WHIP_TRAP_RANDOM_2.c"Wink;

The second declaration script refers to the other type of whip trap (the one with the swinging spiked log, correct?


No, there is 2x that random whip trap.

Mace trap ( swinging spiked log) is using another script (_MACE_TRAP_RANDOM.c)


Thank you for sharing your scripts Ando....this has helped me alot..... Rick (Chavez_US)
 
Ando
apfelbaum wrote:
i know there are a more scripts like eg the turntable script (constant rotating object).

Synchronization is needed to avoid that different players can see different state/position/..
If you use some continuous rotating then you probably don't need to synchronize it.
You will need it when players must see your object same time in same angle.


apfelbaum wrote:
is it needed to write it in level.c or synchronize it (especially this script)?


In level.c you can just attack script with object.

Other option in VC to attack script with object is to use script in same folder and with same name, then its attacked automatically. But after finalization editor don't add those *.scr (compiled scripts) to final game file and object cant work in game. It will work only when object with script are under scripts folder/subfolder.


I should write some tutorials to my scripts thread about "how to add scripts".
Edited by Ando on 03-11-2011 10:04
 
apfelbaum
Thanks Ando...
 
Chavez_US
Ando, what do you mean by this statement, "- when "trees" are in right position then you can delete trap objects."

I have turned on "Show Subentities," and it will not allow me to delete trap objects...i can only select and move them...

Also, it says to "link the trap object to the tree", not "associate" correct???

When i duplicate the tree and trap object from the originals (which i placed outside of the map) the trap object becomes skinny...and the same happens with the macetrap when i duplicate its tree and trap object...Is this what you experience too?

can you please look at my file structure and script declarations in my level.c to see if i did things correctly? I am attaching the file to this post...

Chavez_US
Chavez_US attached the following file:
vet_scriptstester.rar [4.41 MB, 554 Downloads]
Edited by Chavez_US on 08-11-2011 06:25
 
Ando
I am little out of time now, but will check it hopefully tomorrow.
 
Chavez_US
Thank you for your time looking into my level file...it has everything you would need...
 
Chavez_US
ando?
 
KostiCZ
Ando is busy man, try to catch him on skype or PM him. Wink
Signature________________________________________________

2LT William Theolinus "KostiCZ" Boner Jr.
LRRP Squad Baker, Delta Team
cache.www.gametracker.com/player/KostiCZ/63.143.47.189:2302/b_560x95.png
 
Teamrespawn.cz
Ando
Chavez_US wrote:
ando?


Working on it.

EDIT:
bugs:
- download and replace tree object for whip trap. I added wrong tree to attachment of whip trap script attachment before ( fixed now )


- in LEVEL.C is some wrong names
whiptrap#0 > _whip_trap#0 ( must match with trap name in map )
macetrap#0 > _mace_trap#0 ( must match with trap name in map )
__MaceTrap.c > _MaceTrap.c ( must match with c file name )


- first tree object name must end with 0 (_whip_trap_tree#0 and _mace_trap_tree#0)


- need to delete tree objects outside of map or just unlink trap from it.


Attached fixed version of your test map here too.
Ando attached the following file:
fixed_vet_scriptstester.rar [4.35 MB, 570 Downloads]
Edited by Ando on 12-11-2011 20:49
 
Chavez_US
Thank you soo much Ando,... Smile
 
apfelbaum
Hey Ando, this happens to me when I try to finalize my map...I followed your sound curve tutorial.

i39.tinypic.com/241t545.png
 
KostiCZ
apfelbaum wrote:
Hey Ando, this happens to me when I try to finalize my map...I followed your sound curve tutorial.

i39.tinypic.com/241t545.png



Use following line in your sound.c script header:


extern void SC_SND_CreateCurveSound(char *anm_filename, dword snd_id, float max_play_dist, BOOL apply_env_volume);

or use the newest sc_global.h file
Signature________________________________________________

2LT William Theolinus "KostiCZ" Boner Jr.
LRRP Squad Baker, Delta Team
cache.www.gametracker.com/player/KostiCZ/63.143.47.189:2302/b_560x95.png
  x 2
 
Teamrespawn.cz
Ando
I finished today my huey script with synchronized seats. Now just need to make small improvements and test it more.
Currently tested only with 2x editor.

www.vietcong.info/portal/images/photoalbum/huey_seat_test.jpg
  x 2  x 1
 
apfelbaum
hihi, now we have you two time Smile
 
KostiCZ
Tester KostiCZ reporting for duty, sir FAW
Signature________________________________________________

2LT William Theolinus "KostiCZ" Boner Jr.
LRRP Squad Baker, Delta Team
cache.www.gametracker.com/player/KostiCZ/63.143.47.189:2302/b_560x95.png
 
Teamrespawn.cz
Ando
KostiCZ wrote:
Tester KostiCZ reporting for duty, sir FAW


Good, but I need more one day. Searching options to add some death animation if player is killed in chopper.
 
Jump to Forum:
Similar Threads
Thread Forum Replies Last Post
Multiplayer Game Script Vietcong Tech Talk 4 22-06-2019 19:31
apfelbaums maps discussion Maps & Mapping 21 21-09-2016 19:26
Ando door script Maps & Mapping 4 25-10-2015 19:50
ADM script Maps & Mapping 3 03-12-2014 14:23
Waterstation - DM script Maps & Mapping 5 20-07-2013 02:18
Login
Username

Password



Not a member yet?
Click here to register.

Forgotten your password?
Request a new one here.
Render time: 0.53 seconds - 93 Queries 5,472,626 unique visits