ID:168939
 
1. How do I make a verb that will set a game mode? I can make it so there is a world message saying the mode, but I need it to affect the game, like move people to certain places and give certain players differnt attribtes. Could someone give me an example of that? I don't need anything too specific, just an example showing how something of that nature is done.

2. Job ratios- I need a team/postion.rank balance system. Could someone please give me a sample code showing how to make it when someone joins a team and chooses a position, their rank will be randomly selected, but if certain ranks are taken like a leader spot, only one person can have it. Same as aboce, just a general demo is required, please.

Thanks...
1.) If i'm not mistaken you could set a world var or just a var with mode. Have a verb to pick the different modes. Then make a start game verb and you could probably do something like if(mode == 1) blah blah blah add the stuff you want to be done in that mode.

2.) Er.. I don't know how to do that at the moment.
In response to Justin Knight
I tried world var, but it didnt seem to world, I got errors too I believe...
In response to Bobthehobo
Try a global var, that worked for me.
In response to Justin Knight
Global var- could you explain that please?
In response to Bobthehobo
var/global/varname


Then acess the variable via
global.varname


As an example...

var/global/mode

mob
verb
Change_Mode()
if(!global.mode)
global.mode = 1
world << "World changed to mode ?"
else
global.mode = null
world << "World changed to mode ?"

mob
Login()
..()
if(global.mode)
src.loc = locate(1,1,1)
src << "World in mode ?"
else
src.loc = locate(1,1,2)
src << "World in mode ?"


As for your second question, i'm not really sure what you want, sorry, hope that helps.
In response to Holy Retribution
I would try something a little more like this.

 
var/global
mode
modetext

mob/host/verb
Set_Mode()
if(game == 1)//if the game already started
return
var/texter = input("Choose a game mode:") in list("Easy","Medium","Hard")
switch(texter)
if("Easy")
mode = 1
modetext = "Easy mode"
if("Medium")
mode = 2
modetext = "Medium mode"
if("Easy")
mode = 3
modetext = "Hard mode"
world<<"[src] has changed the game mode to [modetext]!"


Then you can use Holy's Login() code to change the world with the different mode locations, etc.
In response to Justin Knight
Yeah, I was just giving a quick example of how to use global variables, but your example is good, Justin, have to any idea what he was asking with his second question? It confused me and now its bugging me.
In response to Holy Retribution
It's hard to explain, he's talking about a randomized job select system. He wants probabibility coding to be able to pick a random job for people, but to return if a job such as group leader is already taken. The code he's asking for isn't difficult to make, now that I think of it.
In response to Justin Knight
Pretty much he needs lists for each job type, so it can load the list and check to see if the possition is taken?
Like...
var/Jobname[10]
if(Jobname[1])
src << "Rank 1 taken"

Or am I still off target here?
In response to Holy Retribution
Well, you got the right idea but he wants it to be randomized as well.

    var/pick=(rand(1,5))
if(pick == 1)
usr.job = "Machinegunner"
usr.loc = locate(10,5,1)

if(pick == 2 && !leader)
usr.job = "Squad Leader"
usr.loc = locate(8,2,1)
else if(pick == 2 && leader == 1)
usr << Leader is already taken, roll again.


That's my example, you don't have to use usr and it's just a rough example of what I think he's talking about. Sorry for the delay in the post, I had to go somewhere.
In response to Justin Knight
Well then for what I can see he/she wants, he/she would need this too, right?

var/global/list/MachineGunner = new
var/global/list/Medic = new
proc
Job(mob/M, type="Gunner", maxranks=5)
var/pick=rand(1,maxranks)
var/count
while(!M.rank)
if(type == "Gunner")
if(!MachineGunner[pick])
M.rank = pick
MachineGunner[pick] = M.name
count++
if(type == "Medic")
if(!Medic[pick])
M.rank = pick
Medic[pick] = M.name
count++
if(count >= maxranks)
M << "Sorry [M.name], all ranks of [type] have been taken"
return


And so on, still needs lots of tweaks, but its not my game to code, its his/hers, so I'll just throw something through together for him/her to look at.
In response to Holy Retribution
For one thing, Bob is definitely a male name. lol.. I don't know how you didn't pick that one up.
In response to Justin Knight
Yes I did, like 5 times, lol.

EDIT: We've posted so many times I was too lazy to scan up and I had lost track of who origonally started this, besides, I have a korean girl on my AIM who has screen names of Bob, and character names in games along the same lines.
In response to Holy Retribution
Sorry I wasn't looking for the word pick itself I was looking for the outcomes of pick.

EDIT: If a wacky korean girl is going to use bob in her name and someone calls her male, that's her problem. It's better to assume the obvious and then get corrected if the obvious was wrong.
In response to Justin Knight
You and me posting back and forths to each other turned a once tiny post, into a huge thread which I keep getting lost in x_x

Edit: I know your right, but as I said, I lost track of the origonal posters name anyways so I used both.


Edit2: And if we wanted to go over the top...
#define MAXRANK 10 //Can only be set at compile time, stopping any errors, but makes it easy to change something which is in multiple places
var/global/list/MachineGunner[MAXRANK] // Create empty lists with length of MAXRANK
var/global/list/Medic[MAXRANK]
proc
Job(mob/M, type="Gunner", maxranks=MAXRANK)
var/pick=rand(1,maxranks)// Pick a random number between 1 and MAXRANK
var/count // Create empty (null, 0) count var
while(!M.rank&&count <= maxranks) // While the person has no rank and the count is lower than the maxranks set by the proc at the top
if(type == "Gunner")
if(!MachineGunner[pick])
M.rank = pick
MachineGunner[pick] = M.name
count++
if(type == "Medic")
if(!Medic[pick])
M.rank = pick
Medic[pick] = M.name
count++
if(!M.rank)
M << "Sorry [M.name], all ranks of [type] have been taken"
else
M << "Congratulations [M.name], you are now a [M.rank] [type]!"
In response to Holy Retribution
Thank you, this helped a lot...
In response to Justin Knight
I have a question, i need to know how to make damage mandatory to an attacking mob in an rpg. I have defend in there so the mob will take damage but it's optional to click on it. Please give me some help.
turf
Start
icon = 'Floor 2 Icon.dmi'
verb
Join()
set src in oview(1)
usr.name = input("Name?","Your roleplay name...",usr.name)
switch(alert("Choose your path...",,"Imperial","Tau"))
if("Imperial")
switch(alert("Choose your position",,"Crew","Guardsman"))
if("Guardsman")
usr.PrimaryIcon = "ST"
usr.rank = pick("Private","Corporal","Seargent","Lieutenant (Guardsman)","Captain (Guardsman)","Private","Private")
switch(alert("Choose your division...",,"Ship Defense","Planet Defense"))
if("Ship Defense")
usr.icon = 'ST.dmi'
usr.icon_state = "1"
density = 1
usr.loc = (locate(20,735,1))
if("Planet Defense")
usr.icon = 'ST.dmi'
usr.icon_state = "1"
density = 1
usr.loc = (locate(226,884,2))
if("Crew")
usr.PrimaryIcon = "Crew"
switch(alert("Choose your division...",,"Personal","Systems","Pilot"))
if("Personal")
switch(alert("Choose your job...",,"Medical","Command"))
if("Command")
usr.rank = pick("Crewman","Lieutenant (Navy)","Crewman","Crewman","Commodore","Commander","Captain (Navy)","Admiral")
usr.icon = 'Crew.dmi'
usr.icon_state = "1"
density = 1
usr.loc = (locate(5,737,1))
..()
if("Medical")
usr.icon = 'Crew.dmi'
usr.icon_state = "1"
density = 1
usr.loc = (locate(129,743,1))
..()
usr.rank = pick("Crewman","Lietenant (Navy)","Crewman","Crewman","Commodore","Commander")
if("Systems")
switch(alert("Choose your job...",,"Technician","ShipGuns"))
if("Technician")
usr.icon = 'TP.dmi'
usr.icon_state = "1"
density = 1
usr.loc = (locate(450,732,1))
..()
usr.rank = pick("Apprentice","Engiseer","Chief TechPriest","Apprentice","Apprentice")
if("ShipGuns")
usr.icon = 'Crew.dmi'
usr.icon_state = "1"
density = 1
usr.loc = (locate(120,756,1))
..()
usr.rank = pick("Crewman","Lietenant (Navy)","Crewman","Crewman","Commodore","Commander")
if("Pilot")
switch(alert("Choose your station...",,"DalmarIV","ImperialShip"))
if("DalmarIV")
usr.icon = 'Crew.dmi'
usr.icon_state = "1"
density = 1
usr.loc = (locate(155,897,2))
..()
usr.rank = pick("Crewman","Lietenant (Navy)","Crewman","Crewman","Commodore","Commander")
if("ImperialShip")
usr.icon = 'Crew.dmi'
usr.icon_state = "1"
density = 1
usr.loc = (locate(7,726,1))
..()
usr.rank = pick("Crewman","Lietenant (Navy)","Crewman","Crewman","Commodore","Commander")
if("Tau")
switch(alert("Choose your postion...",,"FireWarrior","AirCaste"))
if("FireWarrior")
usr.PrimaryIcon = "FW"
usr.icon = 'Shasla Icon.dmi'
usr.icon_state = "Shasla w/hel"
density = 1
usr.rank = pick("Shas'la","Shas'el","Shas'ui","Shas'la","Shas'la")
switch(alert("Choose your division...",,"ShipDefense","PlanetAssault"))
if("ShipDefense")
usr.icon_state = "1"
usr.loc = (locate(271,874,1))
..()
if("PlanetAssault")
usr.icon_state = "1"
usr.loc = (locate(229,861,1))
..()
if("AirCaste")
usr.PrimaryIcon = "Air"
usr.icon = 'Air Caste Icon.dmi'
density = 1
usr.rank = pick("Kor'la","Kor'ui","Kor'el","Kor'la","Kor'la")
switch(alert("Choose you division...",,"Personal","Systems"))
if("Personal")
switch(alert("Choose your job...",,"Medical","Command"))
if("Command")
usr.icon_state = "1"
usr.loc = (locate(378,871,1))
..()
if("Medical")
usr.icon_state = "1"
usr.loc = (locate(132,875,1))
..()
if("Systems")
switch(alert("Choose your job...",,"ShipGuns","Technician"))
if("ShipGuns")
usr.icon_state = "1"
usr.loc = (locate(190,871,1))
..()
if("Technician")
usr.icon_state = "1"
usr.loc = (locate(99,871,1))
..()


This is my job code. I think I need more help than just blindly asking for a demo. Is there anyway I can make ratios for these ranks?
In response to Bobthehobo
What do you mean by ratios? What you posted was a job select system. Ratios like for every three of this job there has to be one of this job?
Page: 1 2