It is currently Sun Oct 12, 2008 4:07 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: how to make different items poisonable...
PostPosted: Fri Feb 17, 2006 7:38 pm 
Offline

Joined: Fri Feb 17, 2006 7:31 pm
Posts: 22
Location: Saint Paul, MN
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!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Feb 18, 2006 12:13 pm 
Offline
User avatar

Joined: Fri Feb 10, 2006 8:08 am
Posts: 327
Location: Myrtle Beach, South Carolina
Helps a lot more to post all the errors you get when you compile. ;)


Top
 Profile  
 
 Post subject: error that I receive when compiling....
PostPosted: Tue Feb 21, 2006 5:22 pm 
Offline

Joined: Fri Feb 17, 2006 7:31 pm
Posts: 22
Location: Saint Paul, MN
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!


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 21, 2006 8:41 pm 
Offline

Joined: Tue Feb 14, 2006 2:06 pm
Posts: 41
Location: Québec, Canada
Your missing attributes.inc that hold that undefined function.
You need to include it.

_________________
Image


Top
 Profile  
 
 Post subject: thank you!
PostPosted: Tue Feb 21, 2006 11:38 pm 
Offline

Joined: Fri Feb 17, 2006 7:31 pm
Posts: 22
Location: Saint Paul, MN
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: phao, Yahoo [Bot] and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl