Cutstuff Forum

Mega Man 8-bit Deathmatch => MM8BDM Discussion => Topic started by: CoolHuman on August 02, 2017, 12:53:37 AM

Title: So About Adding NPCs...
Post by: CoolHuman on August 02, 2017, 12:53:37 AM
Could anybody send some information on how to mod in some custom NPCs, I would greatly appreciate the help.  :D
Title: Re: So About Adding NPCs...
Post by: Korby on August 02, 2017, 02:11:00 AM
That depends entirely on what you want the NPCs to do.
If you just want them to stand around and look pretty, that's pretty easy.
If you want them to act like the robot masters in Light Labs, that's a little more difficult.
Title: Re: So About Adding NPCs...
Post by: CoolHuman on August 02, 2017, 02:18:57 AM
That depends entirely on what you want the NPCs to do.
If you just want them to stand around and look pretty, that's pretty easy.
If you want them to act like the robot masters in Light Labs, that's a little more difficult.
So if I would like them to act like they are in Light's lab, how would one do such a thing?
Title: Re: So About Adding NPCs...
Post by: Xhatahx on August 02, 2017, 10:09:08 AM
So first things first, you need an NPC actor.
Code: [Select]
actor DunkelmanProp : CutmanProp 19643
{
//$Category MM8BDM-NPC
Translation "198:198=41:41", "198:198=228:228"
States
{
Spawn:
BARB A 5 A_LookEx(LOF_NOSOUNDCHECK, 0, 100, 0, 360, "See")
loop
See:
BARB A 5 ACS_Execute(101,0,1)
Goto Spawn
Talking:
BARB IAIAIAIAIAIAIAIAIA 4
Goto Spawn
}
}
That'll do. Then you need a talk script.
Code: [Select]
int talkdelay = (35*4);
Script 101 (int whichcharacter)
{
int message = Random(0, 4);
int PropTID = ActivatorTID();
    while(OldMessage == message) //Ensuring NPCs don't repeat.
    {
        message = Random(0,4);
    }
TakeActorInventory(PropTID, "CutterFlag", 10);
GiveActorInventory(PropTID, "CutterFlag", message);
SetActorState(PropTID,"Talking",0);
    switch(whichcharacter)
    {
Case 1:
                    switch(message)
                    {
                        Case 0:
                            NPC_Talk (0.8, 1, "rabble rabble");
                            Delay(talkdelay); break;
                        Case 1:
                            NPC_Talk (0.8, 1, "chit chat");
                            Delay(talkdelay); break;
                        Case 2:
                            NPC_Talk (0.8, 1, "babble babble");
                            Delay(talkdelay); break;
                        Case 3:
                            NPC_Talk (0.8, 1, "blah blah");
                            Delay(talkdelay); break;
                        Case 4:
                            NPC_Talk (0.8, 1, "eyjafjallajokull");
                            Delay(talkdelay/2); SetActorState(105,"Talking",0);
                            NPC_Talk (0.85, 2, "it's a long long name"); //multiple lines!
                            Delay(talkdelay); break;
                    }
break;
}
}

Function void NPC_talk (int whatline, int whichone, str talkertext)
{
LocalAmbientSound("misc/chat",127);
SETFONT("SMALLFONT");
HudMessage(s:talkertext; HUDMSG_PLAIN, whichone, CR_GRAY, 0.0, whatline, 4.5);
}
This is a pretty basic NPC, but it'll do. Modify to your own specifications, and have fun writing funny one-liners.
Title: Re: So About Adding NPCs...
Post by: CoolHuman on August 02, 2017, 02:11:21 PM
Ok, so one last thing. In game, the NPC won't talk because it says that script 101 is missing. Is there a fix to that?
Title: Re: So About Adding NPCs...
Post by: Xhatahx on August 02, 2017, 02:20:06 PM
Simply add the talk script into the level that the NPC is in.
Title: Re: So About Adding NPCs...
Post by: CoolHuman on August 02, 2017, 03:55:54 PM
For some reason, the game cannot load the script even when i put the script into the level. I've also tried placing the talk script in the map script and the actual script file and the script just doesn't load. Idk if i'm doing something incorrectly. :(
Title: Re: So About Adding NPCs...
Post by: Xhatahx on August 02, 2017, 05:01:11 PM
Judging from the fact that you're quite new to this, I'd hazard to guess you aren't compiling the scripts. If that's the case, and you don't have an ACS compiler, you can find an ACS compiler here (https://zdoom.org/downloads) under the name of ACC.

If that's not the case, then I've no clue.
Title: Re: So About Adding NPCs...
Post by: CoolHuman on August 02, 2017, 06:36:39 PM
Judging from the fact that you're quite new to this, I'd hazard to guess you aren't compiling the scripts. If that's the case, and you don't have an ACS compiler, you can find an ACS compiler here (https://zdoom.org/downloads) under the name of ACC.

If that's not the case, then I've no clue.

Well I compiled the Scripts and actually got it to work... somewhat. I can see the npc speaking but cannot see the actual dialogue.
Title: Re: So About Adding NPCs...
Post by: Xhatahx on August 02, 2017, 07:34:48 PM
Do you hear them speaking?
Title: Re: So About Adding NPCs...
Post by: CoolHuman on August 02, 2017, 07:46:35 PM
Nah. The speaking sound doesn't play either.
Title: Re: So About Adding NPCs...
Post by: Xhatahx on August 02, 2017, 10:17:27 PM
Hmm. Can you upload the file so I can see what's going on?
Title: Re: So About Adding NPCs...
Post by: CoolHuman on August 03, 2017, 12:23:22 AM
Okay here is the map:
http://www.mediafire.com/file/8rs7mxa5w86izgi/Kain%27sStrangeHideout.wad

The NPC I would like to alter is the GutsMan prop in the lower left corner.


The map itself is a work in progress though which is why i wanted to add NPCs in the first place.
Title: Re: So About Adding NPCs...
Post by: Xhatahx on August 03, 2017, 07:56:44 AM
You accidentally set Script Argument 1 to 11. It should be set to 1.
also i just murdered frost man
Title: Re: So About Adding NPCs...
Post by: CoolHuman on August 03, 2017, 01:51:30 PM
You accidentally set Script Argument 1 to 11. It should be set to 1.
also i just murdered frost man
Well then... I suppose I was just being really unobservant and forgot that the script argument was supposed to be unique to the NPC.

So thanks for helping me.