Making friendly monsters hostile via script execute
Moderator: GZDoom Developers
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Please bear in mind that the people helping you do not automatically know how much you know. You may be asked to upload your project file to look at. Don't be afraid to ask questions about what things mean, but also please be patient with the people trying to help you. (And helpers, please be patient with the person you're trying to help!)
Making friendly monsters hostile via script execute
What command do i need the script to call for the monster executing the script to turn hostile?
Im using UDMF and am trying to have a ZSDF dialog option initiate a fight between the player and npc.
Im using UDMF and am trying to have a ZSDF dialog option initiate a fight between the player and npc.
Re: Making friendly monsters hostile via script execute
How about using SetActorFlag to get rid of the FRIENDLY flag?
Re: Making friendly monsters hostile via script execute
I tried getting SetActorFlag to work but it wont even compile the script.
#include "zcommon.acs"
script 1 (void)
{
{
SetActorFlag(0, "Friendly", false);
}
}
This is what i have in a test wad and everytime i compile the script it either says SetActorFlag is used but not defined or it tells me a ")" is missing somewhere.
My mapformat is UDMF and im using doom builder 2 if that matters
#include "zcommon.acs"
script 1 (void)
{
{
SetActorFlag(0, "Friendly", false);
}
}
This is what i have in a test wad and everytime i compile the script it either says SetActorFlag is used but not defined or it tells me a ")" is missing somewhere.
My mapformat is UDMF and im using doom builder 2 if that matters
Re: Making friendly monsters hostile via script execute
That's weird, I copied the script and it compiled normally for me in SLADE.
Maybe it's a DB2 thing?
Maybe it's a DB2 thing?
Re: Making friendly monsters hostile via script execute
It might be, i read that there isnt much that DB2 lacks so i kinda only know how to work with it.
I also only got into this a few days ago so it might be i miss something really simple and basic.
When i want to use the function mentioned on the zdoomwiki page SetActorFunktion do i need to type out every value given in the script too?
For example : "int SetActorFlag (int tid, str flagname, bool value);"
Do i need to type the integer only within () or before the function aswell?
#include "zcommon.acs"
int Demon = 0;
script 1 enter
{
SetActorFlag(Demon,"FRIENDLY","flase");
}
This is the basicly the example given on the ZDoomwiki page just without the if thing, since i just want it to set the flag of a friendly monster to false once i enter the level.
As said it wont even let me compile without the error message :"Function setactorflag is used but not defined." but i cant figure out what it wants from me.
I also only got into this a few days ago so it might be i miss something really simple and basic.
When i want to use the function mentioned on the zdoomwiki page SetActorFunktion do i need to type out every value given in the script too?
For example : "int SetActorFlag (int tid, str flagname, bool value);"
Do i need to type the integer only within () or before the function aswell?
#include "zcommon.acs"
int Demon = 0;
script 1 enter
{
SetActorFlag(Demon,"FRIENDLY","flase");
}
This is the basicly the example given on the ZDoomwiki page just without the if thing, since i just want it to set the flag of a friendly monster to false once i enter the level.
As said it wont even let me compile without the error message :"Function setactorflag is used but not defined." but i cant figure out what it wants from me.
Re: Making friendly monsters hostile via script execute
If you don't plan on changing the integer on the fly, you don't need to define it anywhere outside the function itself.
If you set it to 0, it will change the flag of the activator, which is the player since it's an ENTER script.
This script will also play when a player joins, so if you want to execute this script only once, use an OPEN script.
(void) can be used if you want to execute the script manually too.
Don't forget to also assign a TID to the demon you want to affect.
0 will work only if the demon is executing the script.
So, instead of doing that, you can do this:
If you set it to 0, it will change the flag of the activator, which is the player since it's an ENTER script.
This script will also play when a player joins, so if you want to execute this script only once, use an OPEN script.
(void) can be used if you want to execute the script manually too.
Don't forget to also assign a TID to the demon you want to affect.
0 will work only if the demon is executing the script.
So, instead of doing that, you can do this:
Spoiler:
Re: Making friendly monsters hostile via script execute
I tried to write your example in my script and i dont think i missed anything but it still gives me this message https://imgur.com/a/bujyB8V
I dont know if it matters but the script editor also doesnt react to the SetActorFunction by colouring it or showing suggestions like it does for print or HudMessage.
I dont know if it matters but the script editor also doesnt react to the SetActorFunction by colouring it or showing suggestions like it does for print or HudMessage.
Re: Making friendly monsters hostile via script execute
I think DB2's ACS might be just outdated, because I am able to compile it in SLADE.
Re: Making friendly monsters hostile via script execute
Do i need to update my DB2, switch to a diffrent builder or can i just write it in salde?
Also if i do write scripts in slade do i need to select the text language manually or does it just adapt to whats written?
Also if i do write scripts in slade do i need to select the text language manually or does it just adapt to whats written?
Re: Making friendly monsters hostile via script execute
You can just write it in SLADE if you wish, though there are more advanced map builders now, like Ultimate Doom Builder.
It's your call though.
As for compiling scripts in SLADE, you don't need to set the text language, all it does is highlight functions and such.
You just need to write the script and press the compile button. (blue arrow)
With SLADE you will also need a compiler, like ACC.
It's your call though.
As for compiling scripts in SLADE, you don't need to set the text language, all it does is highlight functions and such.
You just need to write the script and press the compile button. (blue arrow)
With SLADE you will also need a compiler, like ACC.
Re: Making friendly monsters hostile via script execute
Is there a way to seperate DB2 compatible commands from the rest when searching through Doomwiki?
I didnt see any UDB features wich i would need so i'd rather not switch builders.
I also tried to use SetActorProperty to change my monsters flag and it the script editor does regotnize the command but when i call the script the monster stays friendly.
Pic of script https://imgur.com/a/BzrTQ6H
Having the script just being a voidscript and calling via a walkover line didnt work for me either.
I didnt see any UDB features wich i would need so i'd rather not switch builders.
I also tried to use SetActorProperty to change my monsters flag and it the script editor does regotnize the command but when i call the script the monster stays friendly.
Pic of script https://imgur.com/a/BzrTQ6H
Having the script just being a voidscript and calling via a walkover line didnt work for me either.
Re: Making friendly monsters hostile via script execute
I figured it out. I now just have my mob call a void script with SetActorProperty and its good to go but i still can get SetActorFlag to work :/
But thank you for your help Jarewill
But thank you for your help Jarewill
-
- Posts: 5046
- Joined: Sun Nov 14, 2010 12:59 am
Re: Making friendly monsters hostile via script execute
DB2 uses ACC to compile ACS scripts. Now, since DB2 is very old, the version of ACC it's shipped with is equally old. So download the latest ACC and overwrite the one used by the editor with it (it's been about four years since I last used any form of DB2 editor, so I can't tell you exactly where ACC is located in the DB2 installation, as I don't remember).