ID:263382
 
Code:
var/mob/N = text2path("/mob/monsters/[dd_replaceText(M.followerName," ","_")]")
new N
N.BattleNum = M.BattleNum


Problem description:
Whenever this is called, it spits out : runtime error: Cannot modify /mob/monsters/Muscrat.BattleNum.

Elsewhere in the code, mob/var/BattleNum = 0 is defined.

The problem is that you never set N to anything. Even though you create a new instance of the type 'N', it doesn't get set to N. In order to fix this, you have to define the new object to a variable.

var/path = text2path("/mob/monsters/[dd_replaceText(M.followerName," ","_")]")
var/mob/N = new path
N.BattleNum = M.BattleNum


Alternatively, you can just use a text string to specify what you want to create, so you don't need to use text2path.

var/mob/N = new "/mob/monsters/[dd_replaceText(M.followerName," ","_")]";

In response to Unknown Person
Ah. Thank you.