Jump to content

Help with ability modding?


Krazyguy75

Recommended Posts

Well, I'm probably just going to borrow that code, looking on it, but how do I get it to give a random buff (like how mindspin gives 1 of 3 results)?

 

For reference, the results I want are +10 aim, +20 defense, +3 mobility, +20 crit chance, +5 health healed, or a 3 bar shield. Most, if not all of those are simple eStat changes, and I can make his code fit all of them individually, but I don't know how to make it randomly choose 1.

 

Less importantly, I'm not sure how to make it heal without being able to go above max health, but first thing is first.

 

EDIT: Also, don't feel the need to apologize for trying to help me :) You two have been great help, whether in understanding how the code works or figuring out my ability.

Edited by Krazyguy75
Link to comment
Share on other sites

Well, I'm probably just going to borrow that code, looking on it, but how do I get it to give a random buff (like how mindspin gives 1 of 3 results)?

 

For reference, the results I want are +10 aim, +20 defense, +3 mobility, +20 crit chance, +5 health healed, or a 3 bar shield. Most, if not all of those are simple eStat changes, and I can make his code fit all of them individually, but I don't know how to make it randomly choose 1.

 

Less importantly, I'm not sure how to make it heal without being able to go above max health, but first thing is first.

 

EDIT: Also, don't feel the need to apologize for trying to help me :smile: You two have been great help, whether in understanding how the code works or figuring out my ability.

If you look at the X2Effect_Regeneration script, there's actually a line (with a comment!) in there showing how the regen effect doesn't go over max health. I think the XComGameState_Unit won't allow it to begin with, so you try to apply the heal and then check the actual value afterwards if you want to see how much it actually healed.

 

As for random ability choice, that I do not know.

Edited by Lucubration
Link to comment
Share on other sites

for random ability choice, there is probably a built in rng function that you could use to roll, then just use a switch/if clause to pick what you want to use. I'd suggest looking into either unrealscript code or take a look at the weapon damage and how its applied for making it roll, or the dodge/armor chance codes as well.

 

edit: in fact, I would look for the code that grabs the next seed value and just call that ... since thats what its there for.

Edited by traenol
Link to comment
Share on other sites

for random ability choice, there is probably a built in rng function that you could use to roll, then just use a switch/if clause to pick what you want to use. [...]

 

Another very convenient way to solve this is to use an array<> and access it by a randomly rolled index. When your list starts to grow, you realy appreciate not having to deal with several hundred lines of switch-case. ;-)

Link to comment
Share on other sites

I think what eXecator was suggesting was to pick the random effect out of an array built in code, but you could probably pull the array out of an .ini file as well if you wanted to get fancy. Here's roughly how you'd do it in code:

var array<X2Effect> Effects;
var X2Effect RandomEffect;
var int Index;

// Add possible effects into an array
Effects.AddItem(new class'X2Effect_1');
Effects.AddItem(new class'X2Effect_2');
// and so on...

// Should produce a number 0 through Effects.Length-1
Index = `SYNC_RAND(Effects.Length);

// Pick the random effect out of the array
RandomEffect = Effects[Index];

That should get you part of the way. Now to figure out where to actually perform that. It seems to me like you'd want to make a new effect to apply to the target, and it its OnEffectAdded method it would select a random buff to also apply to the affected unit.

Edited by Lucubration
Link to comment
Share on other sites

Well, I suck at unrealscript. I'm gonna put this project on the side burner until I have more experience. I'm not sure what class to extend to put that kind of effect in, as I want both the regeneration effect and the persistantstatchange effect to be options, and I'm really not experienced in how unrealscript actually works.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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