UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: Harry Bo21 on April 05, 2016, 08:28:12 am

Title: Notify GSC from CSC
Post by: Harry Bo21 on April 05, 2016, 08:28:12 am
Ok so ive seen various topics on this, none are clear and none fully explain

I can notify CSC from GSC, and I thought my method of doing the reverse was working but it isnt

A few people have told me that using :

Code Snippet
Plaintext
SetClientDvar

"in" csc - will always update the host,, regardless of who its used on, and this was the key to notifying GSC. By setting a 4 players DVARs, and collecting them all off the host in GSC

This however - must not be true, as ive done Iprints, im setting the correct dvar, and waiting in GSC for that DVAR, but its only working for the host - which means SetClientDvar is setting it on each client, and i cant catch that info in GSC

I saw a post by trem saying to use scriptMenuResponse in menu to catch and pass it on - i can find no examples of this used, and absolutely no info on it anywhere

anyone feel like cluing me in? This yet again means my perks are not working properly and now its effect project viking as i passed this faulty code on to redspace

If anyone could explain thatd be great. Saying "just use this" like i keep getting from people isnt helping, you "need" to show me how or say nothing... - to "just fly a spaceship you - just fly it" yknow...



this is the post where trem explains, he only shows the GSC and tells you about scriptMenuResponse - there is no example or explanation how to actually "do" that menu part tho...

https://ugx-mods.com/forum/index.php/topic,6745.msg73637.html#msg73637 (https://ugx-mods.com/forum/index.php/topic,6745.msg73637.html#msg73637)
Title: Re: Notify GSC from CSC
Post by: liamsa669 on April 05, 2016, 11:26:23 am
I saw a post by trem saying to use menuscriptedresponse in menu to catch and pass it on - i can find no examples of this used, and absolutely no info on it anywhere
he says scriptMenuResponse" not  "menuscriptedresponse"
since ive never looked into this... i can only tell u files too look into
raw\ui\controls_common.inc
raw\ui\popup_leavegame.menu
raw\ui\scriptmenus\invert_axis.menu
raw\ui\scriptmenus\invert_axis_pc.menu
raw\ui\scriptmenus\select_difficulty.menu
raw\ui\scriptmenus\special_features.menu

ill look into it after school if my ark server is still down :troll:
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 05, 2016, 12:23:44 pm
he says scriptMenuResponse" not  "menuscriptedresponse"
since ive never looked into this... i can only tell u files too look into
raw\ui\controls_common.inc
raw\ui\popup_leavegame.menu
raw\ui\scriptmenus\invert_axis.menu
raw\ui\scriptmenus\invert_axis_pc.menu
raw\ui\scriptmenus\select_difficulty.menu
raw\ui\scriptmenus\special_features.menu

ill look into it after school if my ark server is still down :troll:
yea typed from memory, have been searching the proper name. Coddmodd just sent me some stuff im looking into aswell but still way over my head
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 05, 2016, 01:22:55 pm
He does that, lol.

Have you seen this post?
https://ugx-mods.com/forum/index.php/topic,6745.0.html (https://ugx-mods.com/forum/index.php/topic,6745.0.html)


oops nvrmd, I see you had it there at the bottom
well it does look like its on the right track, just a bit confusing when your a menu baby

http://wiki.modsrepository.com/index.php?title=Call_of_Duty_5:_Menu_Modding_Basics (http://wiki.modsrepository.com/index.php?title=Call_of_Duty_5:_Menu_Modding_Basics)
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 05, 2016, 05:49:37 pm
come on someones gotta know... people have even stated they have done this...
Title: Re: Notify GSC from CSC
Post by: liamsa669 on April 05, 2016, 09:23:53 pm
so... if im reading it right, u should have ur csc set 4 dvars for each player (maybe use a for statement to make it the # of players) then set the variable to true or whatevs... then in gsc have a looping check to see if the dvar is true or the designated variable? The only thing that i would think that would mess with ur process is the setting dvar part... If i remember correctly when i was testing dvar stuff, u need to have the dvar defined b4 the game starts, sort of like xmodels. Idk if thats tru or not, its been a while since i last scripted anything in gsc, let alone with dvars.
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 06, 2016, 10:38:18 am
so... if im reading it right, u should have ur csc set 4 dvars for each player (maybe use a for statement to make it the # of players) then set the variable to true or whatevs... then in gsc have a looping check to see if the dvar is true or the designated variable? The only thing that i would think that would mess with ur process is the setting dvar part... If i remember correctly when i was testing dvar stuff, u need to have the dvar defined b4 the game starts, sort of like xmodels. Idk if thats tru or not, its been a while since i last scripted anything in gsc, let alone with dvars.
fancy helping me out with that sometime :)

im at a cross roads now, it means the last perk release is broken, so i either need to revert to the old way or fix this

and setDvar doesnt work in csc on clientdvar - which is my issue

Title: Re: Notify GSC from CSC
Post by: MakeCents on April 06, 2016, 12:16:31 pm
I forgot to check my stuff last night to see if I do this at all, I don't think I do, cause I think I always found another way around it, but what liamsa669 said makes sense to try. You say it always updates the host/level, well then give the host/level 4 dvars to check and set then. Just one for each possible player? mydvarplayer1, mydvarplayer2, mydvarplayer3, mydvarplayer4...? Then do whatever you want in gsc... no? That's what he is saying right?
I'm not sure what you are trying to do to suggest any alternatives.
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 06, 2016, 12:31:51 pm
I forgot to check my stuff last night to see if I do this at all, I don't think I do, cause I think I always found another way around it, but what liamsa669 said makes sense to try. You say it always updates the host/level, well then give the host/level 4 dvars to check and set then. Just one for each possible player? mydvarplayer1, mydvarplayer2, mydvarplayer3, mydvarplayer4...? Then do whatever you want in gsc... no? That's what he is saying right?
I'm not sure what you are trying to do to suggest any alternatives.
this is what i thought i was doing before, let me explain

i was told that doing setClientDvar for any player in CSC updates the host, so i had 4 dvars on that host - one for each player, that i was checking in a loop

but setClientDvar actually doesnt and is infact unique to that player ( which makes sense really ) and "setDvar" is a unknown function in CSC - and you cant get client dvars in gsc so im not sure how to go about it basically

pretty much i need player 2 - to be able to update player 1s dvars, or handle it globally, both i cant find a solution for

its really annoying coz every other aspect is working, the timing out, dissapearing when you die, picking it up etc,, just not notifying back so i can reward the player with their free grenades or whatever
Title: Re: Notify GSC from CSC
Post by: MakeCents on April 06, 2016, 12:41:45 pm
this is what i thought i was doing before, let me explain

i was told that doing setClientDvar for any player in CSC updates the host, so i had 4 dvars on that host - one for each player, that i was checking in a loop

but setClientDvar actually doesnt and is infact unique to that player ( which makes sense really ) and "setDvar" is a unknown function in CSC - and you cant get client dvars in gsc so im not sure how to go about it basically

pretty much i need player 2 - to be able to update player 1s dvars, or handle it globally, both i cant find a solution for

its really annoying coz every other aspect is working, the timing out, dissapearing when you die, picking it up etc,, just not notifying back so i can reward the player with their free grenades or whatever

SetDvarBool() seems to be in csc, did you try that? (According to my list of csc functions people have provided)


Hmm, and this has to be done in csc?
Title: Re: Notify GSC from CSC
Post by: buttkicker845 on April 06, 2016, 12:45:44 pm
i never got around to trying this but i have always wondered if you set an entity variable in either gsc or csc will it be visible and be the same value in the opposite. so for instance could you make a variable in csc
Code Snippet
Plaintext
player.reward = "";
realwait(10);//i think realwait is the correct thing for csc
player.reward = "grenades";
and then do a loop in gsc to see when the variable has changed?
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 06, 2016, 12:46:35 pm
SetDvarBool() seems to be in csc, did you try that? (According to my list of csc functions people have provided)


Hmm, and this has to be done in csc?
i havent tried that actually, will check it

and no it doesnt "have" to be, but i imagined the performance enhancement behind it amoung other things

like setinvisibletoplayer seems sorta buggy, sometimes itll kill the fx playing on it sometimes it wont, and any mistakes can lead to other people picking them up when they shouldnt, plus in CSC can play sounds to one player only and more

was just looking to improve my vulture and make it manageable for proper use in WAW with less risk - plus call it a personal challenge

weve been talking in chat a lot about the advantages of csc, intrigued me
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 06, 2016, 12:47:13 pm
i never got around to trying this but i have always wondered if you set an entity variable in either gsc or csc will it be visible and be the same value in the opposite. so for instance could you make a variable in csc
Code Snippet
Plaintext
player.reward = "";
realwait(10);//i think realwait is the correct thing for csc
player.reward = "grenades";
and then do a loop in gsc to see when the variable has changed?
the gsc wont return that info - cant see it at all for the clients

essentially player.reward would return "undefined" on gscs side
Title: Re: Notify GSC from CSC
Post by: MakeCents on April 06, 2016, 12:53:56 pm
i havent tried that actually, will check it

and no it doesnt "have" to be, but i imagined the performance enhancement behind it amoung other things

like setinvisibletoplayer seems sorta buggy, sometimes itll kill the fx playing on it sometimes it wont, and any mistakes can lead to other people picking them up when they shouldnt, plus in CSC can play sounds to one player only and more

was just looking to improve my vulture and make it manageable for proper use in WAW with less risk - plus call it a personal challenge

weve been talking in chat a lot about the advantages of csc, intrigued me

Lol, okay, okay. I know blunt has made many strides with csc related things if he weighs in here. I've seen him do many player specific/unique things in csc using csc scripts and functions I would never had thought to look in and haven't had the time to learn more about.

I thought it might be for vulture. Other than the fx playing to just one player, I don't see any other advantages to use csc. But I'm sure I didn't think of everything. GSC can play sounds to only one player as well, player playlocalsound I think only plays to the player, and not 3d, unless you meant something else.


i never got around to trying this but i have always wondered if you set an entity variable in either gsc or csc will it be visible and be the same value in the opposite. so for instance could you make a variable in csc
Code Snippet
Plaintext
player.reward = "";
realwait(10);//i think realwait is the correct thing for csc
player.reward = "grenades";
and then do a loop in gsc to see when the variable has changed?

According to trem in that post, it goes as far as not even being able to see vars of a struct, if you set it on the csc side and then look at it on the gsc side. mind blown, lol.
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 06, 2016, 12:56:57 pm
Lol, okay, okay. I know blunt has made many strides with csc related things if he weighs in here. I've seen him do many player specific/unique things in csc using csc scripts and functions I would never had thought to look in and haven't had the time to learn more about.

I thought it might be for vulture. Other than the fx playing to just one player, I don't see any other advantages to use csc. But I'm sure I didn't think of everything. GSC can play sounds to only one player as well, player playlocalsound I think only plays to the player, and not 3d, unless you meant something else.
some of these things i was unaware of, but the main advantage i was going for is reducing the ent count as the csc ent counts towards a seperate gspawn limit, so i thought would be ideal for four players without limiting how many drops could be around at once

i had used it on widows too btw, and was hoping to find more uses for it - the fx aspect of vulture is the only thing working properly through csc atm
Title: Re: Notify GSC from CSC
Post by: MakeCents on April 06, 2016, 01:00:55 pm
some of these things i was unaware of, but the main advantage i was going for is reducing the ent count as the csc ent counts towards a seperate gspawn limit, so i thought would be ideal for four players without limiting how many drops could be around at once

i had used it on widows too btw, and was hoping to find more uses for it - the fx aspect of vulture is the only thing working properly through csc atm

Good luck with that. I recently made a script that gets rid of the need for triggers, which has reduced my ent count tremendously. Of course I have the whole can't use &"strings" thing now but 100+ less ents was worth it, lol.
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 06, 2016, 02:58:57 pm
didnt mean to mark that as best answer lol

and yea using distance checks and traces ill bet, i did something similar
Title: Re: Notify GSC from CSC
Post by: MakeCents on April 06, 2016, 03:11:37 pm
didnt mean to mark that as best answer lol

and yea using distance checks and traces ill bet, i did something similar
Lol

Well for the menu hintstring yeah, but I meant I replaced the waittill("trigger") with my own version that returns the player that triggered it, and removed all the trigger uses from the map. If your trying to save on ents, its saves a lot. In one version I replace the triggers with a script_struct.
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 06, 2016, 03:21:41 pm
Lol

Well for the menu hintstring yeah, but I meant I replaced the waittill("trigger") with my own version that returns the player that triggered it, and removed all the trigger uses from the map. If your trying to save on ents, its saves a lot. In one version I replace the triggers with a script_struct.
definitely something to consider, i had made my own triggers using trigger radius so i could display different hints to people andregister when its "used" rather than touched

did have distance checks instead of triggers, but this was a long time ago before i knew how to use the trace stuff, could revisit it i guess
Title: Re: Notify GSC from CSC
Post by: liamsa669 on April 07, 2016, 11:02:30 am
fancy helping me out with that sometime :)

im at a cross roads now, it means the last perk release is broken, so i either need to revert to the old way or fix this

and setDvar doesnt work in csc on clientdvar - which is my issue
i would love to... but ive never been able to get any csc script to work for me :D for some reason my csc is always replaced by the original script, no matter what i did. Ill try getting it working again, since this is a diffrent computer than the one i used when i last tried
Title: Re: Notify GSC from CSC
Post by: alaurenc9 on April 08, 2016, 02:30:58 am
Let me explain how CSC works as I have not seen anyone explain it right except treminaor yet.

CSC is not like GSC where all players share the same script. CSC has a different "version" for each player. Each player has it's own setup of definitions and variables. That is why GetLocalPlayers(); returns only one player every time you call it, even in coop. The whole thing is client specific. It returns the player that the CSC script is running for. The only reason it returns an array is for splitscreen on console, when there are multiple "local" players. That's why localclientnum on PC is always 0, or why when you look at bo1/bo2 scripts you notice 2D sounds are played on the client number of 0, because it is either the one player being 0 or splitscreen players hearing it from the same speakers so there is no need to waste time finding out the client number, just put 0 and they both hear it fine. That's also why if you look in Der Riese teleporter scripts and notice where it checks GetLocalPlayers().size is only 1, so it is not split screen, and it can use SetClientDvar for the one player only for the FOV aftereffect thing. So SetClientDvar in CSC will set the dvar for any local players in the CSC. But since it is PC and there isn't any splitscreen, SetClientDvar just works for the one player. In GSC, SetDvar and GetDvar are host-only. So when you SetClientDvar in CSC on the host's CSC mode, it picks up in GSC, but not for any other players. It is like typing something in on console in game. The only client-specific GetDvar besides the one in CSC is in menu. You can make a menufile where it just closes when it opens, and ScriptMenuResponse's the dvar. That way you can find out a dvar in GSC. But you can't run it on a loop, or "notify" something whenever, because everytime you open the menu, your game freezes and blurs with the mouse cursor for a split second, which is far from proper playing conditions.

SetDvarBool() seems to be in csc, did you try that? (According to my list of csc functions people have provided)


Hmm, and this has to be done in csc?
SetDvarBool and SetSavedDvar are both in CSC, and they behave the same way. Since CSC is client specific and not open for each player to share, they will just set the dvar for the one player.
some of these things i was unaware of, but the main advantage i was going for is reducing the ent count as the csc ent counts towards a seperate gspawn limit, so i thought would be ideal for four players without limiting how many drops could be around at once
Yes CSC g_spawn runs on a separate limit since it is client specific, which is why if you get a g_spawn in GSC, it will stop all player's games as you probably know, but it says the name of the players because there is also the event you get a g_spawn in CSC for only one of the players. Thats why it says the player's name if you ever wondered why.
i never got around to trying this but i have always wondered if you set an entity variable in either gsc or csc will it be visible and be the same value in the opposite. so for instance could you make a variable in csc
Code Snippet
Plaintext
player.reward = "";
realwait(10);//i think realwait is the correct thing for csc
player.reward = "grenades";
and then do a loop in gsc to see when the variable has changed?
Again, not possible since GSC things are for everyone to see based off the host, and CSC is just client specific.
I forgot to check my stuff last night to see if I do this at all, I don't think I do, cause I think I always found another way around it, but what liamsa669 said makes sense to try. You say it always updates the host/level, well then give the host/level 4 dvars to check and set then. Just one for each possible player? mydvarplayer1, mydvarplayer2, mydvarplayer3, mydvarplayer4...? Then do whatever you want in gsc... no? That's what he is saying right?
I'm not sure what you are trying to do to suggest any alternatives.
Again, won't work to CSC being client specific.

So no you cannot do this is what I am trying to say. Back when I started modding BO1 I tried this for days and learned everything about CSC. Don't waste your time on this like I did, it just doesn't work.
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 08, 2016, 02:47:29 am
actually codmodd has come back to me with a way
Title: Re: Notify GSC from CSC
Post by: DidUknowiPwn on April 08, 2016, 03:06:39 am
CSC -> SetClientDvar/SetDvar wtv
Menu -> execOnDvarInt -> openScriptMenu "oops dis_didguf"
GSC -> menuresponse menu oops dis_didbug response
Title: Re: Notify GSC from CSC
Post by: alaurenc9 on April 08, 2016, 09:37:03 pm
actually codmodd has come back to me with a way
You mean the GetClientDvar function they made with a menu? Yeah it works but you cannot loop it.
CSC -> SetClientDvar/SetDvar wtv
Menu -> execOnDvarInt -> openScriptMenu "oops dis_didguf"
GSC -> menuresponse menu oops dis_didbug response
execOnDvarInt? Hmm I thought of this too but where would I put it? What menu?
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 08, 2016, 10:06:04 pm
didnt mean to mark that - and no thats not what hes shown me

hes found some stuff that implies a way without menus at all by looking at the cod 5 scripts
Title: Re: Notify GSC from CSC
Post by: DidUknowiPwn on April 08, 2016, 10:10:55 pm
Yes CSC g_spawn runs on a separate limit since it is client specific, which is why if you get a g_spawn in GSC, it will stop all player's games as you probably know, but it says the name of the players because there is also the event you get a g_spawn in CSC for only one of the players. Thats why it says the player's name if you ever wondered why.Again, not possible since GSC things are for everyone to see based off the host, and CSC is just client specific.Again, won't work to CSC being client specific.

So no you cannot do this is what I am trying to say. Back when I started modding BO1 I tried this for days and learned everything about CSC. Don't waste your time on this like I did, it just doesn't work.
G_Spawn is ran by each player.
If the host drops due to it then it drops all players because he's the host and there's no other connection being made.
Title: Re: Notify GSC from CSC
Post by: Harry Bo21 on April 08, 2016, 10:25:52 pm
G_Spawn is ran by each player.
If the host drops due to it then it drops all players because he's the host and there's no other connection being made.
except on BO1 i think, prob why hes confused ( or at least thats what lilrifa told me )

oh wait no just re-read and caught what you mean, if host is disconnected the others are too anyway