Author Topic: StatMod Help  (Read 1277 times)

I am trying to make a stat mod, well, I guessed to what methods to use, and I am not sure whats wrong.

It echos

"1.#INF"

to the console every time I shoot at a monster.
Code: [Select]
-snip-Is most likely not to be the right way to get to the projectile direct Damage from the ShapeBaseImageData.


I don't know what to do at this point, I don't even know if creating
Code: [Select]
%col or %ownerobj.DamCoand stuff work.

Also, what exactly are the three arguments for ShapeBaseImageData::onFire?

I am assuming the second one is the owners object.

tl;dr: I do not that many functions or definite syntax for using datablocks.
« Last Edit: October 10, 2009, 12:39:11 AM by Zenthos »

RegisterSpecialVar is for Variable Conditional Events; Are you try to be able to see variables through events?
Also, I don't think variables v5 works like that:
(eg. You modVariable "One" to Zero, that doesn't make %client.One = 0;)
I could be wrong, but I think he changed the system in the big update.

Well, I put echo as a developmental feature for me to see if its working.

Its supposed to be stat variable replacers to go into the variable & conditionable events.


Its making the variables 0 that I am putting in, and doing the projectile damage / 0...

:/

RegisterSpecialVar is for Variable Conditional Events; Are you try to be able to see variables through events?
Also, I don't think variables v5 works like that:
(eg. You modVariable "One" to Zero, that doesn't make %client.One = 0;)
I could be wrong, but I think he changed the system in the big update.


Just as a response,
Code: [Select]
RegisterSpecialVar(FxDtsBrick,"lastProj","%this.lastProjectile");

package lastProjectile
{
function ProjectileData::onCollision(%this,%obj,%col,%fade,%pos,%norm)
{
Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm);
if(%col.getClassName() $= "fxDtsBrick")
{
%col.lastProjectile = %obj.getDataBlock().uiName;
}
}
};
activatePackage(lastProjectile);

(last projectile var)


I just found this, and it uses the RegisterSpecialVar(Obj, "Name", "script");

Oh yes, I am using VCE.


Just as a response,
Code: [Select]
RegisterSpecialVar(FxDtsBrick,"lastProj","%this.lastProjectile");

package lastProjectile
{
function ProjectileData::onCollision(%this,%obj,%col,%fade,%pos,%norm)
{
Parent::onCollision(%this,%obj,%col,%fade,%pos,%norm);
if(%col.getClassName() $= "fxDtsBrick")
{
%col.lastProjectile = %obj.getDataBlock().uiName;
}
}
};
activatePackage(lastProjectile);

(last projectile var)


I just found this, and it uses the RegisterSpecialVar(Obj, "Name", "script");

Oh yes, I am using VCE.

Hey, thats my script  :cookieMonster:
Well, I notice your trying to divide by %col.DefCo, which isn't defined, and %col will be ANYTHING that it collides with. You need to check if it's a player object by using:
Code: [Select]
if(%col.getClassName() $= "PlayerObjectType")Or some similar method.

I'd recommend using player::onDamage instead of projectile::onCollision.

player::onDamage(%this, %obj, %pos, %amt, %type)

Hmm, right now Im trying Armor::damage...

Ill look into it.

"Registering" special VCE variables simply allows you to make your own VCE variable replacers. It's not to make it so you can use VCE variables on the run. To get the value of a VCE variable you do this:
%brickGroup.varGroup.getVariable(%type,%name,%obj)
%brickGroup is obtained by using getBrickGroupFromObject(%client_or_brick_or_minigame_or_player)
%type is a indicator of the type of variable it is. By default these are included:
"Player"
"Client"
"Brick"
"Vehicle"
"Minigame"
%name is the name of the variable. (In your case "DamCo" or "DamBonus" or "DefCo" or "DefBonus")
%obj is the object you wish to get the variable value of. It can be all of the objects mentioned in %type.

"Registering" special VCE variables simply allows you to make your own VCE variable replacers. It's not to make it so you can use VCE variables on the run. To get the value of a VCE variable you do this:
%brickGroup.varGroup.getVariable(%type,%name,%obj)
%brickGroup is obtained by using getBrickGroupFromObject(%client_or_brick_or_minigame_or_player)
%type is a indicator of the type of variable it is. By default these are included:
"Player"
"Client"
"Brick"
"Vehicle"
"Minigame"
%name is the name of the variable. (In your case "DamCo" or "DamBonus" or "DefCo" or "DefBonus")
%obj is the object you wish to get the variable value of. It can be all of the objects mentioned in %type.

Oh ok, so replacers are exactly what they sound like, they replace variables from scripts.

So I don't need to use them, thanks for this.

Update:


Give comments to whats wrong.
Code: [Select]
-snip-
« Last Edit: October 10, 2009, 12:39:28 AM by Zenthos »

Shouldn't the damage be taken from the source, and the defence taken from the one being hit?

Shouldn't the damage be taken from the source, and the defence taken from the one being hit?

Oh yea the %sourceBrickgroup / $brickgroup thing.


Ok, heres an updated one with that fixed:
Code: [Select]
-snip-
in Armor::damage, is the second argument the player object or the armor object (well, if that exists)

I'm using it here as the player object...

Also, is the 5th argument (%damage here) an object/datablock or variable?

If its an object/datablock, how do I access the damage it does?
« Last Edit: October 10, 2009, 12:39:43 AM by Zenthos »

%this is the player's datablock.
%obj is the player object.
%sourceObj is usually the projectile.
%position is where the projectile hit, not from the player but from the mission origin. Like, 53.5233 204.2312 10.2556
%damage is the numeric value for damage. (Not a datablock) Like 20, or 53.8.
%damageType is a string, like "Fire" or "Arrow".