Ask about ACS, DECORATE, ZScript, or any other scripting questions here!
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!)
Vaecrius wrote:Thanks!
(I assume "&&(players.mo)" would do the trick? Or do I need to add a !=null after the mo?)
Objects implicitly cast to bool like in C, yes.
Vaecrius wrote:What's the difference between the AddInventory and GiveInventory (and GiveAmmo) functions? Does Add bypass pickup states? Do the first two ignore skill-based ammo doubling?
AddInventory takes an Inventory object (possibly created using Spawn()).
GiveInventory takes a class name.
////////////////////////////////////////////////
ZZYZX wrote:Ok, minus two scripted calls and minus four native calls http://pastebin.com/pmfTPmAq, because 30x slower function call here means noticeably smaller FPS with large usage counts.
And here's ZZYZX's optimized version, tweaked to be blood-splat-friendly. For educational purposes and for anyone else reading this!
I'm trying to make SetToSlope() a generic function that any actor can use, so that I don't have to copy/paste that code ten billion times. And no, I can't make a base class because not everything that will use SetToSlope is the same kind of thing - some of them are vehicles, some of them are blood splats/floor grunge, some of them are even monsters. They're all different kinds of things with a lot of different base classes.
in the actor.
Although if you make this a unified function, I'd give it arguments dAng and pitchOffset externally. And call pitchOffset dPitch for readability. 'd' by itself meant diff, while 'f' means floor.
So how do you... do that? I still don't understand what goes where and why and what "static" means and what can or cannot go into a thing that's "static".
A static function is a function without a hidden "self" argument, that's pretty much it, in simple terms.
As a result, if you want a static function to perform actions on the caller, you must explicitly pass the caller to the function.
Spawn is a function of the Actor class. Your class, Lib, is not a descendant of Actor, so it has no direct access to Spawn. However, since Spawn is Static, you may call it as Actor.Spawn()
Very specific question: How do I make a bullet puff of a hitscan's weapon do something different depending on whether it hit a wall, or a ceiling/floor? Is there any mechanics built-in that can detect these situations?
Nash wrote:Very specific question: How do I make a bullet puff of a hitscan's weapon do something different depending on whether it hit a wall, or a ceiling/floor? Is there any mechanics built-in that can detect these situations?
There's probably better ways to do it, but I'd use [wiki]GetZAt[/wiki] or [wiki]A_CheckSolidFooting[/wiki] on puff spawn to check if it's on the floor or ceiling.
The Zombie Killer wrote:
There's probably better ways to do it, but I'd use [wiki]GetZAt[/wiki] or [wiki]A_CheckSolidFooting[/wiki] on puff spawn to check if it's on the floor or ceiling.
Okay, this solves the condition filtering... now is there any way to get any information about the LINEDEF that the bullet attack hit? I'm hoping to retrieve the angle of the wall that the bullet just hit.
movetarget=spawn("idledummy",pos);
...[in between the movetarget is placed in a position flanking the target]...
//call A_Chase using the movetarget
targbak=target; target=movetarget;
A_Chase(null,null,CHF_NODIRECTIONTURN);
target=targbak;
Nash wrote:
Okay, this solves the condition filtering... now is there any way to get any information about the LINEDEF that the bullet attack hit? I'm hoping to retrieve the angle of the wall that the bullet just hit.
Not yet AFAIK.
I guess you could fire a few hitscans in a "+" pattern from right behind the puff (with super tiny offsets) and calculate the angle between those to account for both slopes and wall angles.
Can't wait for it to be possible though, especially the possibility of retrieving the texture of the wall. I'll go into a frenzy of making F.E.A.R style particle effects if/when that becomes possible.