ID:174886
 
to place a timer on a targeted creature to reduce or increase its abilities then after a time return them? I know how to do it on the person using the skill but not how to do it to another character using anothers abilities.
Procedure(O)
O:health -= 10
spawn(10) O:health += 10

summat like that... but that's a very dodgey code :P What if in that second O gets attacked? You'll have to put in quite a few contingencies. I'd come up with something smarter but I'm busy chatting to some1
In response to Da_Rushyo
Ignore the above reply. It is nothing but bad advice.
In response to Garthor
Oh thanx -_- I'm looking forward to reading your suggestion.....
In response to Da_Rushyo
Too lazy. But If I did, I wouldn't use any colons.
In response to Garthor
ignore the colons, I always use colons like that, I don't really know what the difference that is anyway, I've never had a problem with it :p

If you're gonna pan my suggestions I'm just gonna flame ya until you come up with one of ur own =P
In response to Da_Rushyo
I suppose I could always just reduce the targets field of view to themselves and force them to get a restoration potion or something to fix their blindness but I was hoping maybe it could just be temp and go away after a few seconds..
In response to Da_Rushyo
Colons are EEEVIL. Similar to how usr is evil. By using colons instead of periods you can possibly run into hard to find bugs. With a period the compiler makes sure that the mob/obj/turf/whatever actually has the vars and procs you are setting/accessing/reading. A colon causes the compiler to be a lot less picky about possible errors. Here's an example:
mob/TheMonsterWithADieProc
proc
Die()
//Proc stuff here(eg: del(src))

mob/PC
verb
CauseMobToDie(mob/M as mob)
M:Die()

Here, a player(mob/PC) can cause any mob in the world to execute its Die() proc at the player's command. However, what if another player joins the game and tries to make the first one die? mob/PC doesn't have a Die() proc and you'll have an error. What if there was some monster without a Die() proc? You'd end up with anr error there too. If it had been M.Die() instead of M:Die() the compiler would have brought an error up when compiling the code, complaining that some types of mob, including mob itself, don't have a Die() proc.

If I'm wrong someone can flame me now. :)
You could try something like this, using spawn():
mob
var/Health //The var we are going to change
verb
GiveTempHealth(mob/M as mob, HP as num) //The verb used to change it
M.Health += HP //We aren't checking for negative HP or death, so hopefully we wont kill him :)
spawn(100) //In 10 seconds...
M.Health -=HP //Take the HP amount of Health away again
In response to SophusVir
Now that I think about it, the attack spells I use affect a seperate character from the caster and use animation on the target so I suppose I could simply make the skill do the same and put in a wait section to make the attacker wait before using that or other skills again. However then I run into the problem of them not being able to do anything until the blindness wears off other than escape and that wouldnt be much fun I think
In response to Jon88
ah, so it affects you if you don't pay attention to the code you're writing...

that would explain why I've never encountered this before :)

Also looking at people's code I notice that everyone uses things like:

(mob/M as mob)

I'd use

(var/M as mob)

is there a difference?

(Note: this is the first time I've ever looked at other people's code in any real detail and I'm intrigued)



In response to Da_Rushyo
Basically... yes. If you know what procs belong to which mob, and the same for the vars, you probably won't notice much different in using colon all the time from using period all the time. Colons, however, can do some things that you just can't do with periods. (certain specific situations)
In response to Jon88
But colons are still slower, as evidenced by their name, "Runtime Search Operator."
In response to Da_Rushyo
Da_Rushyo wrote:
ah, so it affects you if you don't pay attention to the code you're writing...

that would explain why I've never encountered this before :)

Also looking at people's code I notice that everyone uses things like:

(mob/M as mob)

I'd use

(var/M as mob)

is there a difference?

Yes...mob/M tells the compiler that it's a mob object, then you don't need to use colons, and then the compiler can tell you when you've made a mistake (like called a proc that the object doesn't have).

If you use colons you quite probably won't see the bug...but your players will later when playing.