ID:173970
 
hi
this is my guild war code. i was trying to make this work but it seems not working. i coded right way but, i only see people declaring war and i dont see m.guild or usr.guild getting in to guild war arena..could any one help me ut on this..or is there any new way or new method of coding will you teach me.


mob
verb
Guild_War(mob/characters/M in world)
set category="Guild"
set name = "War"
if(usr.Inguild == 0)
usr << "Sorry, your not in a guild."
return
if(usr.ClanLeader == 0)
usr << "Your Not Leader Of This Guild"
return
else
switch(alert(src,"[usr] challenges your Guild to a fight. Do you accept the request?","Guild War","Yes","No"))
if("Yes")
world <<"[usr.guild]declared a war against [M.guild]."
if(M.guild == usr.guild)
alert("[src] accepted the Challenge","Accepted")
M.loc =locate(143,(rand(3,30)),3)
usr.loc =locate(143,(rand(3,30)),3)
if(M.guild == src.guild)
M.loc =locate(173,(rand(3,30)),3)
src.loc =locate(173,(rand(3,30)),3)

if("No")
alert(usr,"[M] declined the Challenge","Declined")
world <<"[M.guild]declined the war against [usr.guild]."

thank you friend
- Dtroys
I see two small things with your code I'd like to point out.

First is the line that checks to see if the user is a guild-leader, and if not then return. That needs to be unindented by one tab.

Second is the alert that asks the other player (M) if he/she wants to accept the challenge. If that alert is supposed to be answered by M, then put alert(M,other stuff) instead of alert(src,other stuff).
In response to Loduwijk
hi

i was thinking of let the world know who win and who lost. i am going to try my best on my that proc and i will type it here. if i made a mistake please indicate what i made mistake and what its going to affect.

mob/Login()
src.wara = 0
src.warb = 0
src.warc = 0


mob/var/wara=0
mob/var/warb=0
mob/var/warc=0

mob/proc
guildwin()
if(src.warb == 0)
world <<"[src.guild] defeated [src.guild]
src.wara = 0
src.warc = 0
guildwin1()
if(src.wara == 0)
world <<"[src.guild] defeated [src.guild]
src.warb = 0
src.warc = 0

mob/verb
Finishoff()
set category = "fight"
for(var/mob/M in get_step(src,dir))
guildwin()
guildwin1()
if(usr.wara > 0)
usr.wara -= 1
if(M.warb > 0)
M.warb -= 1

and little change in my guild war code too.. because i added this new proc and other codes

mob
verb
Guild_War(mob/characters/M in world)
set category="Guild"
set name = "War"
if(src.warc == 1)
usr << "War arena in use"
if(usr.Inguild == 0)
usr << "Sorry, your not in a guild."
if(usr.ClanLeader == 0)
usr << "Your Not Leader Of This Guild"

else
switch(alert(src,"[usr] challenges your Guild to a fight. Do you accept the request?","Guild War","Yes","No"))
if("Yes")
world <<"[usr.guild]declared a war against [M.guild]."
if(M.guild == usr.guild)
alert("[src] accepted the Challenge","Accepted")
M.loc =locate(143,(rand(3,30)),3)
usr.loc =locate(143,(rand(3,30)),3)
usr.wara += 1
usr.warc = 1

if(M.guild == src.guild)
M.loc =locate(173,(rand(3,30)),3)
src.loc =locate(173,(rand(3,30)),3)
M.warb += 1
M.warc = 1

if("No")
alert(usr,"[M] declined the Challenge","Declined")
world <<"[M.guild]declined the war against [usr.guild]."

all this made by my imagination
thank you
- Dtroys