Page 1 of 1

dmg_mod prop

Posted: Thu Jul 10, 2008 8:21 pm
by Poi
Hio. Again. and again and again, etc...

Ok, so here is my script and my problem..

It seems to get stuck at "You cannot add damage to that" when targeting anything...

This means, it can't find the prop dmg_mod
sooo, I don't know whats wrong because I can go in uo and type .getprop dmg_mod just fine... any ideas?

Code: Select all

use os;
use uo;
use util;

program checks(who, deed)
var maxdmg := 25;
if (!who)
SendSysMessage(who,"Error.");
return;
endif
if(!deed)
SendSysMessage(who,"That deed does not seem to exist.");
return;
endif
SendSysMessage(who,"Please target the weapon.");
var wep := Target( who );
if (!wep)
SendSysMessage(who,"What your selected does not seem to exist.");
return;
endif
var cdmg := GetObjProperty(wep, "dmg_mod");
SendSysMessage(who,cdmg);
//if ((!cdmg))
//SendSysMessage(who,"You cannot add damage to that.");
//return;
//endif
var dmg := RandomInt(7);
if (cdmg > maxdmg)
SetObjProperty(wep, "dmg_mod", maxdmg);
SendSysMessage(who,"Your weapon is already at its limit on damage.");
return;
endif

if (cdmg + dmg > maxdmg)
SetObjProperty(wep, "dmg_mod", maxdmg);
SendSysMessage(who,"Your weapon is now at its limit.");
return;
endif

SetObjProperty(wep, "dmg_mod", cdmg + dmg);
SendSysMessage(who,"Added " + dmg + " damage to your weapon!");


endprogram

Posted: Thu Jul 10, 2008 9:17 pm
by Luth
Instead of using G/SetObjProp(weapon, "dmg_mod") access it directly by:
weapon.dmg_mod := 5;
or
var dmg := weapon.dmg_mod;

Posted: Fri Jul 11, 2008 8:50 pm
by Poi
K, thanks