Replacing the monsters
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.
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.
Replacing the monsters
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?
- Cutmanmike
- Posts: 11354
- Joined: Mon Oct 06, 2003 3:41 pm
- Operating System Version (Optional): Windows 10
- Location: United Kingdom
- Contact:
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:
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*
}
Thanks.
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. 



Yes, you can do it using arrays like this:
Will print "WTF!?!?!?", "A/S/L?", or "I hate you." depending on whether arg1 was 0, 1, or 2.
Code: Select all
Str ThingsToSay[3] = { "WTF!?!?!?", "A/S/L?", "I hate you." };
Script 1 (Int arg1)
{
Print(s:ThingsToSay[arg1]);
}
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:
It turns into this:
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:
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.
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!");
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);
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);
"BWAHHAAHAHHAHHAHA!"
Because when the code is compiled the first line becomes TestString = 1 + 2, which results in 3, so string #3 is used.
- Macil
- Posts: 2529
- Joined: Mon Mar 22, 2004 7:00 pm
- Preferred Pronouns: He/Him
- Location: California, USA. Previously known as "Agent ME".
- Contact:
LOL! (I'm not saying this isnt true, but its just so FUNNY!)HotWax wrote:If we used the above string table, this code:
would output this:Code: Select all
str TestString = "Welcome to Hell!" + "We hope you like it here..."; Print(s:TestString);
"BWAHHAAHAHHAHHAHA!"
Because when the code is compiled the first line becomes TestString = 1 + 2, which results in 3, so string #3 is used.
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

Yes, that's perfectly legal.Agent ME wrote:Is it possible to do str TestString = 1 + 2 ?
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);
- TheDarkArchon
- Posts: 7656
- Joined: Sat Aug 07, 2004 5:14 am
- Location: Some cold place
Yeah, I used like chaingunguy2 and stuff. HEre's the coding
And dehacked:
Code: Select all
ACTOR Chaingunguy2 : Chaingunguy 65
{
DropItem Clip
DropItem Clip
DropItem Clip
}
ACTOR Shotgunguy2 : Shotgunguy 9
{
DropItem Shell
}
Code: Select all
Thing 3 (Sargeant)
ID # = 20001
Thing 11 (Chaingun Sargeant)
ID # = 20000