Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
Well, i'm not expert (only scripting arma 6 weeks) BUT i see many problems with each of your code segments.. looks to me like you have taken some code and tried to alter it without understanding syntax or what each line of code actually does.. that said i could be wrong lol..
anyhow.. heres what i see..
init.sqf is calling "startgameoptions.sqf";
"startgameoptions.sqf"; does some stuff but what stands out to me is that the script sets damage 1 to all units (kills them) everytime a player connects and init.sqf runs..
at the bottom of this script it calls "eventhandlers.sqf"
each client calls this script BUT the script is only actually executed on the server..
once the server runs it, it doesnt do anything or shouldnt as TO ME the syntax of the code inside "eventhandlers.sqf" is wrong.. the event handler code maybe correct who knows..
but because its only running on the server.. the var player doesnt exist, your looping allunits
but adding the eventhandler to player which doesnt exist on the server..
i have rewrote the "eventhandlers.sqf" code BUT barring the above problems as to the way the scripts are called.. i cant see why you want to add the eventhandler to dead units anyway.. (they are added after they died so no score is added)
it needs rewriting from scratch really calling the scripts from the server for none human players and local on each clients machine to add the eventhandlers.. more thought needed about implimentation.. :)
here is how i think the "eventhandlers.sqf" should be.. (although it will never work as said above)
proper ghetto, it all needs rethinking pal.. i pasted the above just to show syntax of a foreach loop.
i do not mean to offend, just saying what i see, like i say im no expert and if im wrong
i will also learn something here today :)
Domino.
thank you. while im looking over everything youve written ill explain why a few things are like they are. first thing answering what ive quoted.
its set to run after it kills all the players because thats what starts the game, in the begining before that right as the mission is loaded and players are ingame they spawn in a small building where they cant move, only the group leaders of opfor/blufor are outside and are able to walk upto the Ai player that i have added a bunch of addActions to. what that does is i use him to set the game settings, such as score to win, weapon choosing allowed or not allowed, and to play at day or night time. each setting gets displayed in a hint everytime a option is selected(ill display screenshots at the bottem) and then once all the options are selected it kills all the players and they respawn to their base/spawn points and the game starts. ill show all the code that i have(its ugly)
init.sqf
startgameoptions.sqf (this only displays the hints to the player who chooses each option and runs the event handlers, pretty much it only works for whoever selects any options)
gameend.sqf
i can see you have put some work into this.. however i think you need to learn some fundermentals about how the server/client information is sent and received by both
to keep server + clients in sync with each other.
hmmm, i cant see any interaction with the server from the client, so as far as i understand it, every option a player chooses is actually local to there client, it doesnt get updated to the server.. if it isnt updated to the server it also isnt updated on each players client (game) as its local to that client changing the option via the action menu value..
what will happen (if it works) is this..
player 1 will kill 3 so you would think global kills is 3 for everyone on the server.. but its not..
its actually only 3 for player 1, everyone else is still on zero.. (or the amount that each player has killed, they will all have different scores i think)
when a player kills an enemy you need to send that information to the server and THEN server updates the kills var globally for each player.. using publicvariable, you send the kill information from the client (player) using publicvariableserver to send it to the server from the client. There is actually a little bit more to it, that is just those two tit bits of info.. regarding info to server and vise versa.
you just have to think of each player as a seperate entity to the server, the server sends some info to the client, like waypoints, triggers, markers, server spawned units etc, if there is any info you need to send to each client, you have to manually send it to the server and then the server sends it to everyone else..you also have to tell the server to send it to everyone aswell, its not that difficult once you understand the server/client relationship pal..
regards your lil game mode, i would break it down from the top, prolly cough "most" of your code is re-usable when put into correct syntax and called at the correct place when placed in readable functions..
so you say squad leaders have free roam to set options for the game and everyone else spawns in a building not able to move until the game is started..
i would first get this working correctly.. break it down, have an sqf file that is only run on the server only server code in this file, this is run first, then have another sqf that only runs on the client.
learn this.. its the server setting a global var on all clients.
each time vUpdateMission_Score is changed if you use publicVariable "vUpdateMission_Score"; it will update all clients with the new value.
you can use publicVariableServer "vUpdateMission_Score"; to send the value from the client
to the server..
once you start learning and looking at how ti works, no doubt you will know what you have to do.. :)
from
"vUpdateMission_Score" addPublicVariableEventHandler {
systemChat str vUpdateMission_Score;
};
i call a function and use isserver do this else client do this.. :)
hope i helped pal..
Domino
well what i do is run a dedicated server as well as my client on the same machine.. to test multiplayer stuff, i find that running the game from the editor in mp gives me unpredictable results to what i was expecting. only sure way to test multiplayer scripts is to export the mission and start it on the dedicated server.. then connect and test..
i havent really read or seen many tutorials, google is my friend :)
what i did in the first month is extract missions that i liked playing
to see the code, id see something i liked and follow the functions through the code to see how it works etc, this way i start to reconise and remember function names and how they are used.
most importantly it taught me structure and how the server/client stuff works.. i still do not fully understand it but i now know enough to get myself by. :)
i am also really doing the same as you, writing bits and peices here and there to learn it better. :)
Domino
seeing as you showed me your mission, i thought i would return the favour and show you what i am working on, i still have a hell of a long way to go yet its very much early WIP..
{LINK REMOVED} download link
what is it: its framework for modular random mission generation, basically it will create X amount of user defined missions at random towns/cities across the map. you will be able to add it to existing missions easy to run along side said mission.
it is made to be modular so any missions an admin adds are self contained to a specific folder, missions can be anything you want.. i dont know if i will release a version with my missions but i will put the framework up somewhere when its complete.
im trying to make it as simple as possible to create a mission, so i have been adding lots of functions to make it easy to do things like.. spawn enemy infantry in a mission area and give them patrols, add simple secondry missions to the main mission, helo evacs, basically create what ever is needed for the mission..
ive added simple options so you can blacklist towns or use favourite towns or just use towns you specify, admins will also have the option to create a specifc mission in a specific town OR just quit/remove a mission.
99% of the code is on the server with very little being client side.. i think i send a little to much info to clients which i am going to slim down a little but its nothing really.. i say that because its mostly for JIP players. (join in progress).
the server starts the missions and it will auto clean up all markers, triggers, units everything when the misison ends or is removed.
IF YOU GOT THIS FAR DOWN IM KINDA IMPRESSED :)
i guess you want to know how it all works..
well first take a look in the folder
\random_missions\mission_defines\core_mission_types.sqf
this is where mission makers define there missions, the server will randomly pick one of these vUserMissionTypes and create the mission in a random town. town markers are auto generated when the server starts, you do not have to define them, you can however add your own markers to the map and add the marker names to an array and those positions will also be used to generate a random mission also..
so once you define what missions can be used you set up another simple array in
\random_missions\mission_defines\core_missions.sqf
in there you just have to add some simple information about the mission (1 IF statement and a simple array for each mission type specified above, this array also contains the sqf path that starts the mission but also the sqf file path that ends the mission when its complete or is cancelled/removed.
thats it, (nearly) :D
all you have to do then is create the mission in code in the specified file above that starts the mission. the server monitors the task state of each mission and acts accordling like if the mission task state is set to cancelled it will inform all players it was cancelled and clean up the mission (remove all markers, triggers, units anything that is related to that mission, same for completed etc. the server maintains the mission count so say you set the option to have 5 missions, the server will start 5 different random missions in 5 different towns, once a mission is completed/removed the server will start a new random mission in a new random town.
a mission town will NOT be used twice (unless specified in favourite towns) so each town is used in a random sequence.
like i say its very early wip ( 5 weeks into coding from start) BUT the fundermentals are there its all working in mp/dedicated and single player, i keep changing what im working on daily (which is a bad thing to do) like this morning i was hammering out the assets but then earlier this evening i was told how i could get arrays of compositions from the eden editor, so i played with that in debug_functions.sqf, those 2 composition functions are VERY MUCH needed for this type of addon/mod means i can create templates of enemy bases and spawn them in on the fly or remove them.. very excited about that.. :)
anyway.. i posted this WIP so you can see my coding and "maybe" learn something from it
to help with your mission :)
there is tons of other usefull stuff in it, but im going from memory and not looking at my doc's hehe.. suffice to say when its complete myself and the players on my dedi think it will be something specail.. just hope i can pull it off and its everything i expect it to be.
:)
Give it a try and look at the coding, its not perfect but it will bet better over the coming weeks/months :)
apologies for wall of text.
Domino..
NONE of it can help me in real life :) although my friends think im some kind of computer genius, i tell them its nothing, they dont understand scripting/coding anything like that..
they could though if they give it a go.. its like cooking the more you do it, the better you get at it. :)
i can do my own scripting however actually suck at looking at others code and finding problems.. lol i can obviously see blatent mistakes etc.
im the one that needs help loool
hey i have a question cause im still having a hard time at this, would you mind writing something simple for me, such as have the client(for example bob/player 3) display a hint to the server saying *i have died* so that everybody in the server sees that hint when bob/player 3 dies?
or with an addAction, have it display a hint for everybody on the server when any player selects that addAction at any time?
hopefully that should get me on track, ive never struggled to wrap my head around something so much