ID:267066
 
Hi, i am currently in desperet need of a following code. This code will have to do the following, when you start the game, and exit your doorm, and go to a certain area, an agent comes and talks to you, you make friends and the agent follows you from there on in. He attacks the peple who you are attacking. I know this is possible, ive seen it done, so if you know or have some coding please help me out.
Thanks
The Conjuror
Ok, i need a code or some help with this idea of mine, i want it so that you meet up with this other dude, just before exiting your base. The guy joins you after saying something like can i join? And from there on in he stays with you fighting the people you fight, and you cant attack eachother. Plz im sorry i didnt notice there was no writting last time. Ok plz answere.
In response to The Conjuror
This isn't too hard. Just get the guy to follow you:

<code>mob var/mob/follower //Set this to the mob who's following this mob (src) mob/player/Move() //Assuming the player is /mob/player if (follower) walk_to(follower,src,1,1) //Make follower walk to src return ..()</code>

Then, whenever you attack, make the guy who's following you attack. So if you have an "attack" verb which lets the player attack:

<code>mob/verb/attack(mob/enemy as mob) if (follower) follower.attack(enemy) //the rest of your attack code goes here</code>

Note: It's a bad idea in this case to use usr in your attack verb, because attack() is also being called like a proc. Use src instead of usr throughout that whole attack verb.