ID:140752
 
Code:
obj
entryway1
density = 1
mob
Bump(obj/entryway1/E)
if(usr.team == "King")
density = 0
usr<<"enter fast"
sleep(20)
density = 1
else
usr<<"death"
usr.hp -= 9999999999999999999999999999999999999999999999999999999999999999999999999999999999


Problem description:
when i colide with a rock obj it says enter fast lol fix? i have no idea, (im new to programming)

well for starters what are you trying to do?...

And instead of subtracting absurd amounts of usr.hp just run the death proc or set their hp to 0 or something more reasonable.


edit: ... are you trying to make them move into the area? If so you can use the Step() proc I believe... What you're doing will just send them a message O_o.
In response to Karnaji
nah absurd amounts r 2 much fun :P

im making an invisable object in front of a castle that keeps out enemys but lets freindlies in.
In response to Gigimoi
Gigimoi wrote:
nah absurd amounts r 2 much fun :P

im making an invisable object in front of a castle that keeps out enemys but lets freindlies in.

turf
Supplemental
PlayerBlock
density=1
Enter(mob/M) //this gets ran when somebody tries to enter this location
if(usr.Team==1) //or 2 if other team
if(usr.Team==2)) // the team that can't enter
return 1 //don't change this
In response to Karnaji
                if(usr.Team==1) //or 2 if other team
if(usr.Team==2))
return 1 //don't change this

............... why 2 ifs? it looks like theres no way in
Gigimoi wrote:
Code:
obj
> entryway1
> density = 1
> mob
> Bump(obj/entryway1/E)
>

Problem description:
when i colide with a rock obj it says enter fast lol fix? i have no idea, (im new to programming)


although someone else will be able to explain this more correctly:

just because "obj/entryway1/E" is the arg doesn't mean that when you bump something it's going to check and make sure that it's an obj/entryway1/E. you'll have to do your own check (look up istype in the reference) to make sure that the action only occurs when they bump the entryway
In response to Zaole
ty
In response to Gigimoi
There isn't, and it's abusing usr. What it should look like is this:

turf //or area
team_blocker
var/team
Enter(var/mob/M)
//only care about mobs
if(ismob(M))
if(M.team == src.team)
//allow entry
return ..()
else
//do not allow entry
return 0
else
//allow entry for non-mobs
return ..()
thanks to both of yahs
turf/supplies
entryway1
density = 1
Enter(mob/M)
if(usr.team=="King")
if(usr.team=="Wizard")
M.hp = 0
return 1
In response to Garthor
.....WAY TO SOPHISTICATED MAN KEEP IT SIMPLES
In response to Gigimoi
Gigimoi wrote:
thanks to both of yahs
> turf/supplies
> entryway1
> density = 1
> Enter(mob/M)
> if(usr.team=="King")
> if(usr.team=="Wizard")
> M.hp = 0
> return 1
>


Glad to see it worked
In response to Karnaji
It does not work at all, Karnaji, and I would request that until you are able to provide working code you stop attempting to help people, and instead focus on teaching yourself.
In response to Garthor
Garthor wrote:
It does not work at all, Karnaji, and I would request that until you are able to provide working code you stop attempting to help people, and instead focus on teaching yourself.

Off topic but... apparently it did work if he thanked me and based it off what I told him..
In response to Karnaji
Just because he thanked you doesn't mean it works. I can say with absolute certainty that what you posted will, in every case, prevent entry. Though in some cases it will generate an error AND prevent entry. Just because he didn't bother to test it doesn't mean it works.
In response to Garthor
i tested it, it didnt work, i was thanking garthor and zaole
anyways this was one of my final steps in finishing game. all i need now is to finish making 50 classes....... i have 3.....
In response to Gigimoi
Gigimoi wrote:
.....WAY TO SOPHISTICATED MAN KEEP IT SIMPLES

Not only was it kept simple...but it was very nicely commented.
In response to Karnaji
Karnaji wrote:
Off topic but... apparently it did work if he thanked me and based it off what I told him..

Here's the code:
turf/supplies
entryway1
density = 1
Enter(mob/M)
if(usr.team=="King")
if(usr.team=="Wizard")
M.hp = 0
return 1


Let me explain to you why this does not work at all, ever.

Say we have a variable, and this variable's name is x. Now, x is equal to "King" at this particular time. How, in any form of logic, can x also equal "Wizard"?

Here's the code in English:
  1. For /turf/supplies/entryway1:
    1. When something tries to enter:
      1. Assume that it is a mob (even though objs enter things too)
      2. Assume that it is a player (by using usr), even though AI controlled characters can move as well
      3. If the player's mob's team variable equals "King":
        1. If the player's mob's team variable equals "Wizard":
          1. Set the entering mob's hp variable to 0.
          2. Allow entry
Again, team cannot equal both "King" and "Wizard" at the same time. So no, it does not work. And where did this logic originate?

Karnaji wrote:
turf
Supplemental
PlayerBlock
density=1
Enter(mob/M) //this gets ran when somebody tries to enter this location
if(usr.Team==1) //or 2 if other team
if(usr.Team==2)) // the team that can't enter
return 1 //don't change this

Thanks for that.
In response to Gigimoi
You could just use a proc to check if its the right castle, and if it is, let them in.
In response to Gigimoi
Gigimoi wrote:
anyways this was one of my final steps in finishing game. all i need now is to finish making 50 classes....... i have 3.....

...

Gigimoi wrote:
.....WAY TO SOPHISTICATED MAN KEEP IT SIMPLES
Page: 1 2