
Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 24, 2013 10:27 AM
Msg. 1 of 18
I noticed the (awesome) loadouts in firefight-descent, and I wondered Can this be done in multiplayer? I'm sure this has been asked to death, but I'm curious and I've been taking a crack at scripting it, with some sort of success. I wanna know whether it is fully workable in, say, a 16 person match.
|
|
|

cyboryxmen
Joined: Nov 7, 2010
--CG artist-- New mission. Refuse this Mission!
|
Posted: Apr 24, 2013 10:34 AM
Msg. 2 of 18
You do realise that there is already a scripting thread right? The menu is definitely possible but it would be a pain to keep track of all the players as player numbers change frequently(though not entirely impossible). Figure out a way to do that and you just need a few more lines of code to implement this: one to take away the player's weapon and another to give the player their selected weapons. -Zekilk
|
|
|

Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 24, 2013 11:31 AM
Msg. 3 of 18
Yeah I've been on there and it's real good, but I just wanted to know if I'm plain wasting my time. Though I'm having issues, as to how to make buttons function - new to both scripting and widgets =S. Once I get them working, and figure out removing and giving weaps to peeps, I'll slap it on a bloodgulch *shock horror* and public beta it out and get ppl to try and make it not work right, and iron out issues. If all works out that is...
|
|
|

grunt_eater
Joined: Jan 26, 2011
Everything except biped rigging.
|
Posted: Apr 24, 2013 12:23 PM
Msg. 4 of 18
Sure, it's possible. The only thing is you'll need to be able to detect local player, i'm still working on doing this myself. But basically, you detect local player, save them to a global, then in your scenario file create a few player starting profiles, we'll call them loadout1, 2 and 3. Add 1 to health and shields, add the weapons you want, a good ammo number for each, some grenades if you like, and save. Now we've got our loadouts, and they're named. So we create a script. (global unit p1) ;;the global we'll set to be the local player.
(script dormant artillery1 (player_add_equipment "p1" "loudout1" 1) ;;A dormant script that will be activated by the loadout button that takes the global storing the local player(the local player is the player on your computer, someone else's local player is the player on their computer, it is not the same as your local player) our first loadout, and put's the two together. ) (script dormant artillery2 (player_add_equipment "p1" "loudout2" 1) ;;The same as the last script, just with the second loadout. ) (script dormant artillery3 (player_add_equipment "p1" "loudout3" 1) ;;I think you get the idea )
So now we have our loadouts, our script adding them to our player waiting to be activated by the button, now we have to link those widgets(buttons) you extracted from the firefight map to the scripts. locate and open them, go down to where it says "script" (under the event's handler) and put in the name of your script. If it's at the top of the selection list, put in the name "artillery1" without quotations. If it's the middle button put the name "artillery2". You get the idea. Now add those widget's in the way they did in firefight descent and add in a script that detects if the local player is dead, and if so then display the buttons. If not, hide them. Once again, the most important part of this is that you HAVE to be able to detect the local player. And i'm not sure how to do this. But i'm sure you could ask Kirby for a detailed walk through. He's told me a way to do it before, but i can't remember, and i never got a chance to test it :P I just read something i missed. You don't need to remove weapons, just add the player starting profiles and you're good :) Edited by grunt_eater on Apr 24, 2013 at 12:28 PM
|
|
|

Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 24, 2013 12:52 PM
Msg. 5 of 18
I had it semi working, in that I got the buttons to show up and be selectable, disappear and all that, the only thing truly holding me back (other than the local player thing you wrote) is the fact I couldn't get the player_add_equipment line to work, always complained about invalid unit...
PS thanks bro Edited by Stevedoggen on Apr 24, 2013 at 12:53 PM PPS Hey grunt, would this be the command your thinking of?
player_local_get returns the local player's player-list-index returns -1 if no local player detected. Edited by Stevedoggen on Apr 24, 2013 at 12:58 PM
|
|
|

grunt_eater
Joined: Jan 26, 2011
Everything except biped rigging.
|
Posted: Apr 24, 2013 02:07 PM
Msg. 6 of 18
Okay, first, can i take a look at that line so i can see what you're using for the unit? Second, that command doesn't exist for stock CE. Are you using OS?
|
|
|

kirby_422
Joined: Jan 22, 2006
Apparently public enemy number 1?
|
Posted: Apr 24, 2013 02:33 PM
Msg. 7 of 18
Quote: --- Original message by: Thorolf Kveldulfsson You do realize that player_add_equipment does not even work in multiplayer, right? It does work, it just is required to run on every single persons PC since it doesn't sync. Anyways, it would be easiest just to have each person start out in spawn rooms unarmed, where they walk up to switches each relating to a loadout. They click it, they are teleported to a tiny room with just those items, they pick em up on contact, teleported out half a second later. You're gonna require the client to have physical interaction with the level to trigger stuff, or else the host wont know.. Unless you want to go the rcon route.
|
|
|

Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 24, 2013 11:30 PM
Msg. 8 of 18
Quote: --- Original message by: grunt_eater that command doesn't exist for stock CE. Are you using OS? I have other elements of scripting that are using OS, so I figured I may as well. I'll put up what I have soon, I'll comment the crap out of it so yall understand where I'm coming from. and kirby what exactly is rcon? I heard it around but have no idea what it is...
|
|
|

kirby_422
Joined: Jan 22, 2006
Apparently public enemy number 1?
|
Posted: Apr 24, 2013 11:46 PM
Msg. 9 of 18
rcon is intended for server administration and moderation. Any player who knows the rcon password can sent console commands to the host. Its intended for 'sv' (server) commands, like kicking players, Message Of The Day, changing the map, etc. Anyways, by having a preset rcon password in the map, it will allow scripts to send information from the clients directly to the host. Doing so however, removes all security since its a set password. Anyone playing the map can do whatever they want, like banning people, closing the server, etc. If you do it, chances are nobody with a dedicated server would be willing to host it just because it compromises their own security. Heres what hs_doc says about it: (rcon [rcon password] [command]) Sends a command for server to execute at console. Use \" to send quotes.
(sv_rcon_password [remote console password]) Sets the server remote console password. If no password is given, displays the current password. Enter "" to disable rcon.
|
|
|

Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 24, 2013 11:58 PM
Msg. 10 of 18
Then no, rcon is outta the question for me. I ain't touching it.
and question (need answer asap) what form of output does local_player_get give? a number or a string?
and how does one get a global string or short/long number to be used with sv_say or something else that actually tells me it's data, cause I need to know what I'm using to script for it -_-
My currently broken and incomplete script:
(global long death_status 0) (global string player "") (script startup local_unit (unit(local_player_get)) ;; this makes the assumption that the output is Player0 and not 0 (set "player" (local_player_get)) (sv_say "player") ;; I think this will say "player" instead of the string 4 lines up. ) (script continuous loadouts (sleep_until (!= (player_data_get_integer 0 "deaths") death_status) 10) (set death_status (player_data_get_integer 0 "deaths")) (display_scripted_ui_widget loadout_system) ) (script dormant loadout1 (player_add_equipment "player" loadout1 true) ) (script dormant loadout2 (player_add_equipment "player" loadout2 true) ) (script dormant loadout3 (player_add_equipment "player" loadout3 true) ) (script dormant loadout4 (player_add_equipment "player" loadout4 true) )
Currently, OS Sapien doesn't understand local_player_get. rereading it told me it gives a short value, so ill adjust to that... Edited by Stevedoggen on Apr 25, 2013 at 12:05 AM
It is player_local_get not local_player_get. That is a major mess up on my part Edited by Stevedoggen on Apr 25, 2013 at 12:07 AM
|
|
|

kirby_422
Joined: Jan 22, 2006
Apparently public enemy number 1?
|
Posted: Apr 25, 2013 12:10 AM
Msg. 11 of 18
Quote: --- Original message by: Stevedoggen Then no, rcon is outta the question for me. I ain't touching it. Then say good bye to your Widget idea then. Quote: --- Original message by: Stevedoggen(global long death_status 0) (script static unit local_unit (unit (player_data_get_object (player_local_get) slave_unit))
(script continuous loadouts (sleep_until (!= (player_data_get_integer (player_local_get) deaths) death_status) 10) (set death_status (player_data_get_integer (player_local_get) deaths)) (display_scripted_ui_widget loadout_system) ) (script dormant loadout1 (sleep_until (!= (unit_get_health (local_unit)) -1) 5) (player_add_equipment (local_unit) loadout1 true) ) (script dormant loadout2 (sleep_until (!= (unit_get_health (local_unit)) -1) 5) (player_add_equipment (local_unit) loadout2 true) ) (script dormant loadout3 (sleep_until (!= (unit_get_health (local_unit)) -1) 5) (player_add_equipment (local_unit) loadout3 true) ) (script dormant loadout4 (sleep_until (!= (unit_get_health (local_unit)) -1) 5) (player_add_equipment (local_unit) loadout4 true) ) Go with that. Anyways, it'll only work if the host is the only one playing just because of the fact you have player_add_equipment with nothing to sync it, plus the fact that clients aren't rcon'ing in the info so they can receive the weapons they select.
|
|
|

Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 25, 2013 12:22 AM
Msg. 12 of 18
Thanks. I'm determined but. and heck, if I succeed, awesome, if not, I got some practice scripting, and your script to fall back to.
|
|
|

Jesse
Joined: Jan 18, 2009
Discord: Holy Crust#4500
|
Posted: Apr 25, 2013 12:57 AM
Msg. 13 of 18
Kirby is a might man. If he says it can't be done a certain way, then it can't period
|
|
|

Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 25, 2013 02:50 AM
Msg. 14 of 18
Quote: --- Original message by: Jesse Kirby is a might man. If he says it can't be done a certain way, then it can't period Don't be like that Jesse. You never know. Maybe I'll surprise ye both, ay? =)
|
|
|

game user10
Joined: Dec 9, 2011
Who is the Overseer?
|
Posted: Apr 25, 2013 06:03 AM
Msg. 15 of 18
Does player_add_equipment remove the player's current equipment?
|
|
|

Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 25, 2013 06:36 AM
Msg. 16 of 18
with player_add_equipment <unit> <starting_profile> <boolean> if the boolean is true, it replaces what the player has, and if it's false, it will add it.
|
|
|

Jesse
Joined: Jan 18, 2009
Discord: Holy Crust#4500
|
Posted: Apr 25, 2013 11:40 AM
Msg. 17 of 18
If you can do what Kirby said is impossible, dsalimander will suck your cox.
|
|
|

Stevedoggen
Joined: Jan 14, 2013
#Byf4Lyf
|
Posted: Apr 25, 2013 12:23 PM
Msg. 18 of 18
Quote: --- Original message by: DSalimander My mouth is moistening just thinking about it. 
|
|
|
| |
|
|
 |
|