In-Game Creation of Objects

I should first point out that I am new to I7 and would therefore ask anyone kind enough to answer this post to speak slowly and clearly, and explain any technical terms.

When the player is in the region Dangerous Territory (and a random chance succeeds), I need to create an NPC who will then attack him. I was rather hoping to define this new object from a table, that held printed name, description, weapon, etc.

I’m not sure how to go about doing this; I7 seems to forbid “now the assailent is a thing”.

I cannot simply hold an NPC off-stage until he’s needed, because there will possibly be several assailents created at once, and I do not want to hold an unnecessary bank of 99 empty NPCs off-stage if I can possibly help it.

What is the usual procedure in this situation?

I believe that dynamic (that is, run-time) object creation is (unfortunately!) not possible in Inform.

What exactly do you have in mind about what would happen once the “attacker” appears? What will be the attackers’s role? Will the character be able to interact with it?

I’m asking because maybe (depends on your idea of the situation, of course) you could solve the problem without making any NPC’s at all. You could perhaps only print the appropriate text and do any other changes to the game world, for example.

But if you do have to create a special NPC for this, maybe you could move it around, from location to location, each time it is needed? So it would essentially be “the same” attacker (same object), but you would move it around, creating the illusion of many…

Anyway, if you could please explain the idea about the attacker a little bit more in detail – what will happen once it appears etc – we could perhaps figure something out. :wink:

Otherwise, I think Victor is right – you can’t create objects in the middle of the game.

Victor and Lipa are both absolutely correct :wink:

tinyurl.com/yozs3s

Basically, every turn you spend in a sinister region, there was a chance you would be attacked/waylaid by various people (these being muggers, bored policemen, tramps, etc.)

That means a few NPCs held off-stage, one for each kind of model. They have different AIs -the muggers obviously mug you, the bored cops give you a hard time, the tramps ask for change and share random anecdotes, etc.

However, what I actually wanted was for these above definitions to be kinds rather than objects. Then in-game I was hoping just to say ‘"[name entry]" is a policeman in the location of the player.’

The reason for this is that once you’ve met them, they’re supposed to stick around as characters, who can become allies or enemies depending on how you deal with them.

Rather than create 99 or so NPCs in the wings, only about ten of whom are ever likely to meet the player, I was hoping I could just create them in-game with randomly determined characteristics.

But if that’s not possible then it’s not possible.

What about holding a dozen NPCs in the wings and randomly assigning them characteristics?