PDF's Ridiculous Editing Questions
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.
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
Perhaps I'm just sleep-deprived or just plain out of it, but I don't quite get what you mean. Wouldn't setting Player 1 as TID 750 on the map and using HotWax's command Thing_Destroy(750,1); do the trick already?Apothem wrote:It's always worked, you just probably never knew about it
Pretty simple too, just use changetid command on enter and change it to whatever. For multiplayer support use playernumber() + offset number.
Another question came up while working on a map and getting frustrated at the lame AI trying to bail me out:
8: Is there any way in a Single Player game to have no Friendly Fire? I.E., ally has a powerful Railgun, but not a whole lot of HPs to have him slug it out on his own. You want to get in and fight together, but there's a chance you can hurt him, or a railshot can go through you.
No it wouldn't. You can't set the player's TID on the map. In fact, you're actually setting the Player X Start's TID, and at map start, those starts are removed from the map (only their location is saved and used for the players' start positions), so you now have nothing on the map with TID 750 that you can interact with.Project Dark Fox wrote:Perhaps I'm just sleep-deprived or just plain out of it, but I don't quite get what you mean. Wouldn't setting Player 1 as TID 750 on the map and using HotWax's command Thing_Destroy(750,1); do the trick already?
You can set the player's TID in an ENTER script, but if you just set it to a single number and then somebody decides to play your map multiplayer, the Thing_Destroy command would kill all the players!
Using PlayerNumber() + offset ensures that each player is assigned a unique TID and can be acted upon individually. It also works in single-player, so it's a win-win situation.
Code: Select all
script 1 ENTER {
Thing_ChangeTID(0, PlayerNumber() + 1337);
}
script 900 (void) {
// Kill the player foolish enough to cross the Line of Death!(TM)
// Leave the other players alone
Thing_Destroy(PlayerNumber() + 1337, 1);
}The only method I'm aware of is using +GHOST and +THRUGHOST hackery. If you use the SVN you can use custom pass-through flags to match up the weapons and actors so they don't impact one another, but I don't think it works for hitscan attacks.Another question came up while working on a map and getting frustrated at the lame AI trying to bail me out:
8: Is there any way in a Single Player game to have no Friendly Fire? I.E., ally has a powerful Railgun, but not a whole lot of HPs to have him slug it out on his own. You want to get in and fight together, but there's a chance you can hurt him, or a railshot can go through you.
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
@ #7: So I can just copy that first script into the ENTER script to get a "floating TID"? Fortunately, I don't have Multi-Player in mind (yet), but I can also use the final line in script 900 of yours to kill off the player if he fails his defense mission.
@ #8: The best option then is to advise players to watch their ass.
@ #8: The best option then is to advise players to watch their ass.
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
Hey, guys, here's a more interesting question or two.
9a: I have finally decided to change to an ACS-driven HUD, assuming DoomScript takes its time. While I've got no problems with the Health and Armor values, since they will be numeric; but I'm having a bitch of a time getting 11 (1 for empty) levels of fillbars up for ammo values instead of numbers. Mostly because I don't have a clue how to do arithmetic in ACS. I am calling for CheckInventory() and GetAmmoCapacity(), how do you set it up to do basically this: (Current Ammo x 10) / Max Ammo = Ammo Points ? (If Ammo Points = 5, the respective bar will be half-full)
9b: Which function calls up the numerical value on the weapon you're currently carrying -- if it exists?
9a: I have finally decided to change to an ACS-driven HUD, assuming DoomScript takes its time. While I've got no problems with the Health and Armor values, since they will be numeric; but I'm having a bitch of a time getting 11 (1 for empty) levels of fillbars up for ammo values instead of numbers. Mostly because I don't have a clue how to do arithmetic in ACS. I am calling for CheckInventory() and GetAmmoCapacity(), how do you set it up to do basically this: (Current Ammo x 10) / Max Ammo = Ammo Points ? (If Ammo Points = 5, the respective bar will be half-full)
9b: Which function calls up the numerical value on the weapon you're currently carrying -- if it exists?
- solarsnowfall
- Posts: 1581
- Joined: Thu Jun 30, 2005 1:44 am
CheckInventory (str inventory_item)
That should work, though there may be a better way to approach the math. Just call CheckInventory in place of "current ammo".Project Dark Fox wrote:Current Ammo * 100 / Max Ammo = Ammo Points
[wiki]CheckWeapon[/wiki] takes a string (the class name of the weapon) and will return true if that is the player's active weapon (assuming the player is the script activator.) If you want to have a function which returns a number based on what weapon the player is using, you can just write one yourself, e.g.Project Dark Fox wrote:9b: Which function calls up the numerical value on the weapon you're currently carrying -- if it exists?
Code: Select all
#define WEAPON_CHAINSAW 0
#define WEAPON_FIST 1
// etc...
function int playerWeapon()
{
if( CheckWeapon("Chainsaw") )
{
return WEAPON_CHAINSAW;
}
else if( CheckWeapon("Fist") )
{
return WEAPON_FIST;
}
// etc...
}- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
I'm having bitchfits with how the arithmetic works in ACS. I am fully aware of CheckInventory, because it is ACC otherwise breaking on me once it encounters "*" in a script. I'm trying to figure out why it doesn't like that symbol in something like this:solarsnowfall wrote:CheckInventory (str inventory_item)That should work, though there may be a better way to approach the math. Just call CheckInventory in place of "current ammo".Project Dark Fox wrote:Current Ammo * 100 / Max Ammo = Ammo Points
Code: Select all
script 901 (void) //
{
[...]
10 * CheckInventory("Clip") / GetAmmoCapacity("Clip") = ammocount1;
^ BREAKAGE!Zippy: GAH!! I left out a few words in that question. Fixing...
PDF (Fixed) wrote:9b: Which function calls up the numerical value on the weapon's ammo count you're currently carrying -- if it exists?
You're backwards.Project Dark Fox wrote:Code: Select all
script 901 (void) // { [...] 10 * CheckInventory("Clip") / GetAmmoCapacity("Clip") = ammocount1; ^ BREAKAGE!
Code: Select all
ammocount1 = 10 * CheckInventory("Clip") / GetAmmoCapacity("Clip");You'll have to set up something similar to what I just posted above. Specifically, check which weapon the player is using, and then use that to CheckInventory the proper ammo type.Project Dark Fox wrote:Zippy: GAH!! I left out a few words in that question. Fixing...PDF (Fixed) wrote:9b: Which function calls up the numerical value on the weapon's ammo count you're currently carrying -- if it exists?
Heh. C format != Algebra. 
The poor compiler can only read left to right and process as it goes, y'know.
So first it sees "10"... "10? 10 what? What's going on here? Well I'm sure the next token will make it all clear" Then of course it sees "*". "OMG, does not compute. ERROR ERROR DANGER WILL ROBINSON" puffs smoke out its ears for several seconds and then collapses on the floor. Nice going, you just killed the compiler.
On the other hand when it read's Zippy's it goes "ammocount1? Hey, I know what that is because it was defined above. Awesome! Let's see, then we have an equals sign, so we're doing assignment. Perfect. So now I just perform the calculation on the right side and assign the result back to ammocount1. I love my life!"
... Or something like that, anyway.
The poor compiler can only read left to right and process as it goes, y'know.
So first it sees "10"... "10? 10 what? What's going on here? Well I'm sure the next token will make it all clear" Then of course it sees "*". "OMG, does not compute. ERROR ERROR DANGER WILL ROBINSON" puffs smoke out its ears for several seconds and then collapses on the floor. Nice going, you just killed the compiler.
On the other hand when it read's Zippy's it goes "ammocount1? Hey, I know what that is because it was defined above. Awesome! Let's see, then we have an equals sign, so we're doing assignment. Perfect. So now I just perform the calculation on the right side and assign the result back to ammocount1. I love my life!"
... Or something like that, anyway.
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
- Project Shadowcat
- Posts: 9369
- Joined: Thu Jul 14, 2005 8:33 pm
- Preferred Pronouns: They/Them
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: Blacksburg, SC USA
- Contact:
HotWax: If I find something like that around here in the middle of nowhere I'll let you know. 
Zippy, 9b: I tried expanding on your bit of ACS, and... I got only errors.
Here's some of the code:
And the errors:
Zippy, 9b: I tried expanding on your bit of ACS, and... I got only errors.
Here's some of the code:
Code: Select all
#define AMMO_NULL 0
#define AMMO_BULL 1
#define AMMO_SHEL 2
#define AMMO_HEAP 3
#define AMMO_BATT 4
// etc...
function int playerWeapon()
{
if( CheckWeapon("Fist") )
{
return AMMO_NULL;
}
else if( CheckWeapon("Pistol1") )
{
return AMMO_BULL;
}
else if( CheckWeapon("Pistol-S") )
{
return AMMO_BULL;
}
else if( CheckWeapon("Shotgun") )
{
return AMMO_SHEL;
}
else if( CheckWeapon("SuperShotgun") )
{
return AMMO_SHEL;
}Code: Select all
Line 16 in file "script.acs" ...
script.acs:16: Invalid variable type.
> function int playerWeapon()
> ^
script.acs:17: Invalid identifier.
> {
> ^- solarsnowfall
- Posts: 1581
- Joined: Thu Jun 30, 2005 1:44 am
How about this?function int PlayerWeapon (void)
Code: Select all
#define NUM_WEAPONS 5
#define WEAPON_FAIL 65536 //value to return if a weapon from the string array can't be found.
str weapons[NUM_WEAPONS] = {"Fist", "Pistol1", "Pistol-S", "Shotgun", "SuperShotgun"};
function int playerWeapon (void)
{
for (int w=0; w<NUM_WEAPONS; w++)
if (CheckWeapon (weapons[w]))
return w;
return WEAPON_FAIL;
}