ID:179778
Nov 8 2001, 11:43 am
|
|
I have a question, will someone tell me what I would need to look up... or maybe even the code for makeing a 2 player game, like, just 2 players, kinda like XO where there is a game board and they players take turns and stuff... =) can someone tell me plz
|
In response to Nadrew
|
|
Nadrew wrote:
You would have to make a global var which is checked at login and if that var is over 2 it doesn't let a person in > ok then how would i make it so they have to take turns? like uh something like mob/var/turn = 0 then have that increase every time the player makes a move and then it becomes one, and the other players becomes 2 or something? |
In response to dbz73
|
|
There is a library for this on the Libraries page, maybe you should take a look at it and see if that's what you want.
|
In response to GateGuardian
|
|
GateGuardian wrote:
There is a library for this on the Libraries page, maybe you should take a look at it and see if that's what you want. you mean the take turns thing? thats not what i want |
In response to dbz73
|
|
dbz73 wrote:
GateGuardian wrote: Sure it is. You want the players to take turns; the TakeTurns library provides a simple way to accomplish this. |
In response to Vortezz
|
|
Actually... I think I'm looking into the same thing he is...
However... From what it seemed to me...The TakeTurns lib makes it so all players logged into the world have to take a turn... What I'm looking to do (and I assume he is as well) is to make it so only the two players who are in "combat" with each other have to take turns... Allowing all other players to go about their business outside of that fight... So it would seem that the TakeTurns lib won't work for our purposes... At least not from the surface as far as I can tell... But oh well... That's one of the last things on my list of "To-do's" so by the time I get to it I'll probably figure out a way... But I'd gladly take suggestions...as they'll also help out our friend here... |
In response to SuperSaiyanGokuX
|
|
you should read the Documentation, you can have it only envlove 2 players
|
In response to Pillsverry
|
|
Actually... I think that the page linking to the Take Turns library is slightly screwed up... There isn't a link to any documentation like some of the others have... And there really isn't any documentation included in the DL... So if there is documentation out there... None of us "newbies" can get it...lol All we get by clicking the "Open Project Files" link is the Number Guessing demo...
The actual library is out there, though...because the demo calls on it to work and the demo works... But I have no idea where to find the actual library itself... (I have an idea...the file name is obviously "Dan.TakeTurns"...but I'm not sure how to go about getting that file off of the server manually... So it really doesn't do much good to anyone...lol But from what I see of the demo... It's not what we're after... The demo creates a turn for everyone in the game world... They are automatically assigned a turn when they log in... This means that all players at any given time get a turn in the order of things... What I'm after is a system that only kicks into effect when two players agree to battle each other... Allowing all other players in the game to go about their business... I already have some ideas on how to handle it, though... And like I said it'll be a while before I need to implement it...so I'll hopefully figure it out by then... |
In response to SuperSaiyanGokuX
|
|
The actual library is out there, though...because the demo calls on it to work and the demo works... But I have no idea where to find the actual library itself... (I have an idea...the file name is obviously "Dan.TakeTurns"...but I'm not sure how to go about getting that file off of the server manually... http://www.byond.com/hub/hub.cgi?qd=hubIndex;hub=90 |
In response to Spuzzum
|
|
oops, I meant if you looked in the code
if you look in the code you will see this: mob/Login() world << "[usr] logs in." trn.AddPlayer(src) return ..() I`m going to take a shot in the dark here and say that this is what makes the whole world envlovled in the Take turns mob/Logout() world << "[usr] logs out." trn.DelPlayer(src) return ..() and that this is what takes a player out of the take turn as for documentation, I found this little treasure trove in the directory with the library on my PC: Turn Generator Author: Dan Version: 2 (2001-Apr-04) Version: 1 (1999-Jun-09) The TakeTurns data type can be used to run turn based games. Just add a few players and define actions to take place for the various events. For a very simple demo, check out Dan.TakeTurnsDemo . ------------------------------------------------------------ Public Functions: AddPlayer(mob/M) Call to add a new player to the game. DelPlayer(mob/M) Call to remove a player from the game. NextTurn() Call to move to the next player's turn. Halt() Call to pause the current turn. Resume() Call to resume from the previously halted turn. Restart() Call to restart the turn generator from the first player's turn. Overridable Functions: BeginRound() Called before the first player's turn in each round. Default action: none. BeginTurn() Called at the beginning of the current player's turn. Default action: inform the players. EndTurn() Called at the end the current player's turn, before the next player gets to go. Default action: none. ExpireTurn() Called when time has run out for the current player's turn. Default action: inform the players. WarnExpireTurn() Called when time is 3/4 out for the current player's turn. Default action: warn the player. |
In response to Spuzzum
|
|
Spuzzum wrote:
http://www.byond.com/hub/hub.cgi?qd=hubIndex;hub=90 Thanks...lol But I already know that that's there... However...the only thing that it links to is the demo... The actual library itself is not there... Nor is any documentation... But like I said...I know the actual library exists somewhere because that demo has the #include command to include it... But the file itself isn't available from that link... And the code for that demo is WAY too short to be the entire thing... There has to be more behind the scenes... The "Turn Generator" that it calls upon isn't defined in that code... So there has to be another file out there somewhere... That is unless that REALLY simple code is all it takes to have multiple players taking turns... But it just seems TOO simple to handle that task... And if it did...why would the top line of code read: "#include <dan/taketurns>" So the file "dan/taketurns" is what I need... |
In response to Pillsverry
|
|
AHA! I'm a bit embarassed to admit this... But I never even thought of digging around in the BYOND folder for the file I need... I just assumed that if it was there...it would be displayed... And since it wasn't shown in the file list for the demo...I figured I didn't have it...
Why didn't I realize that if the demo needed the file and included it that it simply HAD to be in the same directory as the demo? I dunno... Just never crossed my mind...lol So poof...right there...hiding in plain sight is the TakeTurns.dm that I needed...along with a link to that documentation page... Sheesh... *Makes a mental note to think things through a bit more before asking silly questions and making silly assumptions* lol Thanks for opening my eyes, though... [Edit]: Although I still think that it's meant to include the entire world in the turn rounds... Which is not what I want... I want the turn handling system to only apply to whatever players are locked in combat... So it'll take some fiddling with... But it looks like it may be a decent starting point... Although I may be able to find another way to handle it without using the library (or a variation thereof)... Like having some sort of variable in each possible verb that acts like a switch... Once one player selects his course of action for his turn...the variable is turned on and his opponent's is turned off... And vice versa... And if the switch is turned on (I.E. given a value of 1) it prevents them from using any of their action verbs... So they can't do anything until the other player performs his turn and their switch is turned off... So on and so on... |
In response to SuperSaiyanGokuX
|
|
[Edit]: Although I still think that it's meant to include the entire world in the turn rounds... Which is not what I want... I want the turn handling system to only apply to whatever players are locked in combat... So it'll take some fiddling with... But it looks like it may be a decent starting point... Actually, just make multiple Turn datums (the demo only creates one) and then you can update and modify them all. However, you'd need to change the announcements within the code from "world << " to "players << " or whatever list format the Turn datum uses. |
In response to Spuzzum
|
|
No need... I decided to go with my simple variable "switch"... It works so far while "playing" against my rudimentary enemy AI's... Nothing more than a couple of lines added to the end of each of my turn verbs:
src.TSwitch = 1 So once a player takes a turn...their TSwitch variable is clicked "on" and their opponent's is turned off... It then locks whichever player currently has the variable turned on from performing any of the turn actions by the following code which is now the first two lines of each turn event verb: if (TSwitch ==1) And like I said... So far it works just fine... Hopefully it will have the same effect once I actually get this thing up and running for Beta testing with actual other live players... I don't see why it won't, though... Thanks for the input, though... |
eg: