Jump to content

DMG Health Script


DaemonGrin

Recommended Posts

I know the basic dmg health line but I was curious if there a script that gives a more complex statement that has a base amount of dmg that uses a level multiplier to increase the dmg based on player level?

 

Thanks,

Geoff

Link to comment
Share on other sites

Can you be more specific? How are you planning to use it?

 

Setting damage multipliers is usually done with perks or actor/object effects.

 

I have an OnTriggerEnter Player script that destroys a door with an explosion (you assisted me with that statement) that knocks the player down I want to add the dmg level multiplier to it.

 

Thanks,

Geoff

Link to comment
Share on other sites

set iLvl to Player.GetLevel
set iDmgMlt to iLvl * GlobDmgMult
Player.DamageAV Health iDmgMlt

Where GlobDmgMult is a global or script variable that holds the mult value for how much extra damage to do.

Link to comment
Share on other sites

set iLvl to Player.GetLevel
set iDmgMlt to iLvl * GlobDmgMult
Player.DamageAV Health iDmgMlt

Where GlobDmgMult is a global or script variable that holds the mult value for how much extra damage to do.

 

You would have to do a Ref walk here to emulate area of effect, unless the OP only means for the damage increase/decrease to apply on the player.

 

I think what I would do is create several explosion objects, each dealing a different amount of damage, then use a script to select the explosion according to level range:

set iLevel to player.GetLevel
if iLevel >= 20
	PlaceAtMe DoorExplosion100Dmg 1
elseif iLevel >= 15
	PlaceAtMe DoorExplosion80Dmg 1
elseif iLevel >= 10
	PlaceAtMe DoorExplosion60Dmg 1
else
	PlaceAtMe DoorExplosion40Dmg 1
endif
Link to comment
Share on other sites

 

set iLvl to Player.GetLevel
set iDmgMlt to iLvl * GlobDmgMult
Player.DamageAV Health iDmgMlt

Where GlobDmgMult is a global or script variable that holds the mult value for how much extra damage to do.

 

You would have to do a Ref walk here to emulate area of effect, unless the OP only means for the damage increase/decrease to apply on the player.

 

I think what I would do is create several explosion objects, each dealing a different amount of damage, then use a script to select the explosion according to level range:

set iLevel to player.GetLevel
if iLevel >= 20
	PlaceAtMe DoorExplosion100Dmg 1
elseif iLevel >= 15
	PlaceAtMe DoorExplosion80Dmg 1
elseif iLevel >= 10
	PlaceAtMe DoorExplosion60Dmg 1
else
	PlaceAtMe DoorExplosion40Dmg 1
endif

 

Yeah it's just going to apply to the player (as of now). I'm to sleepy to work on it right now but I will most likely have more questions when I wake up tomorrow lol. I have one ? at the moment for the GlobDmgMult do I add an int value at the end or replace with the int value or neither lol new to scripting.

 

Thanks Guys!

Geoff

Link to comment
Share on other sites

You don't actually have to use a variable here. For instance:

set iDamage to 20 + (player.GetLevel * 5)
player.DamageActorValue Health iDamage

This will deal a base damage of 20HP + an additional 5HP/level.

Link to comment
Share on other sites

You don't actually have to use a variable here. For instance:

set iDamage to 20 + (player.GetLevel * 5)
player.DamageActorValue Health iDamage

This will deal a base damage of 20HP + an additional 5HP/level.

 

Oh! Now that is perfect!

 

Thanks d00d!

Geoff

Link to comment
Share on other sites

You would have to do a Ref walk here to emulate area of effect, unless the OP only means for the damage increase/decrease to apply on the player.

The OP said when the player enters a trigger. I assume that the trigger is in close enough proximity to the door that the damage makes sense. Which is why I wrote that, because it could be part of the OnTriggerEnter block, and be nicely contained in a single script simple execution.

 

The multiple explosions method works, unless you don't feel like making all the multiple extra explosion forms. Personally I would use the scripted method just for simplicity and fewer forms needed. But that's me.

 

@DaemonGrin, the reason I made it a variable was so that, in the case you want to use this in multiple places, and then later realize it's too powerful, it would be very easy to change the damage. Same for in game testing, if one value was too powerful just change the global value and retry, instead of exiting and recompiling the script. But that's just me :)

Link to comment
Share on other sites

 

You would have to do a Ref walk here to emulate area of effect, unless the OP only means for the damage increase/decrease to apply on the player.

The OP said when the player enters a trigger. I assume that the trigger is in close enough proximity to the door that the damage makes sense. Which is why I wrote that, because it could be part of the OnTriggerEnter block, and be nicely contained in a single script simple execution.

 

The multiple explosions method works, unless you don't feel like making all the multiple extra explosion forms. Personally I would use the scripted method just for simplicity and fewer forms needed. But that's me.

 

@DaemonGrin, the reason I made it a variable was so that, in the case you want to use this in multiple places, and then later realize it's too powerful, it would be very easy to change the damage. Same for in game testing, if one value was too powerful just change the global value and retry, instead of exiting and recompiling the script. But that's just me :smile:

 

 

Im a pretty new to scripting I did some in school but it was provided to us we just went over each step and made a game in unity (barely passed that class I'm horrible at raw scripting lol) let me see if I understand your statement

 

set iLvl to Player.GetLevel iLvl takes on the level of the player so a player lvl 5 = an iLvl of 5

 

set iDmgMlt to iLvl * GlobDmgMult iDmgMlt takes on the value of GlobDmgMult multiplied by iLvl

 

Player.DamageAV Health iDmgMlt Damages player health by the iDmgMlt value

 

What is the value of GlobDmgMult or how do I set it?

Edited by DaemonGrin
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...