1
2
ID:165686
Nov 14 2006, 3:55 pm
|
|
How can I make it when something it gets hit, a random blood icon appears?
|
In response to CuriousNeptune
|
|
Basic idea yes, syntax no.
var/bloodtype=pick(typesof(/obj/blood)) Then define all your bloody splatters under /obj/blood. |
In response to Jp
|
|
Ah. Much better.
|
var/image That should do the trick. As soon as the player gets damaged below 80% of their HP, blood will start to appear wherever they walk. You should frequently call world.Repop() to clean the blood. |
In response to CuriousNeptune
|
|
Oooh, here's a tip that you may want to know:
Instead of having var/list/L = list(new X,new Y,new Z,new etc)
var/list/L = newlist(X, Y, Z, etc)
_> or you could just make one blood object and randomly assign it an icon state when created >_> obj/blood I like using icon_states() rather than icon.IconStates <_< - GhostAnime |
In response to CuriousNeptune
|
|
That dosen't work.
|
In response to Jp
|
|
Thanks Jp, and for everyone else who helped me.
|
In response to Android Data
|
|
Why would you define a bunch of seperate images? You could define an obj and simply change its icon_state. If, say, the name of the icon was "blood_1" and that went up to five different states, just do something like this:
obj/blood/New() icon_state = "blood_[rand(1,5)]" |
In response to Lendgens
|
|
Lendgens wrote:
Thanks Jp Using objects to do visual tasks is a bad habit. Read my code and strongly consider using it, as it's much more robust with using overlays. |
In response to Android Data
|
|
I don't want overlays. I want it so when you get shot, it splatters blood.
|
In response to Lendgens
|
|
Lendgens wrote:
I don't want overlays. I want it so when you get shot, it splatters blood. You do want overlays. Using objects for that sort of a thing just gets you more and more to the limit. Bah! Using overlays is the best thing to do here, since you just want a few visual splatters on the floor. Just read & understand my code plz. |
In response to Android Data
|
|
I think I get what you're coding. I will use it, I see what you mean now :P, thanks Android.
|
In response to Lendgens
|
|
Lendgens wrote:
I think I get what you're coding. I will use it, I see what you mean now :P, thanks Android. Yes! I did it! You're the first person who THINKS! Yes! I found a person with an independant functioning brain! Woo-hoo! |
In response to Android Data
|
|
Android Data wrote:
> world/Repop() That should do the trick. As soon as the player gets damaged below 80% of their HP, blood will start to appear wherever they walk. You should frequently call world.Repop() to clean the blood. Me myself, I wouldn't suggest using Repop() to remove the stains. If it is a large world, everytime you call Repop(), it will lag immensly as it has to check every turf there is. I would suggest a different approach that is called after a spawn that removes each bloodstain individually. mob/proc/attack(mob/attacker) Something like this, I would imagine, would be a lot nicer on your cpu. ;) §atans§pawn |
In response to Satans Spawn
|
|
Satans Spawn wrote:
Something like this, I would imagine, would be a lot nicer on your cpu. ;) True, but when the player logs out it won't remove the blood. |
In response to Android Data
|
|
If you keep the blood left there forever, you have poor design anyways. It should delete after a certain amount of time, or when no one is in view of it if you want to be discrete.
|
In response to Android Data
|
|
Android Data wrote:
Satans Spawn wrote: You could always call a new proc with that turf and the overlay and arguments and go from there, so when the player logs out, the blood will still get deleted. §atans§pawn |
The idea behind that is just to create a new object, apply the right icon, and then place the object at the right location.
Of course, in Faction Wars, I have a system that uses trigonometry to make blood spray out. I'm not sure if you want that though. |
1
2
pick(var/T = new /turf/blood1(src.loc),var/T = new /turf/blood2(src.loc))
And so on.
I'm assuming it works. lol Might need some tweaking?
It supposed to create either blood1 or blood2 at src's location...