Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Casting a spell to turn monsters good


Justin Knight
 Share

Recommended Posts

Actually this would be more simple than you think. All of the NPCs are loaded into memory when the server starts. You could copy some of the code from HandleSaveNPC. This is the routine that runs when you save an NPC from the NPC editor.

So when you cast the spell, you could just have it run a new sub routine, change the behaviour by doing **NPC(NPCNum).Behaviour = NPC_BEHAVIOUR_FRIENDLY**.

Then just use some of the code from the HandleSaveNPC to update the NPC for everybody else.

If you have some programming knowledge, and knowledge of the engine itself, this shouldn't be too hard.

However, this simple code would only work for a unique NPC. It would change the core data of the NPC, thus all of those NPCs would then be friendly. This would work if you only had 1 spawning of an NPC. Otherwise you will have to start going more complex, and adding an array for MapNPC, then adding code that would over-ride the core behaviour variable.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...