ID:165846
 
Hello.
Is there any way of giving a mob a certain stat the same the user has.For example the user his hit points are 20,then the enemy his hit points are 20 to.
Thanks.
uhhhhhh...

enemy.hp=usr.hp
In response to Falacy
that wont work.
In response to Halovader
Halovader wrote:
that wont work.

Actually, what he told you will work. The problem is that you are very vague in your question, and so the answers that you get arn't going to be very helpful. To me, it sounds like you want the monsters you create to be of the same "level" or "caliber" as the player who spawned them. I can show you how I might do this in a project of my own:
turf
land
var
// spawn_rarity: How often a monster will spawn.
spawn_rarity = 16
// monster_type: The type of monster this turf will spawn.
monster_type = /mob/character/squid
/* Entered: This proc is called whenever an /atom/movable enters the turf, not just
when a player enters. For that reason, we have to perform checks to make sure the
entrant really is a player.*/

Entered(var/atom/movable/entrant)
// entrant: An argument supplied to the proc telling this turf what has entered it.
// Only spawn if a character is entering.
if(istype(entrant, /mob/character))
/* Type cast the entrant to type /mob/character so that we can access it's
variables without using the : operator.*/

var/mob/character/player = entrant
/* Because both monsters and players are of type /mob/character, we check to
see if the character has an attached client. If so, it's a player. We do this
because we don't want monsters to spawn other monsters while walking.*/

if(player.client)
/* rand() adds an element of chance. We don't want monsters to always
appear, so we check if rand() is equal to the spawn_rarity.*/

if(rand(1,spawn_rarity) == spawn_rarity)
/* If all those checks are true, then we can spawn a monster. Notice
how I suppy the spawn_monster() proc with all the information it needs:
the player.*/

spawn_monster(player)
/* After all that is done, we still enter to do what it normally does. That's what
.=..() means.*/

.=..()
proc
spawn_monster(var/mob/character/spawner)
// spawner: The player that caused a monster to spawn.
/* spawn_loc: We pick a random turf for the monster to appear at. When creating
a new atom, you need to tell it exactly where it should be placed.*/

var/turf/spawn_loc = locate(/turf) in orange()
/*The special key word "new" creats a new object from the type that follows it.
In this case, the type following it is a variable which holds the monster type
path. This key word creates the object and calls the object's New() proc. For
that reason, we have to provide any info needed by New(). In this case, that
info is the spawn_loc, and the spawner.*/

new monster_type(spawn_loc, spawner)

mob
character
var
hp = 20
mp = 20
strength = 20
defense = 20
other_stat = 20
whatever_the_heck_pl_is = 20
New(var/atom/new_loc, var/mob/character/spawner)
// First, we need to do everything New normally does. This is done by . = ..()
. = ..()
// Next, we check if New() was supplied with a spawner. If not, we do nothing.
if(spawner)
/* Here we set all of the monster's stats to the values of the stats of
the spawner. Notice that this part of the code actually does what you asked,
and is exactly the same as the advice Falacy gave you.*/

hp = spawner.hp
mp = spawner.mp
strength = spawner.strength
defense = spawner.defense
other_stat = spawner.other_stat
squid


That system does exactly what you've asked for, but I bet it'll be no help to you whatsoever. What you really need to do is ask presice questions, so that you'll get answers that will help you.
In response to IainPeregrine
who keeps deleting my posts!
In response to Falacy
Someone with some intelligence, obviously.
In response to Falacy
Falacy wrote:
who keeps deleting my posts!

The mods because this isnt a chat-room, its a message board/forum, so use proper grammar.
In response to Falacy
Falacy wrote:
who keeps deleting my posts!

People that understand that these forums are aimed at programming and, moreso, helping people in doing it. Irrelevance should be kept to a minimum.

Hiead
In response to King of Slimes
King of Slimes wrote:

The mods because this isnt a chat-room, its a message board/forum, so use proper grammar.

zomg, the fact that you think you need propper grammEr on the internet either means youre a complete noob or a 50 year old child molester! *calls the police*
In response to Falacy
Falacy wrote:
King of Slimes wrote:

The mods because this isnt a chat-room, its a message board/forum, so use proper grammar.

zomg, the fact that you think you need propper grammEr

No no, it's spelt 'grammar' but pronounced 'gramm-er'.
In response to DivineO'peanut
Divine is correct, according to http://www.dictionary.com

Besides KoS and Fal, you two left out the ' in your abbreviated words, such as KoS mentioned "isnt" when the correct grammar for it is "isn't".

And about the whole grammAr part, that's a spelling mistake, not a grammar mistake.

Ha! I got the last laugh! :D

- GhostAnime