ID:607024
 
Code:
obj
Battle
density = TRUE
icon = 'Techs_Ki_Blasts.dmi'
var
delay = 1
length = 15
damage_divider = 100
damage = 100
dominant = 0
splash_radius = 0
splash_damage = 0
daze = 0
mob
owner
Blast
New(location, mob/shooter)
if(!ismob(shooter)) return
src.damage = round(shooter.kipower * src.damage_divider)
src.dir = shooter.dir
if(!src.loc) src.loc = shooter.loc
src.owner = shooter
spawn(1300) del(src)

Energy_Blast
icon_state = "Energy Blast"
delay = 1
splash_radius = 0
daze = 0
length = 8
damage_divider = 300

mob
proc
EnergyBlast()
for(var/obj/Battle/Blast/Energy_Blast/c)
c.damage_divider=1000


Problem description:

I am trying to edit damage divider for energy blast once usr click on an icon in tech tree the proc EnergyBlast() activate. But it wont edit it and can please someone can help me out with it.
Use the object's Click() proc (At least that's what is sounds like you're trying to accomplish?..)

obj/Test_OBJ
Click(mob/M)
M.EnergyBlast()

mob/proc
EnergyBlast()
..()
No i want to change damage divider once proc is activated. But somehow damage_divider is still 300
Where is the /obj/Battle/Blast/Energy_Blast? I assume you only want to change the Energy_Blast's damage_divider for the player who "researched" it in the tech tree. Do you store each player's techniques in a list somewhere?

If you put some debug output (such as world<<"Triggered damage_divider change!") in that for() loop, is it getting triggered?
Yea thats what I wanted to to. Once player learns tehnique he have it in stats in src.techniques
Sry for dubble post. I also tried to do
for(var/obj/Technique/Ki_Attacks/Energy_Blast/T in src.techniques)

but still aint working + undefined var since only obj is defined

Oh, okay. I think I understand now.

/obj/Battle/Blast/Energy_Blast is a projectile that you create when the player uses their "Energy Blast" technique. You can research an improved version in the tech tree to increase the damage [multiplier] of each Energy_Blast projectile you fire.

However, you can't change the initial value of a type's variable itself--you have to change the value of an existing instance of that type. If you want the damage_divider to be dependent on the mob firing it, you'll need a variable on the mob that controls that. Then you can reference it in your projectile's New() just like you do with shooter.kipower.
Ok so how am i suppose to change length of this projectile since value cannot be changed ?
You have to add some sort of logic to your New() process to alter the values. You can't change the variable's initial (aka default) value at runtime.

I'm trying to think of a general-purpose approach for handling something like this, but I'm not sure how to explain it. Basically, what I'm thinking is you could give each player a list of "modifiers" (which would be datums). Each modifier would reference a type path, a variable name, and the new value for that variable. Then in the New() process of any type you want to be modifiable, you would run a process to check if the player has any modifiers for the current type, and apply them if so.

Maybe I'll throw together a library for it..
And what if im just using verbs for it :
var/damage = src.owner.kipower*2 + rand(550,850) - A:defense + src.owner.kiboost // kiboost changed from damage_divider

src.owner is shooter
and i do same for length. But the problem is if im going to have like 10 attacks that means 20 verbs just for attacks.
That will work, but like you noted, it can get out of hand quickly. (I assume you mean "vars" instead of "verbs"?)
In response to LaNuiit
Stay away from the colon.