ID:262842
 
Code:
turf
CTF_Turf
icon = 'Ground.dmi'
icon_state = "Cement"
Entered(var/obj/item/furniture/CTF_Red_Flag/rf)
if(istype(rf,gf))
if(usr.Teamcolor == "Green")
if(gf.loc == locate(86,55,3))
green_team_points += 1
gf.loc = locate(87,76,3)
rf.loc = locate(86,55,3)
world << "[usr] has scored a point for the Green team!"
world << "The score is now Red:[red_team_points] Green:[green_team_points]!"
if(green_team_points == maxpoints)
world << "CTF has [CTF_Status ? "Started" : "Ended"]. The Red team wins! All players on the red team get [prize_money] Gold!"
if(usr.key in CTF_players)
CTF_players.Remove(usr)
usr.Teamcolor = ""
usr.loc = locate(45,49,2)
if(usr.Music == 1)
return
else
usr << sound('Earth Town.mid',1)
if(usr.Teamcolor == "Red")
usr.Gold += prize_money

else
usr << "You can't score for your team unless you have both flags!"


Problem description:
i need this to check to see if the green flag is in the users inventory and thge red flag is on this turf. im not sure how to do it tho. can i have some help?

Golden lesson;
if(var==1) < if(var)
if(var==0) < if(!var)

Also, look up get_step for your problem.
In response to Mysame
need help plz see first post
In response to Pyro_dragons
You are using too many arguments. <_<
As i said before, you only need the one argument Entered() has. You can check for the objects within the proc. And, your teamcolor variable is useless. I thought we phased that out last time I posted. You're going to have major difficulty keeping that in.

turf/CTF_Turf
icon = 'Ground.dmi'
icon_state = "Cement"
Entered(atom/moveabe/A)
if(istype(A,/mob/))
var/mob/M=A
var/obj/RFlag=locate(/obj/item/furniture/CTF_Red_Flag/rf) in world
var/obj/GFlag=locate(/obj/item/furniture/CT_Green_Flag/rf) in world
if(M in Teams["Red"] && src==locate(87,76,3))
if(RFlag.loc==locate(86,55,3))
if(GFlag.loc==M)
green_team_points++
GFlag.loc = locate(87,76,3)
RFLag.loc = locate(86,55,3)
world<<"[usr] has scored a point for the green team!"
world<<"The score is now Red:[red_team_points] Green:[green_team_points]!"
else
src<<"You need the green flag!"
return ..()
else
src<<"Your flag needs to be on it's position."
return ..()
if(M in Teams["Green"] && src==locate(86,55,3))
if(GFlag.loc==locate(87,76,3))
if(RFlag.loc==M)
red_team_points++
GFlag.loc = locate(87,76,3)
RFLag.loc = locate(86,55,3)
world<<"[usr] has scored a point for the red team!"
world<<"The score is now Red:[red_team_points] Green:[green_team_points]!"
else
src<<"You need the red flag!"
return ..()
else
src<<"Your flag needs to be on it's position."
return ..()
else return ..()
else return ..()


That's not the full procedure, but you can just add the rest. It makes sure that both flags are in their proper location and checks for your team without an extra variable. Also, I noticed that you have a bunch of worthless if() checks. Revise those, and add a for() loop. Another thing, there is no such thing as usr in Entered().
In response to CaptFalcon33035
thanks for your help, everything works except for one thing.

It says A is an undefined type path. I've tried a few ways of redefining it but i just can't seem to get it. any ideas? thanks much man.
In response to Pyro_dragons
Entered(atom/movable/A)//movable was moveabe >.>
In response to Detnom
doesnt matter. either way its the same error message.

A : undefined type : A

any ideas?
In response to Pyro_dragons
Are you sure you haven't made a typo, done something stupid with \ on the end of a line, not closed quotation marks, screwed up indentation, defined a global variable 'A', not closed square or regular brackets, not closed a comment, or something equally minor? atom/movable should compile. It does for me. Where does the error occur?

Additionally, usr is still in that proc. It should be replaced by A. It is used in messages.

And "its" is possessive, not "it's"
In response to Pyro_dragons
I'm inclined to agree with Jp on this one, it's more than likely a typographical error on your part. I tried this piece of code:
Entered(atom/movable/A)
if(istype(A,/mob/))
var/mob/M=A


Just to see if it would give me any errors, and I didn't have a single problem, so long as I spelt everything right. On another note..
if(istype(A,/mob/))//this can be shortened to:

if(ismob(A))//Ta-da.
In response to Detnom
got it there was an "e" there that shouldnt have been.
In response to Pyro_dragons
hmmm it all checks out but nothing is happening...

turf
CTF_Turf
icon = 'Ground.dmi'
icon_state = "Cement"
Entered(atom/movable/A)
if(istype(A,/mob/))
var/mob/M = A
var/obj/RFlag = locate(/obj/item/furniture/CTF_Red_Flag) in world
var/obj/GFlag = locate(/obj/item/furniture/CTF_Green_Flag) in world
if(M in Teams["Red"] && A == locate(87,76,3))
if(RFlag.loc == locate(87,76,3))
if(GFlag.loc == M)
red_team_points ++
GFlag.loc = locate(86,55,3)
RFlag.loc = locate(87,76,3)
world << "[usr] has scored a point for the Red team!"
world << "The score is now Red:[red_team_points] Green:[green_team_points]!"
if(red_team_points == maxpoints)
world << "CTF has [CTF_Status ? "Started" : "Ended"]. The Red team wins! All players on the red team get [prize_money] Gold!"
if(usr.key in CTF_players)
CTF_players.Remove(usr)
usr.Teamcolor = ""
usr.loc = locate(45,49,2)
if(usr.Music == 1)
return
else
usr << sound('Earth Town.mid',1)
if(usr.Teamcolor == "Red")
usr.Gold += prize_money
else
usr << "You need the Green Flag!"
return ..()
else
usr << "Your teams flag must be at its position!"
return ..()

abosolutely nothing is happening with the opposing teams flag in my inventory and the other on the desired location.hmm...
In response to Pyro_dragons
A == locate(87,76,3)

WTF? That should probably be A.loc. Or left out. I can't see what it's there for.
In response to Jp
well, its supposed to be if the players ios on thr turf, the green flag is in their inventory and the red flag in its postion, everything else happens.

btw changing it to A.loc doesn't change anything it still won't work.
In response to Pyro_dragons
It's fairly bad.

obj/flag
verb/Get()
set src in oview(1)
loc=usr
verb/Drop()
set src in usr
Move(usr.loc)
red
blue

turf/CTFturf
Entered(atom/movable/m)
if(istype(m,/obj/flag/red))
if(locate(/obj/flag/blue) in src))
//Both the flags are in, and the red flag has been dropped. Add points to teams, depending on who owns the turf.
if(istype(m,/obj/flag/blue))
if(locate(/obj/flag/red) in src))
//Both flags are in, and the blue flag has been dropped. Add points to teams, based on turf ownership.
In response to Pyro_dragons
Why'd you change it to A==locate()? It was supposed to stay src==locate() because A is a turf, src locates a turf, and I was pretty sure you just wanted one object to place in both goal areas. <_<
In response to CaptFalcon33035
sigh. Doing it Jp's way give me errors and doing it Captfalcons way doesnt do anything.My ways that i've tried are ineffective as well. I'm running out of ideas on how to do it too. Thx for all your help guys, by the way.

All im asking is that when the usr enters the turf, if their teams flag is in position, and the opposing teams flag is in their inventory, the point is added and the flags are relocated to orignial positions.

Perhaps i should just find someone who has done CTF before?
In response to Pyro_dragons
There is no 'the usr'.

What errors does my way give you? Quite likely, you're doing it wrong.
In response to Jp
i probably did do it wrong, but i changed it back to the other and i don't want to change it again. all i did was implement what you put up there and changed it according to what i needed. still nothing. i think ill try to find someone who has done CTF before and have them look at it.
In response to Pyro_dragons
Code would be handy. This 'change' smacks of screwing it up.
In response to Jp
i dont have the code for it. its the smae as above. left unchanged. i tried yours and modded it to have no errors, and it was just as ineffective as whats up there. no change at all. ill just ask someone who has done CTF before. i know someone.
Page: 1 2