The "How do I..." Thread
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.
- TheMightyHeracross
- Posts: 2100
- Joined: Sun Aug 18, 2013 9:41 am
- Location: Philadelphia, PA
Re: The "How do I..." Thread
Ooh, you want a refiring monster!
Have them use their aiming sprite for acouple of tics, while calling A_FaceTarget.
Then, make them shoot, wait 3-4 tics while still calling A_FaceTarget, then make an extra aiming state that calls A_MonsterRefire, or A_CPosRefire, etc. Put "Goto Missle+1"
Look at the Chaingunner for reference.
Have them use their aiming sprite for acouple of tics, while calling A_FaceTarget.
Then, make them shoot, wait 3-4 tics while still calling A_FaceTarget, then make an extra aiming state that calls A_MonsterRefire, or A_CPosRefire, etc. Put "Goto Missle+1"
Look at the Chaingunner for reference.
Re: The "How do I..." Thread
right on, thanks.
- TheMightyHeracross
- Posts: 2100
- Joined: Sun Aug 18, 2013 9:41 am
- Location: Philadelphia, PA
Re: The "How do I..." Thread
Glad to be of help. 

Re: The "How do I..." Thread
Can anyone tell me.... How do I scale down a portrait for the doomguy? I mean to keep the resolution and still scale the image down so it fits in the frame (like using scale on decorate) Is there a way through acs?
Re: The "How do I..." Thread
What about that?
Logan MTM wrote:How do you create a Actor that only serves to open doors when you approach and close when away?
Any idea?
- Ral22
- Posts: 531
- Joined: Sun Sep 05, 2010 12:09 pm
- Preferred Pronouns: He/Him
- Location: The Fortress of Dr. Radiaki
- Contact:
Re: The "How do I..." Thread
Is it possible to declare a static variable or string in an ACS library with a value, then access said variable with the same value in a map script?
Example from the ACS Library:
Example from the map ACS:
As of right now, when the messages display, they mysteriously take the string I placed in set font, so I have two messages that state "JFont". If this cannot work, for whatever reason, is it possible to give a value to a global int/str right off the bat? Using "global int 1:Talking1 = "Hello." " causes an error. Any ideas or help with this?
Example from the ACS Library:
Code: Select all
#library "drtalk.acs"
#include "zcommon.acs"
int Talking1 = "Hello";
str Talking2 = "Hello again";
Code: Select all
#include "zcommon.acs"
#import "drtalk.acs"
Script 1 (Void)
{
SetFont("JFont");
HudMessage(s:Talking1, HUDMSG_PLAIN, 5, 0, 0.5, 0.5, 0);
HudMessage(s:Talking2, HUDMSG_PLAIN, 4, 0, 0.4, 0.4, 0);
}
- wildweasel
- Posts: 21706
- Joined: Tue Jul 15, 2003 7:33 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): A lot of them
- Graphics Processor: Not Listed
- Contact:
Re: The "How do I..." Thread
Hmm...is there some reason why you couldn't use Language strings for this instead?
- Ral22
- Posts: 531
- Joined: Sun Sep 05, 2010 12:09 pm
- Preferred Pronouns: He/Him
- Location: The Fortress of Dr. Radiaki
- Contact:
Re: The "How do I..." Thread
It's a double-edged sword, really. While the addition of LANGUAGES does make the initial retrieval for HudMessage easier, it raises issues with the HudMessageTime (http://zdoom.org/wiki/Hudmessagetime) function that I use afterwards, since the "strlen" portion of the the script is unable to retrieve from LANGUAGES.
This essentially leaves me with two options: Document the number of characters that are in each string in the LANGUAGE lump, or suggest to the Features Suggestion that "strlen" have added support for LANGUAGE retrieval. I'll probably do both, suggest the feature and then count the characters of my strings in hopes that the suggestion is added. I believe that LANGUAGE use is the way to go, though. Thank you, WildWeasel. You're a god among men.
This essentially leaves me with two options: Document the number of characters that are in each string in the LANGUAGE lump, or suggest to the Features Suggestion that "strlen" have added support for LANGUAGE retrieval. I'll probably do both, suggest the feature and then count the characters of my strings in hopes that the suggestion is added. I believe that LANGUAGE use is the way to go, though. Thank you, WildWeasel. You're a god among men.
Re: The "How do I..." Thread
For messages use world or global arrays as I did.Using "global int 1:Talking1 = "Hello." " causes an error.
ACS library:
Code: Select all
world str 9:uzenetek2[];

Then below:
Code: Select all
script 200 OPEN
{
uzenetek2[0] = "msg1"; // here you can upload your array with elements
uzenetek2[1] = "msg2";
}
Code: Select all
function int ido2(int uzenetszam, int sebesseg)
{
int hossz = StrLen(uzenetek2[uzenetszam-1]) << 16;
return FixedDiv(hossz, sebesseg);
}
function int kiiras(str szoveg, int szin, int x, int y, int uziszam, int sebesseg, int arany)
{
int eltunes = FixedMul(arany, ido2(uziszam, sebesseg));
int idotartam = FixedMul(1.0-arany,ido2(uziszam, sebesseg));
hudmessage(s: szoveg; HUDMSG_FADEOUT|HUDMSG_LOG, 0, szin, x, y, idotartam, eltunes);
return (FixedMul(35.0,idotartam+eltunes) + 0.5) >> 16;
}
Code: Select all
script 112 (int uzenet, int szin, int pozicio) // kiírásos script
{
int varas;
int seb = 15.0;
int elt = 0.35;
int p = FixedDiv((pozicio << 16),100.0);
if(uzenet == 5)
{
jelzo = 1;
}
varas = kiiras(uzenetek2[uzenet-1], szin, 1.5, p, uzenet, seb, elt);
delay(varas);
if(uzenet == 5)
{
jelzo = 0;
}
}
So if you have 0.35, it means that disappearing will be 35% of the whole message displaying time and showing will be 65% of it. The whole message displaying time depends on the length of the message.
Then in your map scripts you can refer to the script 112 like this:
Code: Select all
ACS_ExecuteWait(112, 0, 28, 5, 40);
Re: The "How do I..." Thread
Which is unlikely to happen (or at least it really really shouldn't happen), seeing as LANGUAGE strings are for creating strings shared between languages, and are unlikely to share the same length. This would make synchronization a bit of a cluster fuck. Well, more so then it is already at the moment.Ral22 wrote:or suggest to the Features Suggestion that "strlen" have added support for LANGUAGE retrieval.
- Ral22
- Posts: 531
- Joined: Sun Sep 05, 2010 12:09 pm
- Preferred Pronouns: He/Him
- Location: The Fortress of Dr. Radiaki
- Contact:
Re: The "How do I..." Thread
Well, an addition to strlen for LANGUAGE retrieval shouldn't cause any type of issue if the scripts are format correctly. Actually, it would better allow for translations concerning their use in Print and HudMessage so that the messages could support a variety of languages, but still be used by strlen.
For example, your LANGUAGE text could look like this:
Using this LANGUAGE text, when you apply it to a HudMessage script:
The delay portion will take into account the difference in characters for each language, but should have no synching problems.
For example, your LANGUAGE text could look like this:
Code: Select all
[enu default]
LANG_STRING = "Hello.";
[esn]
LANG_STRING = "Hola.";
Code: Select all
SetPlayerProperty(1,1,4);
SetFont("BIGFONT");
HudMessage(l:"LANG_STRING"; HUDMSG_TYPEON, 1, CR_WHITE, 10.1, 205.1, 0.5, 0.02, 0);
Delay(HudMessageTime(HUDMSG_TYPEON, strlen(l: "LANG_STRING"), 0.02, 0.5, 0));
SetPlayerProperty(1,0,4);
Re: The "How do I..." Thread
I'm not really sure what you are getting at. One language string has a length of 6, the other has 5. Thus, the delay would be for different lengths, causing SetActorProperty to be called at inconsistent intervals. Now, if what you are saying is "strlen should use the longest string for the delay", then why don't you do that already? You already know how long the string is...
- Ral22
- Posts: 531
- Joined: Sun Sep 05, 2010 12:09 pm
- Preferred Pronouns: He/Him
- Location: The Fortress of Dr. Radiaki
- Contact:
Re: The "How do I..." Thread
@Edward850: Well, I feel that we should continue this discussion in the Suggestion thread I have for this strlen issue (Here: http://forum.zdoom.org/viewtopic.php?f= ... 39#p713839) so we do not derail the purpose of this "How Do I" thread.
Re: The "How do I..." Thread
Here's a difficult one: Would it be possible to have actors that spawn in random amounts and random positions every time a map is loaded? Let's say there's a sector that's a desk, and there's a coffee cup actor on that desk. Every time the map is loaded, the amount of coffee cups could be anything from one to four. They also could be positioned anywhere within that one desk sector.
Re: The "How do I..." Thread
I would use one or two acs script(s) for this.