Modme Forums

Stupid question, can you “control” the same ent on the server and client side?

Game Modding | Call of Duty: Black Ops 3 | Scripting


Sleepy216:

Title pretty much describes it. I'm getting into client side scripting, and so I don't know a lot about it(getting better, I can actually make stuff happen haha).

In radiant there is a drop-down option on an ent called "client_server", so I'm guessing it's a one or the other type situation correct?

Thanks in advance for answering my obvious question.


Harry Bo21:

Client side means you can only reference it in csc and each player has their own copy of it

Dynamics in cod are individual, each person sees ragdolls and stuff differently ( you may see a zombie body somewhere, player 2 might see it elsewhere )


Sleepy216:

Client side means you can only reference it in csc and each player has their own copy of it

Dynamics in cod are individual, each person sees ragdolls and stuff differently ( you may see a zombie body somewhere, player 2 might see it elsewhere )

Thanks for the info, I appreciate it!


Spiki:

you can with clientfields if you want something preprogrammed to happen to the ent in csc


Sleepy216:

you can with clientfields if you want something preprogrammed to happen to the ent in csc

Thats what I have been using, I just wasn't sure if there were better options for certain things that you need to use server and client functions on.

For example in Panic Center(the map from waw) there is a vent you have to shoot to get to the pharmacy.
I wanted to make it an easier find, so I used DR to give it an outline. However I needed to be able to "launch" it as well.
When I tried launch and physicslaunch in csc it crashed. I assumed that'd be the case because scriptapi said it's a server function(sorry if "function" isnt the proper term, I don't know all the scripting terminology). However some "server" marked functions still work in csc so I tried it out. I couldn't get DR to work on dynamic ents so that was out of the question(plus now that I know dynamic ents are instanced, that wouldn't have been an elegant solution)

I ended up doing some jank method that deletes the client side model at the same time as I launch one from the gsc side, but I feel like there has to be a better way to do it.


Harry Bo21:

Thats what I have been using, I just wasn't sure if there were better options for certain things that you need to use server and client functions on.

For example in Panic Center(the map from waw) there is a vent you have to shoot to get to the pharmacy.
I wanted to make it an easier find, so I used DR to give it an outline. However I needed to be able to "launch" it as well.
When I tried launch and physicslaunch in csc it crashed. I assumed that'd be the case because scriptapi said it's a server function(sorry if "function" isnt the proper term, I don't know all the scripting terminology). However some "server" marked functions still work in csc so I tried it out. I couldn't get DR to work on dynamic ents so that was out of the question(plus now that I know dynamic ents are instanced, that wouldn't have been an elegant solution)

I ended up doing some jank method that deletes the client side model at the same time as I launch one from the gsc side, but I feel like there has to be a better way to do it.

It “crashed” because the model didn’t have a valid physics preset set in ape


eDeK:

Thats what I have been using, I just wasn't sure if there were better options for certain things that you need to use server and client functions on.

For example in Panic Center(the map from waw) there is a vent you have to shoot to get to the pharmacy.
I wanted to make it an easier find, so I used DR to give it an outline. However I needed to be able to "launch" it as well.
When I tried launch and physicslaunch in csc it crashed. I assumed that'd be the case because scriptapi said it's a server function(sorry if "function" isnt the proper term, I don't know all the scripting terminology). However some "server" marked functions still work in csc so I tried it out. I couldn't get DR to work on dynamic ents so that was out of the question(plus now that I know dynamic ents are instanced, that wouldn't have been an elegant solution)

I ended up doing some jank method that deletes the client side model at the same time as I launch one from the gsc side, but I feel like there has to be a better way to do it.

Does the "outline" work for you?
Just im trying to put a "outline" to the players always "activated", but i have all the body painted and i only want a "outline".
duplicate_render::set_dr_filter_offscreen( "player_green",  100, "player_green",  undefined, DR_TYPE_OFFSCREEN, P1_OUTLINE_MATERIAL, DR_CULL_ALWAYS );
self duplicate_render::set_dr_flag( "player_green", 1 );


Sleepy216:

It “crashed” because the model didn’t have a valid physics preset set in ape

Does the physics preset only matter if the model is set for client? So if I set a valid physics preset in ape, I can launch it in csc?
I can use the same model in gsc, use physicslaunch, and it works just fine.
Like I said, I am very new to messing with csc haha. I'm also not an expert by any means when it comes to scripting in general lmao.
I appreciate all the help by the way.

Does the "outline" work for you?
Just im trying to put a "outline" to the players always "activated", but i have all the body painted and i only want a "outline".

I quite literally spent 50+ hours trying to get them to actually outline and not be a solid color LMAO.
I figured out one reason(not sure if its the only reason) is because sitrepscan_enabled is set to SITREP_FRIENDLY_ONLY /4.
I couldn't figure out how to overwrite the sitrepscan because it was set in _zm.csc. Setting it in my own script wouldn't overwrite it for anything.
then Mike mentioned in his powerup delay that you can in fact override any script by removing them from the patch first.

After that I just changed the sitrepscan_enabled from:
self oed_sitrepscan_enable( SITREP_FRIENDLY_ONLY );
to:
self oed_sitrepscan_enable( SITREP_BEAST_MODE_AND_FRIENDLY );

I haven't done any testing in co-op just yet, so I don't know if changing that affects the player outlines already set.
If worse case I can just remove the player outline when they are far away/through walls.
I had to also rip _bb.gscc with hydra to allow my map to compile with _zm in my zone.


eDeK:

Got it! Thanks. I put this and work.
Now I need edit various things to get exactly what i want.

self OED_SitRepScan_Enable( 1 );

self OED_SitRepScan_SetOutline( 1 );

self OED_SitRepScan_SetLineWidth( 5 );

self OED_SitRepScan_SetSolid( 1 );

self OED_SitRepScan_SetRadius( 800 );

self OED_SitRepScan_SetFalloff( 0.1 );
By the way, if you have the cellbreaker of Spiki, look the "brutus_helmet.physpreset" in APE and look the CSC, maybe can help you with your model, idk.


Harry Bo21:

Gsc launch prob used some default


eDeK:

Harry how can i get in CSC the "player 1, player 2, player 3, player 4"?
Like this, but this is GSC.

players = GetPlayers();

player_1 = players[ 0 ];

player_2 = players[ 1 ];

player_3 = players[ 2 ];

player_4 = players[ 3 ];  
    


Harry Bo21:

Harry how can i get in CSC the "player 1, player 2, player 3, player 4"?
Like this, but this is GSC.
players = GetPlayers();

player_1 = players[ 0 ];

player_2 = players[ 1 ];

player_3 = players[ 2 ];

player_4 = players[ 3 ];  
    

Players = getplayers(0)

0 being local client number but in all circumstances it’ll be 0 anyway

This gets “your instance of” the other players


eDeK:

Im trying this...

Player 1 with "outline green".
Player 2 with "outline blue".
Player 3 with "outline red".
Player 4 with "outline yellow".

All players now have the "outline green".

How can i put the "player 2" with the "outline blue" ?
How can i put the "player 3" with the "outline red" ?
How can i put the "player 4" with the "outline yellow" ?

callback::on_spawned( &keylines_2d );

function keylines_2d( n_local_client_num, n_old_value, n_new_value, b_new_ent, b_initial_snap, str_field_name, b_was_time_jump )
{  
    if( self == GetLocalPlayer( n_local_client_num ) || n_local_client_num != self GetLocalClientNumber() )
    {
        self OED_SitRepScan_Enable( 1 );

        self OED_SitRepScan_SetOutline( 1 );

        self OED_SitRepScan_SetLineWidth( 5 );

        self OED_SitRepScan_SetSolid( 1 );

        self OED_SitRepScan_SetRadius( 999 );

        self OED_SitRepScan_SetFalloff( 0.1 );

        self duplicate_render::update_dr_flag( n_local_client_num, "green_line", true );

        self duplicate_render::update_dr_filters( n_local_client_num );          
    }      
}


Harry Bo21:

Im trying this...

Player 1 with "outline green".
Player 2 with "outline blue".
Player 3 with "outline red".
Player 4 with "outline yellow".

All players now have the "outline green".

How can i put the "player 2" with the "outline blue" ?
How can i put the "player 3" with the "outline red" ?
How can i put the "player 4" with the "outline yellow" ?

callback::on_spawned( &keylines_2d );

function keylines_2d( n_local_client_num, n_old_value, n_new_value, b_new_ent, b_initial_snap, str_field_name, b_was_time_jump )
{  
    if( self == GetLocalPlayer( n_local_client_num ) || n_local_client_num != self GetLocalClientNumber() )
    {
        self OED_SitRepScan_Enable( 1 );

        self OED_SitRepScan_SetOutline( 1 );

        self OED_SitRepScan_SetLineWidth( 5 );

        self OED_SitRepScan_SetSolid( 1 );

        self OED_SitRepScan_SetRadius( 999 );

        self OED_SitRepScan_SetFalloff( 0.1 );

        self duplicate_render::update_dr_flag( n_local_client_num, "green_line", true );

        self duplicate_render::update_dr_filters( n_local_client_num );          
    }      
}

Players = getplayers(0)


The update dr line


eDeK:

Harry in mode "update_dr_troll", ok!


Harry Bo21:

That’s literally the answer

Use a variable on that line instead of setting “green_outline”


eDeK:

Solved!
Thanks for reply Harry, anyways.