Action RPG Framework

by Forum_account
Action RPG Framework
A framework for developing action RPGs.
ID:1368487
 
Hello everyone!
This is my first post.
For it, I decided to add respawning to the enemy AI.
I've seen someone complaining about no enemy respawn, so here is my response to it.

To add respawning, just simply open up the enemy-ai.dm file, and go the the
 action(t)
line.
Now, you can clearly see theres a
 if(dead)
line.
There, after the
 moved = 0
line, type the following:
spawn(60)
respawn()


If you run the action RPG framework, if you try killing a monster, you will see that the enemy will spawn at your spawning location.
We will now fix it.

spawn(60)
respawn()
loc = locate(your, location, here)


You should type your location where it says so.
I don't know a way to respawn the monster at its original location, so I use this.

This is actually my first coding experience, so please tell me if I am wrong somewhere!
If there are any complaints about npc behavior, I'll bet F_A already handled them here.

http://www.byond.com/developer/Forum_account/EnemyAI

and if not, then here

http://www.byond.com/developer/Forum_account/AITutorialPart2
Also, since Forum_Account's ActionRPGFramework uses his Pixel Movement library, locate is replaceable by set_pos(pixel_x, pixel_y, pixel_z, map_z)

    action(t)

if(dead)
moved = 0
if(!client)
spawn(60)
respawn()
set_pos(1,1,1,1) // Works like loc = locate(1,1,1) but moves the mob by pixels, and incorporates the pixel_z coordinate as well.


Like much of everything else, if you need a reference to something that his Framework uses, you can check the _reference.dm file in his Pixel Movement lib. He even made a program to put these reference files in the dreammaker help file.

http://www.byond.com/developer/Forum_account/Reference

But onward! Preferably we'd like npc's to respawn where we first placed them in the map(.dmm). Doing this is pretty simple with the initial(var) proc. I don't think this is going to work like you want it to exactly because you have to remove the mob from the active mobs list. I'm not at my home computer right now, so this is the best I can do atm.

    action(t)

if(dead)
moved = 0
if(!client)
spawn(60)
respawn()
loc = locate(initial(x), initial(y), initial(z)) // check the initial proc in help. This will bring them back to their original placement in the .dmm


Like I said though... that's not exactly what you want. You want (I think!)to look at the last few lines that each mob/enemy has in enemies.dm and call the procs and arguments that you need there.
remplace died() proc in mobs.dm for this new one
    died()
..()

// when a player dies, make them wait two seconds and respawn.
if(client)
src << "You died! You'll respawn in two seconds."

spawn(20)
respawn()

if(!client)
spawn(respawn_time)
respawn()
loc = initial(loc)
target = null

add a new variable under mob
mob
var/respawn_time = 50 // the deflaut time will be 5 seconds

add under any enemy strat(power, health...)
mob
enemies
blue_ooze
max_health = 40
respawn_time = 100 // 10 seconds unit he will respawn