ID:272528
 
I've got two questions about procs basically.

First of all, is it safe/efficient/the right thing to do to use procs that are over written.
For example, at the moment I am doing this with the AI in my game, it is divided into 4 procs, one that walks randomly, one that follows a player, only that finds a player and one that attacks a player (along with a base proc that is not over written).
All of these procs have a default action, but for specific monsters I overwrite these procs so to say with more specific actions. An example might be

mob/proc/Wander(mob/M)
step_rand(M)
//This is the default wander proc basically

mob/Lazy_Monster
Wander(mob/M) //This is the overwritten proc, which is only called by this lazy monster instead of the above proc.
if(rand(1,2)<2) step_rand(M)


The second question is related to this.
I am basically using the above for a dialoug system as well.
It starts with a basic talk to proc, which again can (and usually is) overwritten for custom hellos and then a few links to specific dialougs.
These links make use of Topic() (which each mob has their own) to preform various things. An example might be talking to a shop owner. The conversation would start like...

"Hello!

[Shop] [Rumors] [Bye]"

Clicking Shop, Rumors of Bye would call topic and preform an action based on that, shop would open a shop, rumors would start a potential quest, and bye would close the dialog window.

The question is the same as above. Is this the correct usage of Topic() (well, not correct usage, but should I be making use of Topic)? Will it cause any problems in the future that I should be aware of, and if so then what should I be using instead of topic?
The Magic Man wrote:
First of all, is it safe/efficient/the right thing to do to use procs that are over written.

Definitely. That's one of the major points of Object Oriented Programming to begin with! =) The more accurate term is 'overriding', by the way.

An example might be

mob/proc/Wander(mob/M)
> step_rand(M)
> //This is the default wander proc basically
>
> mob/Lazy_Monster
> Wander(mob/M) //This is the overwritten proc, which is only called by this lazy monster instead of the above proc.
> if(rand(1,2)<2) step_rand(M)
>


In that example, it'd be slightly better to do this instead; the point is not to repeat code. You could also change that rand() (or use prob()) a bit, though it's not too important.
>         if(rand(1,0)) ..() //do the default/parent action


These links make use of Topic() (which each mob has their own) to preform various things. An example might be talking to a shop owner. The conversation would start like... [...]

Like above, yes, you're meant to override procs like Topic(), and that basic act is 'proper usage'. I guess I can't really however specifically say whether your particular design is correct or not, without seeing your specific design first.
Yes and Yes. You could also use the new 4.0 controls to make an elaborate system of buttons and labels for dialog, but Topic() is probably the simplest solution.