Is it Possible to add NPCs to the game?

Status
Not open for further replies.

Keiro Starr

Member
NPC = Non Playable Characters

The reason for this is because I'm working on a racing mod similar in essence to Need for Speed, with the difference of instead of driving into a marker to activate a mission, you talk to people to start a race. I plan to replace the taunt button, which in my opinion has no real use, as an action button to talk to these npcs. Talking to some NPCs will trigger racing missions, some will trigger fights, and some will just tell you important info.

If anyone can tell me how to do it or help me with programming, I'd appreciate it.
 
I think it can actually be done with linedef executors. First get the sprite you want to use for the NPC and either replace an existing scenery item or make a new one in the soc editor. Either way, the object doesn't need any actions unless you want to animate it for the talking.

Then when you place the NPC on the map, place a small sector around front of it, and set it to a floor touch linedef executor that is tagged to a control sector with the run script action. Identify the script there and then open the wad in XWE or SlumpEd and write what you want the player to see when they walk up to your NPC.

You can also try to have a linedef executor run when the object sees you or when you bump into it, but that is only if you want your NPC to be more dynamic than standing in one sector. The procedure detailed above should be sufficient for what you want.

If you need more information on linedef executors or scripts, Check the SRB2 Wiki. It should have all the details you'll need. In all honesty, I couldn't tell you more about it without looking it up in the wiki myself.

Good Luck!

EDIT: Using the taunt key would require programming I believe, but you could work around it by letting the player throw an invisible projectile that will bring the NPC to painstate at which point you can soc it to trigger the linedef executor, so that the player must make "eye contact" and press the button in order to talk. You could also make the projectile run only as far as you want the player to be able to talk.

This is probably more sophisticated than you need and may be a bit hard to figure out even with the wiki to help you out. But if you really want to trigger it with a button press, that is probably the only way you could make it work without coding. Do note that this will cause enemies to get hurt too if the player figures out that he is actually shooting the NPC.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 0, Members: 0, Guests: 0)

Back
Top