Re: "How do I ZScript?"
Posted: Fri Mar 03, 2017 10:38 am
The a part will be set to 255, so if you just need RGB you still need the mask. Without setting a to non-0, black blood would not be possible.
Or mark it transientMajor Cooke wrote:Note to self, do NOT put a "Cvar" type variable on a player that's in the actor scope space!
Let me get this straight...Graf Zahl wrote:The a part will be set to 255, so if you just need RGB you still need the mask. Without setting a to non-0, black blood would not be possible.
Code: Select all
Color bl = (bloodcolor & 0xffffff);
Code: Select all
// Where rr, gg, and bb are replaced with the appropriate mask clearance (I don't know what they are)
Color bl = (rr, gg, bb, 255);
Indeed. You can set the Target field directly in ZScript.krokots wrote:I could use some other method other than Thing_Hate.
Code: Select all
native Actor Target;
native Actor Master;
native Actor Tracer;
native Actor LastHeard;
native Actor LastEnemy;
native Actor LastLookActor;
I notice there's a function called ApplyDamageFactors, which is used by PowerProtection. Would this be useful to me? As far as I know, PowerProtection can't overwrite an actor's DamageFactors; it just applies multiplication or division to them.Ed the Bat wrote:Am I able to change type-specific DamageFactors for an actor, so as to modify only how much damage certain types, or "elements", will do to the actor?
Not when you need to setup it in a map, which is what I assume he's trying to do. Otherwise yes, using TIDs for general-purpose stuff is bad here.Nash wrote:Using TIDs for enemy behavior and AI scripting is an obsolete concept and shouldn't be brought over into ZScript. Here, you have direct access to a lot of the juicy internal variables, so manipulate those directly instead.
ApplyDamageFactors takes damage amount and type and processes them by main and damagetype-specific factors, as well as potential armour factors and such. It's informational and doesn't change anything.Ed the Bat wrote:I notice there's a function called ApplyDamageFactors, which is used by PowerProtection. Would this be useful to me? As far as I know, PowerProtection can't overwrite an actor's DamageFactors; it just applies multiplication or division to them.Ed the Bat wrote:Am I able to change type-specific DamageFactors for an actor, so as to modify only how much damage certain types, or "elements", will do to the actor?
I am making a mod in which two groups of monsters fight (kind of like hate arena...but waaaay more complex...spells and everything). So I think they must have TID's to hate each other. That's why I wondered about tidtohate.ZZYZX wrote:Not when you need to setup it in a map, which is what I assume he's trying to do. Otherwise yes, using TIDs for general-purpose stuff is bad here.Nash wrote:Using TIDs for enemy behavior and AI scripting is an obsolete concept and shouldn't be brought over into ZScript. Here, you have direct access to a lot of the juicy internal variables, so manipulate those directly instead.
Obsolete my ass! Team-based combat situations like this EXCEL with them. (Turn your sound down. I'm warning you!)ZZYZX wrote:Not when you need to setup it in a map, which is what I assume he's trying to do. Otherwise yes, using TIDs for general-purpose stuff is bad here.Nash wrote:Using TIDs for enemy behavior and AI scripting is an obsolete concept and shouldn't be brought over into ZScript. Here, you have direct access to a lot of the juicy internal variables, so manipulate those directly instead.
Code: Select all
if (!target || target.health > 0)
{
Thing_Hate(...);
}
Code: Select all
//==========================================================================
// Actor Search
//==========================================================================
void SearchForActors(Class<Actor> Specific = null, bool getClosest = false)
{
if (health < 1) return;
// Search for high priority threats first.
static const int ActorID[] =
{
TID_SoulDestroyer,
TID_Grenade,
TID_Rocket,
TID_Darwinian,
TID_Darwinian
};
static const Class<Actor> ActorList[] =
{
"SoulDestroyer",
"DarwinianGrenade",
"DarwinianRocket",
"DarwinianPlayer",
"Darwinian"
};
static const int ActorDistance[] =
{
512,
256,
256,
384,
384
};
int size = ActorList.Size();
for (int g = 0; g < size; g++)
{
// Do not waste effort searching for things we don't care about. This
// is especially useful for constantly checking for grenades and/or
// rockets, since without this, lots of slowdowns can occur.
if (Specific && ActorList[g] != Specific)
continue;
// See ZMisc.txt
int id = ActorID[g];
double dist = ActorDistance[g];
Class<Actor> cname = ActorList[g];
let it = ActorIterator.Create(id, cname);
Actor mo;
while (mo = it.Next())
{
if (!mo.TID || mo == self || mo.DesignatedTeam == DesignatedTeam || mo.bINVISIBLE)
continue;
// if (mo.GetClass() != "DarwinianGrenade" && isTeammate(mo))
// continue;
double distCheck = Distance2D(mo);
if (distCheck > dist)
continue;
if (mo.tid == TID_Darwinian && !(mo is "PlayerPawn") && !(mo is "Darwinian"))
continue;
//if (!CheckSight(mo, SF_IGNOREVISIBILITY|SF_IGNOREWATERBOUNDARY))
// continue;
if (closestDist < 0.0 || !closest)
{
closest = mo;
closestDist = dist;
}
if (distCheck < closestDist)
{
closest = mo;
closestDist = dist;
}
if (!getClosest)
return;
}
}