I was wondering how exactly would I turn this into a global var so that when I choose BattleOn() it lets everyone have fight = 1. This current code only lets "me" have the verb. Actually dont mind usr cause I put that there for no reason, but im not sure how to do this. (never used a global var in my life)
mob/verb/BattleOn()
set category = "Admin"
usr.fight = 1
world<<"Battle Mode has Begun!"
mob/verb/BattleOff()
set category = "Admin"
usr.fight = 0
world<<"Battle Mode has Ended"
ID:148893
![]() Aug 25 2002, 6:16 am
|
|
If you want to set a gobal variable, then simply define it as
var/yourvariable
Do this at no indentation so that it's not under any mobs, objs, etc. Then, simply use yourvariable = value anywhere in your code to set it. var/fight |
Well, what are you trying to do with the variable? You have to have everything which is affected by the variable check for it. For example, if by setting fight = 1, everyone can fight, then their attack code must check the variable
mob/proc/fight(var/mob/M in oview(1)) Hope that helps |
var/fight = 0 // Declares global Varible
mob/verb/BattleOn()
set category = "Admin"
fight = 1 // changes the global varible fight to 1
world<<"<font size = 5><font color=red>Battle Mode has Begun!</font color=red></font size = 5>"
mob/verb/BattleOff()
set category = "Admin"
fight = 0 // changes the global varible fight back to 0
world<<"<font size = 5><font color=red>Battle Mode has Ended</font color=red></font size = 5>"