ok i have a lil problem. let me explain what im trying to do.
a NPC, thats a mob....mob/Basic_Troop/B
the thing im trying to attack....mob/Tree/T
i want B to attack T...then bring the loot back
to a house like area..that stores all loot.
i just dont know if i should be using get_step or oview. ive tried looking into the enemy AI stuff. but i cant seem to get it to work. any help?
well this is what i have so far...
mob/proc Attack(mob/Basic/T) for(var/mob/Tree/M in get_step(T,T.dir)) var/damage=rand(1,3) view(6)<<"[T] attacks [M] for [damage] damage!" verb stuff Collect_Wood() for(var/mob/Basic/T in oview(8)) Attack() now, it complies right but when i test it i get runtime error: Cannot read null.dir proc name: Attack (/mob/proc/Attack) source file: procs.dm,21 usr: Cassidyx15 (/mob) src: Cassidyx15 (/mob) call stack: Cassidyx15 (/mob): Attack(null) Cassidyx15 (/mob): Collect Wood() |
idk maybe i gotta explain it to you better so you understand the full concept.....people will be able to put npcs onto the map (farmers), those npcs move around freely whenever their not doing something. right now, i want them to attack a tree and bring the wood back to a store house/warehouse.
Code: Collect() is the current verb, to make my "farmers" attack the tree. but their not attacking it. they keep moving around freely. the code for the attack verb (new) is Code: mob |
Oh wait, didn't read it properly. Sorry! You don't have arguments in Attack() that actually need to be passed. Make sure that the NPC is facing the tree when you call Attack(). If you've got some kind of automove going on, make sure it pauses when you attack the tree.
Also, try
Attack(mob/Tree/M in get_step(src,src.dir))
as mob is redundant because the tree is a mob. (Personally I would've passed the tree as an argument so I could use walk_to() or something to get to the tree, hack it, and walk back but whatever floats your boat) |
the only thing im really having a problem with, is actually GETTING my people over to the tree. i can get on team viewer, and show you what im talking about. if thats easier?
|
Not in the slightest, on a school computer. And that's kind of what I meant in my previous post.
mob This should have you walk to another mob in world. Place a mob on the map and have a go at it. Expanding on this code, you can get the farmer to the tree. |
ok well, i got to the tree, but how do i make it to where it only effects the units i made, instead of me?
|
I think you should be able to figure out how to make it affect only created units.
|
well i changed mob/M to mob/Farmer/M. but yea, still nothing. im stupid when it comes to making stuff. im used to doing small stuff, not that complicated..:\
|
also you can use get_dist to find the distance between the mobs and objects. I would aslo use dir to point the character into the trees direction. I would place all of this in a while loop.
while(src)
meaning while the src exists the loop runs.
this could be used to check if there is a mob in the view of 6 tiles .
then you could use get_step or get_dist to check if there is an obj or mob 1 tile or less away
and use
I am not sure if this helps there could be errors in my examples and advice since I havent done any byond coding in like 3-4 months