ID:166828
 
how do i make an arena, i have th epk script set up so when u walk in u can pk but how do i make the rest of my world not pvp unless ur in that area i mentioned?
Um, please try to use as much proper grammer when posting if possible to avoid any miscommunication >.>

Please show us your PK script than, in order for us to see how we can make it so that the other people can't PK

But for simplisity's sake, just have everyone's PK var set to 0 and when they walk in the arena, the Area/Entered() (or was it Enter()? meh, forgot which happened when >_<), it changes their variable... likewise for Area/Exit() for the same thing

- GhostAnime
area/Wild
Entered(obj/o)
if(istype(o,/obj/))
return 1
else
usr.pker=1
spawn(1)
alert("You have entered the wild.")
Exited(obj/o)
if(istype(o,/obj/))
return 1
else
usr<<"You leave the wild."
usr.pker=0

//Start Monsters//
mob
monsters
pker=1
is_monster=1
var/mob/characters/P
New()
.=..()
spawn()
Wander()
spawn()
src.Bars2()
src.Bars()
proc/Wander()
if(src.control==0)
if(src.dead==1)
del(src)
if(attacked!="")
for(P in oview(5))
if(P.name==src.attacked)
step_towards(src,P)
attacking=1
Deathcheck()
if(attacking==0)
attacked = ""
Wander()
attacking=0
spawn(1)
Wander()
Bump(mob/C)
if(ismob(C)&&src.isattacking==0)
src.isattacking=1
spawn(3)
src.isattacking=0
var/damage = usr.str
damage -= C.def
if(damage > 0)
C << "[usr] attacks you and does [damage] damage"
usr << "You attack [P] for [damage] damage"
C.hp -= damage
else
C << "[usr]'s attack bounces off of you!"
usr << "Your attack bounces off of [src]!"
C.Bars()
C.Deathcheck()

there it is, sorry bout that i was in a hurry was goin to take a shower
In response to GhostAnime
GhostAnime wrote:
But for simplisity's sake, just have everyone's PK var set to 0 and when they walk in the arena, the Area/Entered() (or was it Enter()? meh, forgot which happened when >_<), it changes their variable... likewise for Area/Exit() for the same thing

- GhostAnime

NO, NO NO NO NO.
if(istype(usr.loc.loc,/area/arena))
...


In response to Mysame
could i add that im new to scripting i just make a script for bout hour or 2 till i get it right. could u all please try to put ur examples in lamish for me or explain it. thanks
In response to Mysame
Hmm, forgot about that way... oh well *shrugs* I must be getting too much radiation <.<

- GhostAnime
In response to Mysame
It actually might be better to set a variable on area.Entered() and area.Exited() so you don't have to keep calling the istype() procedure over and over again. It's safe for lag reasons.

Of course, you'd have to relocate a person like most smart developers do. You would use Move(). That way, it calls the procedure (either Entered() or Exited()).
In response to CaptFalcon33035
The only istype() needed would be in an attack verb. I don't how it would create lag, compared to someone who's walking, constantly changing one's vars.
In response to Mysame
Actually, you might read up on area and know that that is not how area.Entered() functions. All areas of the same type are counted as one instance, not multiple areas. So, it won't keep changing the variables.

It's a very useful thing too. It can be used to wake up monsters so they aren't constantly running procedures, it can be used to shut them off where there is nobody around, and more.
In response to CaptFalcon33035
captfalcon could u show me what u mean, i think i know what your talking about i just want to see if im right. and if u wouldnt mind could u help me a little cause this is i think the last thing i need to get my game at basically 100% aside from monsters, items, and a drop script.
In response to Sin1990
Well, here is an example. This is pertaining to the question you initially asked. It looked as though you were attacking people who weren't PVP while you were PVP.

mob/var/pvp  //pvp variable

area/PVP //PVP type of area
Entered(atom/moveable/A) //Entered procedure
if(istype(A,/mob/) A:pvp=1 //If A is a mob, change it's pvp variable
..() //call default procedure
Exited(atom/moveable/A) //Exited procedure
if(istype(A,/mob/) A:pvp=0 //change pvp variable if mob
..()

mob/proc/Attack(mob/M)
if(!(M.client && M.pvp && pvp)) return
else
procedurehere


Although you probably should typecast those and someone will get on me for not doing so, you shouldn't really have to. It's just the replacement of one variable.
In response to CaptFalcon33035
ok whats typecast?
In response to Sin1990
Well, to avoid error with the : operator, we would set a mob variable to the atom and change it's variables with the . operator instead. If I find a link to the article, I will post the link.
In response to CaptFalcon33035
ok thanks
In response to Sin1990
i fixed it i already had it on my attack verb but on my spells i didnt -.- ima dumbass thanks all who tryed helpin me