Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Lycaon

How to change player's attributes via script

Question

What do I need to do if I have to change some of these properties with scripts that are activated ingame. For example, let's say the player starts with a Player.RunHealth 20 but then through a powerup, he can lower it to Player.RunHealth 5, and then after 30 seconds go back to the original value. Or even change the player speed movement at any given time. Thanks!

Share this post


Link to post

4 answers to this question

Recommended Posts

  • 0
1 hour ago, Lycaon said:

What do I need to do if I have to change some of these properties with scripts that are activated ingame. For example, let's say the player starts with a Player.RunHealth 20 but then through a powerup, he can lower it to Player.RunHealth 5, and then after 30 seconds go back to the original value. Or even change the player speed movement at any given time. Thanks!

 

You kind of already answered your own question. Make a custom powerup with an infinite duration and change the values there.

Share this post


Link to post
  • 0

Ok, but what if i want to activate it via script? How do you change those values in an ACS script? Do i have to use fake powerups to boost stats? still, when you finish a map all powerups are gone in the next one, so that doesn't work if i want to give permanent boost to a stat.

Share this post


Link to post
  • 0
10 hours ago, Lycaon said:

Ok, but what if i want to activate it via script? How do you change those values in an ACS script? Do i have to use fake powerups to boost stats?

 

You just give the player the power up:

 GiveInventory("yourpowerup", 1)

Which you can do via a keybind. Check to see if the player has at least 1 of this item, and if so, AND the player presses the key bind, take that item away. Otherwise, give the item. The only way AFAIK to modify damage factors and other player properties is to use a custom powerup.

 

Quote

still, when you finish a map all powerups are gone in the next one, so that doesn't work if i want to give permanent boost to a stat.

 

That is what the INVENTORY.PERSISTENTPOWER flag is for.

Share this post


Link to post
  • 0
On 10/17/2018 at 9:46 AM, R4L said:

 

Thanks a lot! there's a lot of stuff i don't know yet, i appreciate you sharing your knowledge!

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×