var/players
mob
step_size = 8
Login()
usr << "Welcome to the game. A pre-alpha of the project, \"Hamster Rivals Hangout.\""
players++
if(players==1)
usr.host=1
usr << "You are the host of the game."
Problem description:
Is this an alright way to mark someone as the host of the game?
Also, I really want the player to be able to send a custom monster/enemy with its own custom icon, name, stats, Monster Card description and Monster Card picture; and it'll get added to a list of different custom monsters that the host of the server can choose which monsters to accept or refuse that they want added to the game.
I used all of the knowledge I have which is all from a Dragon Ball Z BYOND sourcecode that I got in very early year 2002, and wrote this code up so far:
mob/commands
verb
Submit_monster()
set category = "Create"
set name = "Send a custom monster to the host"
usr.monstericon = input("Pick the graphic of the enemy:","Icon",usr.icon)\as icon
usr.monstername = input("What will the monster's name be?")as text
usr.monsterstr = input("What will the monster's strength value be?")as num
usr.monsterdef = input("What will the monster's defense value be?")as num
usr.monsterpicture = input("What picture should be on the monster's rare \"Monster Card?\"")as icon|null
usr.monstercarddescription = input("What should the information about the monster say on this monster's \"Monster Card?\"")
//Look for the host in the server and add this information to the list of monsters that players have made
I haven't made a BYOND game in like since year 2002. Is there a way to make it so that a form pops up and asks the user for this information at once instead of one-at-a-time, or do I have to either do it this way or import a HTML form library (the one I downloaded and used in one of my BYOND games in year 2003) or is there some other way?
And how do I look for the host of the server? According to the dragon ball Z fangame source code from 2002, it would be like this:
for(mob/M in world)
if(M.host==1)
M << "Oh, so you're the host"
but that code isn't working too well in the project that I'm working on.
I've looked at the BYOND reference several times but its like looking at a dictionary of coding and I learned some stuff there but there's so much info there I'm not sure where to start.
How can I do all of this stuff with 2019 BYOND's coding standards? I keep copying and pasting code from my previous game that used modified coding from a DBZ BYOND game sourcecode that I got in very early year 2002, but when I copy and paste the coding into my new project that I started working on this month, a lot of the coding doesn't seem to work right.
You don't want to loop through the world for mobs, especially if you have other mobs that you've placed on the map or created through other means. Rather, you want to loop through just the players. One of the most common ways is to add them to a list on login.
Then in order to find them in the world, you would...
Next, you wanted to add all of that monster information to a list and send it to the host, correct? The problem I see is you're binding this information to the user, rather than to another object. The information would be lost if the user logged out. Buuut, if you make this information as a part of a new object, and then use that object to relay it to the "host," you could avoid that entirely.
Let's see...
Make an object with which you would change the variables of through the verb you made.
Adding this object to a world list, then allowing the "host" to see the list would be a good idea. You can display it in a multitude of ways.
One last thing I should add is you should handle the passing of "host" over to another player once the original host logs out, assuming this is a multiplayer session and will only be hosted on dream daemon by one person. Alternatively, you could make the world.host (the person using Dream Daemon to host your game) your "host" of the game, if you plan on letting people host it themselves.
This is just one of the many ways you could do this, and it's relatively basic. I don't recommend learning from old DBZ game source codes. Find resources that're newer to learn from!
If anyone wants to improve on this answer please feel free.
Edit: Clarified a few things