PenUltima Online Forum Index Official Core: 096.7
Official Core: 097 2008-02-26
Donate towards the POL web hosting bill!
 POL Home   FAQ   Search    Memberlist   Usergroups    Register    Profile   Log in to check your private messages   Log in
how to make different items poisonable...

 
Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095)
Display posts from previous:   

Author Message
mijimoe



Joined: 17 Feb 2006
Posts: 22
Location: Saint Paul, MN

PostPosted: Fri Feb 17, 2006 11:38 pm    Post subject: how to make different items poisonable... Reply with quote

I am endeavoring to allow other items to be able to be poisoned such as arrows, food, etc. Below is the script that I presently have but I cannot compile this (I am not a developer by nature and therefore have to muddle through what some of the errors that come up mean). Any assistance or guidance would be greatly appreciated:

use uo;
use os;
use util;
use cfgfile;

include "include/client";
include "include/canAccess";
include "include/noto";

program do_poisoning(who)
EraseObjProperty(who, "IsMeditating");
EraseObjProperty(who, "HealTimer");
SendSysMessage(who, "Select a poison potion.");
var the_poison := Target(who);
if(!the_poison)
SendSysMessage(who, "cancelled.");
return;
elseif(!can_access(who, the_poison))
SendSysMessage(who, " You cannot use that!");
return;
elseif(the_poison.graphic != 0xf0a)
SendSysMessage(who, "You must select a poison potion!");
return;
endif
SendSysMessage(who, "Select an object to which to apply this poison");
var the_item := Target(who, TGTOPT_CHECK_LOS);
if(!the_item)
SendSysMessage(who, "Targetting cancelled.");
return;
elseif(!can_access(who, the_item))
SendSysMessage(who, "You can't use that!");
return;
endif
var acfgfile := ReadConfigFile(":*:itemdesc");
var theitem := acfgfile[the_item.objtype];
if((theitem.Attribute == "Swords") || (theitem.Attribute == "Fencing") || (theitem.Attribute == "Archery") || (theitem.Attribute == "Mace") || (theitem.Attribute == "Food"))
var stren, skill, point;
case(the_poison.objtype)
0xdc04: stren := 1; skill := 25; point := 50;
0xdc05: stren := 2; skill := 60; point := 80;
0xdc06: stren := 3; skill := 80; point := 110;
0xdc17: stren := 4; skill := 98; point := 160;
endcase
if(SubtractAmount(the_poison, 1))
CreateItemInBackpack(who, 0xf0e, 1);
if(CheckSkill(who, SKILLID_POISONING, skill, point))
PlaySoundEffect(who, 0x248);
SetObjProperty(the_item, "poison_level", stren);
var skillmod := Cint(GetAttribute(who, "poisoning") / 20) + RandomInt(4);
SetObjProperty(the_item, "d", Cint(25 - (stren * 4)) + skillmod);
var hitscripts := GetObjProperty(the_item, "OnHit");
if(!hitscripts)
hitscripts := array;
endif
if(!hitscripts.exists(":combat:poisonHit"))
hitscripts.append(":combat:poisonHit");
SetObjProperty(the_item, "OnHit", hitscripts);
endif
SendSysMessage(who, "You have successfully applied the poison");
var myskill := CInt(GetEffectiveSkill(who, SKILLID_POISONING));
var modpts := 0;
if(myskill >= skill)
modpts := (myskill - skill);
endif
var rint := RandomInt(100);
if(modpts >= rint)
ExceptionalFameMod(who, myskill, skill, point);
endif
else
if(RandomInt(100) > 90)
SendSysMessage(who, "You fail and poison yourself!");
var parms := array(who, who, "poison Skill", stren);
start_script(":spells:poisonDamage", parms);
else
SendSysMessage(who, "You fail to apply the poison properly");
endif
endif
else
SendSysMessage(who, "you cant use that poison.");
return;
endif
else
SendSysMessage(who, "That cannot be poisoned");
return;
endif
endprogram

function ExceptionalFameMod(who, skill, diff, points)
if(skill > diff - 20)
diff := diff + 20;
if((skill - diff) <= 5)
points := points;
elseif((skill - diff) <= 10)
points := (points * 3) / 4;
elseif((skill - diff) <= 15)
points := points / 2;
elseif((skill - diff) <= 20)
points := points / 4;
else
points := 0;
endif
points := Cint(points);
var fame := Cint(GetObjProperty(who, "Fame"));
var famegain := fame + points;
SetObjProperty(who, "Fame", famegain);
var msgtext := "You have ";
if(points < 0)
msgtext := msgtext + "lost ";
points := Abs(points);
else
msgtext := msgtext + "gained ";
endif
if(points > 150)
msgtext := msgtext + "a great amount of ";
elseif(points > 125)
msgtext := msgtext + "alot of ";
elseif(points > 75)
msgtext := msgtext + "a good amount of ";
elseif(points > 30)
msgtext := msgtext + "some ";
elseif(points > 0)
msgtext := msgtext + "a little ";
else
return 0;
endif
msgtext := msgtext + "Fame.";
SendSysMessage(who, msgtext);
var karma := Cint(GetObjProperty(who, "Karma"));
var kmod := GetKarmaLevel(karma);
var fmod := GetFameLevel(famegain);
var newtitle := nototitles[ (kmod) ];
newtitle := "The " + CStr(newtitle[fmod]) + " ";
if(newtitle["None"])
newtitle := "";
endif
if(fmod == 5)
if(who.gender == 1)
newtitle := newtitle + "Lady ";
else
newtitle := newtitle + "Lord ";
endif
endif
if(newtitle != who.title_prefix)
who.title_prefix := newtitle;
SendSysMessage(who, "you are now known as " + newtitle + who.name);
endif
SetNotoTitle(who, karma, fame);
endif
endfunction

I added in the attribute "Food" to the food items I want to poison in case anyone was wondering how this was to be accomplished. When I try to compile this script I get errors all over the place (I am using Pol095 at the present moment with the service packs installed).

Thanks!

Author Message
MontuZ
Distro Developer


Joined: 10 Feb 2006
Posts: 293
Location: Myrtle Beach, South Carolina

PostPosted: Sat Feb 18, 2006 4:13 pm    Post subject: Reply with quote

Helps a lot more to post all the errors you get when you compile. Wink

Author Message
mijimoe



Joined: 17 Feb 2006
Posts: 22
Location: Saint Paul, MN

PostPosted: Tue Feb 21, 2006 9:22 pm    Post subject: error that I receive when compiling.... Reply with quote

Listed below is the exact error that I get when I endeavor to compile the poisonskill.src:

Compiling: d:\pol2\pkg\skills\poisoning\poisonSkill.src
Token '(' cannot follow token 'GetEffectiveSkill'
Function GetEffectiveSkill() is not defined.
Error getting arguments for function CInt
File: d:\pol2\pkg\skills\poisoning\poisonSkill.src, Line 59

Error compiling statement at d:\pol2\pkg\skills\poisoning\poisonSkill.src, Line
59
Error in IF statement starting at File: d:\pol2\pkg\skills\poisoning\poisonSkill
.src, Line 45
Error compiling statement at d:\pol2\pkg\skills\poisoning\poisonSkill.src, Line
45
Error in IF statement starting at File: d:\pol2\pkg\skills\poisoning\poisonSkill
.src, Line 43
Error compiling statement at d:\pol2\pkg\skills\poisoning\poisonSkill.src, Line
43
Error in IF statement starting at File: d:\pol2\pkg\skills\poisoning\poisonSkill
.src, Line 35
Error compiling statement at d:\pol2\pkg\skills\poisoning\poisonSkill.src, Line
35
Error detected in program body.
Error occurred at d:\pol2\pkg\skills\poisoning\poisonSkill.src, Line 59
Execution aborted due to: Error compiling file

D:\pol2\scripts>

Any additional questions, please let me know.

Thanks!

Author Message
Beaud



Joined: 14 Feb 2006
Posts: 41
Location: Québec, Canada

PostPosted: Wed Feb 22, 2006 12:41 am    Post subject: Reply with quote

Your missing attributes.inc that hold that undefined function.
You need to include it.

Author Message
mijimoe



Joined: 17 Feb 2006
Posts: 22
Location: Saint Paul, MN

PostPosted: Wed Feb 22, 2006 3:38 am    Post subject: thank you! Reply with quote

Ah I didn't even see that I was missing that "include" for some reason. Thank you very much for your help. It works great now!

Mijimoe

Post new topic   Reply to topic    PenUltima Online Forum Index -> General Help (095) All times are GMT - 4 Hours
Page 1 of 1

 




Powered by phpBB © 2001, 2005 phpBB Group :: Theme & Graphics by GHS & Scott E. Royalty