Replacing the monsters

Archive of the old editing forum
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
User avatar
Xenaero
Posts: 396
Joined: Wed May 05, 2004 8:14 am
Location: Knee-Deep in ACS
Contact:

Replacing the monsters

Post by Xenaero »

Now, I remember a topic of mine that told me how to replicate the monsters without having to change the doomednums, and thereby replacing them. How do I do this?
User avatar
Cutmanmike
Posts: 11354
Joined: Mon Oct 06, 2003 3:41 pm
Operating System Version (Optional): Windows 10
Location: United Kingdom
Contact:

Post by Cutmanmike »

Might I add, is this possible to do with decorate?
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Post by Kate »

Of course it is, Xaser's Grenades N' Stuff mod does this to make monsters drop items from other games.

Just have the actor inherit from the actor you're replacing and change it's doomednum to that of the monster you want to replace, like this:

Code: Select all

ACTOR ModifiedZombieMan : ZombieMan 3004
{
    *Insert stuff to change here*
}
User avatar
Xenaero
Posts: 396
Joined: Wed May 05, 2004 8:14 am
Location: Knee-Deep in ACS
Contact:

Post by Xenaero »

Thanks. :D Also, is it possible for using one script for printing text using args so you acn print differetn snippets of text? Say for example what i'm doing, when you enter a area it prints "stuff1" and then when you enter another area it prints "stuff2" but only using one script. Possible? :) I bet it is, but wiki isn't working for me. :(
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

Yeah, but im busy now...
User avatar
Kate
... in rememberance ...
Posts: 2975
Joined: Tue Jul 15, 2003 8:06 pm

Post by Kate »

Yes, you can do it using arrays like this:

Code: Select all

Str ThingsToSay[3] = { "WTF!?!?!?", "A/S/L?", "I hate you." };

Script 1 (Int arg1)
{
        Print(s:ThingsToSay[arg1]);
}
Will print "WTF!?!?!?", "A/S/L?", or "I hate you." depending on whether arg1 was 0, 1, or 2.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

I never knew you could do string arrays.
User avatar
cccp_leha
Posts: 1816
Joined: Wed Jul 16, 2003 7:21 am
Location: NJ, USA
Contact:

Post by cccp_leha »

You can do an array of anything and there is no difference between str and int in ACS anyways.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

other than str's arent dynamic (you cant manipulate them, unlike you can manipulate an int).
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Strictly speaking, you're wrong. The string can be manipulated just as easily as the integer, because the string actually holds a value representing the string of characters you entered into the script.

When ACC compiles this:

Code: Select all

SetFont("BigFont");

str Intro = "Welcome to Hell!";
str Intro2 = "We hope you like it here...";

Print(s:Intro);
delay(35*3);
Print(s:Intro2);
delay(35*3);
Print(s:"BWAHHAAHAHHAHHAHA!");
It turns into this:

Code: Select all

String table:
0: BigFont
1: Welcome to Hell!
2: We hope you like it here...
3: BWAHHAAHAHHAHHAHA!

Code:

SetFont(0);

str Intro = 1;
str Intro2 = 2;

Print(s:Intro);
delay(35*3);
Print(s:Intro2);
delay(35*3);
Print(s:3);
The strings are ripped out and placed in the strings table, which is numbered. The code is then changed to replace each string with a number. When a function calls for a string, rather than using the literal value given to it, it looks for the matching string in the string table.

If we used the above string table, this code:

Code: Select all

str TestString = "Welcome to Hell!" + "We hope you like it here...";

Print(s:TestString);
would output this:

"BWAHHAAHAHHAHHAHA!"

Because when the code is compiled the first line becomes TestString = 1 + 2, which results in 3, so string #3 is used.
User avatar
Xenaero
Posts: 396
Joined: Wed May 05, 2004 8:14 am
Location: Knee-Deep in ACS
Contact:

Post by Xenaero »

I just tried to use the monster replacment method told to me by Destroyer, and not only does it give you an error when you start up, but the "clone" doesn't even appear.
User avatar
Macil
Posts: 2529
Joined: Mon Mar 22, 2004 7:00 pm
Preferred Pronouns: He/Him
Location: California, USA. Previously known as "Agent ME".
Contact:

Post by Macil »

HotWax wrote:If we used the above string table, this code:

Code: Select all

str TestString = "Welcome to Hell!" + "We hope you like it here...";

Print(s:TestString);
would output this:

"BWAHHAAHAHHAHHAHA!"

Because when the code is compiled the first line becomes TestString = 1 + 2, which results in 3, so string #3 is used.
LOL! (I'm not saying this isnt true, but its just so FUNNY!)

Is it possible to do str TestString = 1 + 2 ?

When i said they could be manipulated, i meant that you cant change it or apply it to an operation, but obviously you can use it in a different type of equation ;)
User avatar
HotWax
Posts: 10002
Joined: Fri Jul 18, 2003 6:18 pm
Location: Idaho Falls, ID

Post by HotWax »

Agent ME wrote:Is it possible to do str TestString = 1 + 2 ?
Yes, that's perfectly legal.

It's also legal to specify an "int" in place of a "str" when specifying an argument that would otherwise take a string.

For example, the following code will not generate any compiler errors and would work as above:

Code: Select all

int i=random(0, 3);

Print(s:i);
User avatar
TheDarkArchon
Posts: 7656
Joined: Sat Aug 07, 2004 5:14 am
Location: Some cold place

Post by TheDarkArchon »

DD_133 wrote:I just tried to use the monster replacment method told to me by Destroyer, and not only does it give you an error when you start up, but the "clone" doesn't even appear.
Did you rename them slightly. E.G in Grenades n' stuff, Xaser used names like ZombieMan_ and DoomImp_.
User avatar
Xenaero
Posts: 396
Joined: Wed May 05, 2004 8:14 am
Location: Knee-Deep in ACS
Contact:

Post by Xenaero »

Yeah, I used like chaingunguy2 and stuff. HEre's the coding

Code: Select all

ACTOR Chaingunguy2 : Chaingunguy 65
{
    DropItem Clip
    DropItem Clip
    DropItem Clip
}

ACTOR Shotgunguy2 : Shotgunguy 9
{
    DropItem Shell
}
And dehacked:

Code: Select all

Thing 3 (Sargeant)
ID # = 20001

Thing 11 (Chaingun Sargeant)
ID # = 20000
Locked

Return to “Editing (Archive)”