View unanswered posts | View active topics
|
Page 1 of 1
|
[ 19 posts ] |
|
| Author |
Message |
|
Damien
|
Post subject: Healing Command Posted: Thu Jun 22, 2006 11:54 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
Yay! Hello!
Of Course it don't feel good to ask for scripts...
but i need someone to help me.
So if you feel like sharing your talent with this script i would be awesome happily.
Or else just do nothing :]
The script im talking about is a command that automaticcly target bandages in your backpack and start to heal yourself.
like typing .heal (command) and you start to heal yourself.
If someone wants to share this script with me please post it here.
Code: Thanks.
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Sat Jun 24, 2006 1:18 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
Hello, this is the farest i can go.
I would appreciate if someone could help me to modify the rest.
Code: use uo;
program healme( who, character, text )
var patient := Target(who); foreach item in EnumerateItemsInContainer(character.backpack) if(item.objtype == 0x0e21) Start_Script(":healing:dohealing", parms); else SendSysMessage(who, "You don't got any bandages in your backpack." ); endif endforeach
endprogram
Thanks.
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sat Jun 24, 2006 2:57 am |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 744 Location: Chicago, IL USA
|
what params are used in the program for :healing:dohealing? I'm assuming
program healing(parms)
var who := parms[1];
var bandage := parms[2];
var patient := parms[3];
A little edit to your code (parms is passed to the script assuming what I said above is true for the program and first few lines)
Code: use uo; use os;
program healme(who) // Read comment 1 below SendSysMessage(who, "Who do you want to heal?"); var patient := Target(who); var check; foreach item in EnumerateItemsInContainer(who.backpack) // Comment 2 if(item.objtype == 0x0e21) var parms := array{who, item, patient}; // Comment 3 Start_Script(":healing:dohealing", parms); check := 1; // Comment 4 break; // Comment 5 endif endforeach if (!check) SendSysMessage(who, "You dont have any bandages in your backpack."); endif endprogram
Comments about your script: (not blasting your script, just showing you why I did some things differently)
1. Was (who, character, item) changed to (who)... Where are these coming from? You werent using them and I dont see how they would be there in the first place so no need to pass 'character' or 'item'.
2. Was character.backpack changed to who.backpack... if 'who' is healing 'patient', then why is 'character''s pack being checked  also removed character.
3. This variable is set assuming what I said above is exactly how your script works. If it doesnt, then please post what it says in your dohealing script.
4. Dont do if (objtype...) else SendSysMessage... Because that will do SendSysMessage... for every item in the pack thats not a bandage. Instead, I declared a variable near the beginning 'check'. It only gets set if the objtype is a bandage (its just below the start_script...). This then gets handled by the IF just after the ENDFOREACH.
5. If you only need to find one bandage and you're done, its very essential to BREAK out of the foreach. This way, after the bandange is found and the script is started, it wont still be checking the possibly 100 or so items still left in the pack it hasnt looked at yet which puts unnecessary strain on the server. It also keeps the script from being started twice if theres more than 1 stack of bandages in the pack.
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Sat Jun 24, 2006 5:11 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
Code: use uo; use os;
program healme(who) // Read comment 1 below SendSysMessage(who, "Who do you want to heal?"); var patient := Target(who); var check; foreach item in EnumerateItemsInContainer(who.backpack) // Comment 2 if(item.objtype == 0x0e21) var parms := array{who, item, patient}; // Comment 3 Start_Script(":healing:use_bandages", parms); check := 1; // Comment 4 break; // Comment 5 endif endforeach if (!check) SendSysMessage(who, "You dont have any bandages in your backpack."); endif endprogram
Thanks i really appreciate your help, but now when i write .healme a Target shows up and i click myself.... fine so far. But then nothing happends because of this : Start_Script(":healing:use_bandages", parms); I changed dohealing to use_bandages but it dont matter because nothing really works.  My problem is to make it start heal. I use the Healing script as you get with the POL095 core package its not modified or anything. How should i make it start heal? I also realized after this "Code" thing been changed on forum i could post the whole healing script :] Very nice change! Code: use uo; use os; use npc; use util; use cfgfile;
include "include/dist"; include "include/client"; include "include/res"; include "include/resPenalty"; include "include/canAccess"; include "include/attributes"; include ":poisonwatcher:poisons";
var clock := ReadGameClock(); var healing; var Anatomy;
program use_bandages(who, item) healing := GetAttribute(who, "healing"); Anatomy := GetAttribute(who, "anatomy"); EraseObjProperty(who, "IsMeditating"); if(!can_access(who, item)) return; endif var Sleeptime; SendSysMessage(who, "who would you like to heal?"); var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS); if(!patient) SendSysMessage(who, "Cancelled."); return; endif var poisons := ListPoisonsByType(patient, "defaultPoisons"); if(dist(who, patient) >= 2) SendSysMessage(who, "Your patient is too far."); return; elseif(!CheckLineOfSight(who,patient)) SendSysMessage(who,"You can't see your patient."); return; elseif((GetHp(patient) >= GetMaxHp(patient)) and (poisons.size() == 0)) SendSysMessage(who,"Your patient is at full heath"); return; endif detach(); SetObjProperty(who, "HealTimer", clock);
// If we're dealing with a person if((patient.graphic == 0x190) or (patient.graphic == 0x191) )
// if the patient is the doctor If(patient == who) if(poisons.size() > 0) SendSysMessage(who,"You start to cure yourself."); if(SubtractAmount(Item , 1)) cure(who, patient, 0); return; endif else SendSysMessage(who,"You start to heal yourself."); if(SubtractAmount(Item , 1)) heal(who, patient, 0); return; endif endif
//if the patient is poisoned elseif(poisons.size() > 0) if(patient.dead) if((healing < 60) or (anatomy < 60)) SendSysMessage(who, "You have no chance of reviving your patient."); else if(SubtractAmount(Item , 1)) resurrect_pc(who, patient, 0); endif endif elseif(dist(who, patient) > 1) SendSysMessage(who, "Your patient is too far."); elseif(!CheckLineOfSight(who, patient)) SendSysMessage(who,"You can't see you patient."); elseif(SubtractAmount(item, 1)) if((healing < 60) or (anatomy < 60)) SendSysMessage(who, "You have no chance of curing your patient's poison."); SendSysMessage(patient, who.name + " has stopped curing you."); else SendSysMessage(who,"You start to cure " + patient.name + "."); SendSysMessage(patient,who.name + " starts to cure you."); cure(who, patient, 0); endif else SendSysMessage(who, "You cannot use those bandages."); endif return; else
// routine heal if(patient.dead) if((healing < 80) or (anatomy < 80)) SendSysMessage(who, "You have no chance of reviving your patient."); else if(SubtractAmount(Item , 1)) resurrect_pc(who, patient, 0); endif endif elseif(dist(who, patient) > 1) SendSysMessage(who, "Your Patient is too far"); elseif(!CheckLineOfSight(who, patient)) SendSysMessage(who,"You cant see you patient"); elseif(SubtractAmount(item, 1)) SendSysMessage(who, "You start to heal " + patient.name); SendSysMessage(patient, who.name + " starts to heal you"); heal(who, patient, 0); else SendSysMessage(who, "You cannot use those bandages."); endif endif return;
//if we're dealing with a dead person elseif(patient.dead) if((healing < 80) or (anatomy < 80)) SendSysMessage(who, "You have no chance of reviving your patient"); elseif(!CheckLineOfSight(who,patient)) SendSysMessage(who,"You can't see your patient anymore."); elseif(dist(who, patient) > 1) SendSysMessage(who, "Your patient is too far."); elseif(SubtractAmount(item, 1)) resurrect_pc(who, patient, 0); else SendSysMessage(who, "You cannot use those bandages."); endif return; // Send the animals to vet. elseif(patient.npctemplate) if(dist(who, patient) >= 2) SendSysMessage(who, "Your patient is too far."); elseif(SubtractAmount(Item, 1)) var parms := array(patient, who); start_script(":veterinary:vet", parms); else SendSysMessage(who, "You cannot use those bandages."); endif else SendSysMessage(who , "You can't heal that." ); endif endprogram
function heal(who, patient, counter) var healamt := Cint(healing / 2) + Cint(anatomy / 5) + 10; // amount to be considered for healing var basehealamt := healamt; var cycles; var count := 0; // Determine how many attempts are made to heal. if(patient == who) var dexcheck := (GetBaseDexterity(who) / 20); cycles := (15 - dexcheck); else if(GetDexterity(who) <= 33) cycles := 5; elseif(GetDexterity(who) <= 67) cycles := 4; else cycles := 3; endif endif // This loop has two functions: // 1- provide wait-states for healing, during which, if it's interrupted, no healing occurs. // 2- test for fumbles during the healing process and lower the amount of healing // All healing occurs in the last pass of the loop. while(counter <= cycles) var chp := GetHP(who); sleep(1); if (counter%4 == 0) SendSysMessage(patient, who.name + " continues to heal you."); endif // break out if anyone does anything that should cause heal to stop. if(!GetObjProperty(who, "HealTimer")) SendSysMessage(who, "You stop healing your patient."); break; elseif(clock != GetObjProperty(who, "HealTimer")) break; elseif(dist(who, patient) > 1) SendSysMessage(who,"Your patient isn't close enough."); SendSysMessage(patient, who.name + "has stopped healing you."); break; elseif(GetHP(patient) >= GetMaxHP(patient)) SendSysMessage(who, "Your patient is at full health."); SendSysMessage(patient, who.name + " has stopped healing you."); break; elseif((patient.dead) and (patient != who)) SendSysMessage(who, "You start to resurrect " + patient.name + "."); SendSysMessage(patient, who.name + " starts to resurrect you."); resurrect_pc(who, patient, counter); break; elseif(ListPoisonsByType(patient, "defaultPoison").size() > 0) // can't heal a patient who is poisoned. if((healing < 60) or (anatomy < 60)) SendSysMessage(who, "You have no chance of curing your patient's poison."); SendSysMessage(patient, who.name + " has stopped curing you."); else SendSysMessage(who,"You start to cure " + patient.name + "."); if(patient != who) SendSysMessage(patient, who.name + " starts to cure you."); endif cure(who, patient, counter); endif break; // Testing to see if things are fumbled. If they fumble too badly, elseif(GetHP(who) < chp) if((RandomInt(basehealamt) + 1) >= GetDexterity(who)) SendSysMessage(who, "Your fingers slip." ); if(count >= 5) healamt := -1; else healamt := (healamt * 0.90); count := count + 1; endif endif // The last cycle of the loop. All actual healing is done here. elseif(counter >= cycles) var diff := 100 - Cint((GetHP(patient) * 100.0) / GetMaxHP(patient)); if((CheckSkill(who, SKILLID_HEALING, diff, 0)) and (healamt != -1)) var chkamt := Cint(GetMaxHP(patient) - GetHP(patient)); if(healamt > chkamt) healamt := chkamt; SendSysMessage(who, "You have healed your patient completely."); SendSysMessage(patient, who.name + " has healed you completely."); else SendSysMessage(who, "You successfully heal " + patient.name); SendSysMessage(patient, who.name + " has healed you."); endif healdamage(patient, healamt); AwardPoints(who, SKILLID_HEALING, (healamt * 2)); break; else // Throw 'em a bone. No chance of gain, though. SendSysMessage(who,"You finish applying the bandages, but they barely help."); SendSysMessage(patient, who.name + " has tried to healed you, but has barely helped."); healdamage(patient, RandomInt(6)); break; endif endif counter := counter + 1; endwhile endfunction
function cure(who, patient, counter) var healamt := Cint(healing / 25) + Cint(anatomy / 50); var cycles; var count := 0; if(patient == who) var dexcheck := (GetBaseDexterity(who) / 33); cycles := (15 - dexcheck); else if(GetBaseDexterity(who) <= 33) cycles := 5; elseif(GetBaseDexterity(who) <= 67) cycles := 4; else cycles := 3; endif endif while(counter <= cycles) var chp := GetHP(who); sleep(1); if(!GetObjProperty(who, "HealTimer")) SendSysMessage(who, "You stop healing your patient."); SendSysMessage(patient, who.name + " has stopped healing you."); break; elseif(clock != GetObjProperty(who, "HealTimer")) break; elseif(dist(who, patient) > 1) SendSysMessage(who, "Your patient isn't close enough."); SendSysMessage(patient, who.name + " has stopped healing you."); break; elseif((patient.dead) and (patient != who)) SendSysMessage(who, "You start to resurrect " + patient.name + "."); SendSysMessage(patient, who.name + " starts to resurrect you."); resurrect_pc(who, patient, counter); break; elseif(ListPoisonsByType(patient, "defaultPoison").size() == 0) SendSysMessage(who,"You start to heal " + patient.name + "."); if(patient != who) SendSysMessage(patient, who.name + " starts to heal you."); endif heal(who, patient, counter); break; elseif(GetHP(who) < chp) if((RandomInt(100)+1) > GetBaseDexterity(who)) SendSysMessage( who, "Your fingers slip." ); healamt := (healamt - 1); count := count + 1; if(count >= 5) healamt := 0; endif endif endif if(counter >= cycles) if(CheckSkill(who, SKILLID_HEALING, 48, 0)) CurePoison(patient, 120, "defaultPoison", healamt); if (ListPoisonsByType(patient, "defaultPoison").size() == 0) SendSysMessage(who,"You have cured your patient completely."); SendSysMessage(patient, who.name + " has cured you completely."); AwardPoints(who, SKILLID_HEALING, (healamt * 100)); else SendSysMessage(who, "You have helped but your patient is still poisoned."); SendSysMessage(patient, who.name + " has tried to cure your poison."); AwardPoints(who, SKILLID_HEALING, (CInt(healamt/2) * 100)); endif break; else SendSysMessage ( who , "You could not heal him." ); endif endif counter := counter + 1; endwhile endfunction
function resurrect_pc(who, patient, counter) var healamt := 90; SendSysMessage(who,"You start to resurrect " + patient.name + "."); SendSysMessage(patient, who.name + " starts to resurrect you."); while(counter <= 10) var chp := GetHP(who); sleep(1); if(!GetObjProperty(who, "HealTimer")) SendSysMessage(who, "You stop reviving your patient."); SendSysMessage(patient, who.name + " has stopped reviving you."); break; elseif(clock != GetObjProperty(who, "HealTimer")) break; elseif(dist(who, patient) > 1) SendSysMessage(who,"Your patient isn't close enough."); SendSysMessage(patient, who.name + "has stopped healing you."); break; elseif(GetHP(who) < chp) if((RandomInt(100)+1) > GetBaseDexterity(who)) SendSysMessage(who, "Your fingers slip."); healamt := healamt + 5; endif elseif(!patient.dead) SendSysMessage(who, "You start to heal " + patient.name + "."); if(who != patient) SendSysMessage(patient, who.name + " starts to heal you."); endif heal(who, patient, counter); break; endif if(counter >= 10) if(CheckSkill(who, SKILLID_HEALING, healamt, 0)) AwardPoints(who, SKILLID_HEALING, 400); if(do_res(who, patient)) SendSysMessage(who, "You have resurrected " + patient.name + "."); else SendSysMessage(who, "The patient refused resurrection." ); endif else SendSysMessage(who, "You could not resurrect him."); endif break; endif counter := counter + 1; endwhile endfunction
function do_res(who, mobile) if(GetObjProperty(mobile, "#ResMenu")) return 0; else SetObjProperty(mobile, "#ResMenu", 1); if(ResNow(mobile) == 1) Resurrect(mobile); ResPenalties(mobile); EraseObjProperty(mobile, "#ResMenu"); return 1; else EraseObjProperty(mobile, "#ResMenu"); return 0; endif endif endfunction
Hehe just wanted to use the new code thing  ;)
Appreciate your help, Thanks.
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sat Jun 24, 2006 6:04 am |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 744 Location: Chicago, IL USA
|
a couple very minor changes to your script and now it should work saying this healing script actually does work.
my changes:
program use_bandages(who, item)
if (!item)
item := who[2];
patient := who[3];
who := who[1];
endif
checks to see if item exists (its impossible to pass "item" on start_script, thats why you passed "parms" as an array. Now "who" is that array in this script and "item" is nothing.) if the item doesnt exist, it assumes that who is an array to be broken up into the 3 parts that I used in Start_Script.
if(!patient)
SendSysMessage(who, "who would you like to heal?");
var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS);
endif
I added an if to check if you already had a patient and skipped the second targeting if you did.
Code: use uo; use os; use npc; use util; use cfgfile;
include "include/dist"; include "include/client"; include "include/res"; include "include/resPenalty"; include "include/canAccess"; include "include/attributes"; include ":poisonwatcher:poisons";
var clock := ReadGameClock(); var healing; var Anatomy;
program use_bandages(who, item) if (!item) item := who[2]; patient := who[3]; who := who[1]; endif healing := GetAttribute(who, "healing"); Anatomy := GetAttribute(who, "anatomy"); EraseObjProperty(who, "IsMeditating"); if(!can_access(who, item)) return; endif var Sleeptime; if (!patient) SendSysMessage(who, "who would you like to heal?"); var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS); endif if(!patient) SendSysMessage(who, "Cancelled."); return; endif var poisons := ListPoisonsByType(patient, "defaultPoisons"); if(dist(who, patient) >= 2) SendSysMessage(who, "Your patient is too far."); return; elseif(!CheckLineOfSight(who,patient)) SendSysMessage(who,"You can't see your patient."); return; elseif((GetHp(patient) >= GetMaxHp(patient)) and (poisons.size() == 0)) SendSysMessage(who,"Your patient is at full heath"); return; endif detach(); SetObjProperty(who, "HealTimer", clock);
// If we're dealing with a person if((patient.graphic == 0x190) or (patient.graphic == 0x191) )
// if the patient is the doctor If(patient == who) if(poisons.size() > 0) SendSysMessage(who,"You start to cure yourself."); if(SubtractAmount(Item , 1)) cure(who, patient, 0); return; endif else SendSysMessage(who,"You start to heal yourself."); if(SubtractAmount(Item , 1)) heal(who, patient, 0); return; endif endif
//if the patient is poisoned elseif(poisons.size() > 0) if(patient.dead) if((healing < 60) or (anatomy < 60)) SendSysMessage(who, "You have no chance of reviving your patient."); else if(SubtractAmount(Item , 1)) resurrect_pc(who, patient, 0); endif endif elseif(dist(who, patient) > 1) SendSysMessage(who, "Your patient is too far."); elseif(!CheckLineOfSight(who, patient)) SendSysMessage(who,"You can't see you patient."); elseif(SubtractAmount(item, 1)) if((healing < 60) or (anatomy < 60)) SendSysMessage(who, "You have no chance of curing your patient's poison."); SendSysMessage(patient, who.name + " has stopped curing you."); else SendSysMessage(who,"You start to cure " + patient.name + "."); SendSysMessage(patient,who.name + " starts to cure you."); cure(who, patient, 0); endif else SendSysMessage(who, "You cannot use those bandages."); endif return; else
// routine heal if(patient.dead) if((healing < 80) or (anatomy < 80)) SendSysMessage(who, "You have no chance of reviving your patient."); else if(SubtractAmount(Item , 1)) resurrect_pc(who, patient, 0); endif endif elseif(dist(who, patient) > 1) SendSysMessage(who, "Your Patient is too far"); elseif(!CheckLineOfSight(who, patient)) SendSysMessage(who,"You cant see you patient"); elseif(SubtractAmount(item, 1)) SendSysMessage(who, "You start to heal " + patient.name); SendSysMessage(patient, who.name + " starts to heal you"); heal(who, patient, 0); else SendSysMessage(who, "You cannot use those bandages."); endif endif return;
//if we're dealing with a dead person elseif(patient.dead) if((healing < 80) or (anatomy < 80)) SendSysMessage(who, "You have no chance of reviving your patient"); elseif(!CheckLineOfSight(who,patient)) SendSysMessage(who,"You can't see your patient anymore."); elseif(dist(who, patient) > 1) SendSysMessage(who, "Your patient is too far."); elseif(SubtractAmount(item, 1)) resurrect_pc(who, patient, 0); else SendSysMessage(who, "You cannot use those bandages."); endif return; // Send the animals to vet. elseif(patient.npctemplate) if(dist(who, patient) >= 2) SendSysMessage(who, "Your patient is too far."); elseif(SubtractAmount(Item, 1)) var parms := array(patient, who); start_script(":veterinary:vet", parms); else SendSysMessage(who, "You cannot use those bandages."); endif else SendSysMessage(who , "You can't heal that." ); endif endprogram
function heal(who, patient, counter) var healamt := Cint(healing / 2) + Cint(anatomy / 5) + 10; // amount to be considered for healing var basehealamt := healamt; var cycles; var count := 0; // Determine how many attempts are made to heal. if(patient == who) var dexcheck := (GetBaseDexterity(who) / 20); cycles := (15 - dexcheck); else if(GetDexterity(who) <= 33) cycles := 5; elseif(GetDexterity(who) <= 67) cycles := 4; else cycles := 3; endif endif // This loop has two functions: // 1- provide wait-states for healing, during which, if it's interrupted, no healing occurs. // 2- test for fumbles during the healing process and lower the amount of healing // All healing occurs in the last pass of the loop. while(counter <= cycles) var chp := GetHP(who); sleep(1); if (counter%4 == 0) SendSysMessage(patient, who.name + " continues to heal you."); endif // break out if anyone does anything that should cause heal to stop. if(!GetObjProperty(who, "HealTimer")) SendSysMessage(who, "You stop healing your patient."); break; elseif(clock != GetObjProperty(who, "HealTimer")) break; elseif(dist(who, patient) > 1) SendSysMessage(who,"Your patient isn't close enough."); SendSysMessage(patient, who.name + "has stopped healing you."); break; elseif(GetHP(patient) >= GetMaxHP(patient)) SendSysMessage(who, "Your patient is at full health."); SendSysMessage(patient, who.name + " has stopped healing you."); break; elseif((patient.dead) and (patient != who)) SendSysMessage(who, "You start to resurrect " + patient.name + "."); SendSysMessage(patient, who.name + " starts to resurrect you."); resurrect_pc(who, patient, counter); break; elseif(ListPoisonsByType(patient, "defaultPoison").size() > 0) // can't heal a patient who is poisoned. if((healing < 60) or (anatomy < 60)) SendSysMessage(who, "You have no chance of curing your patient's poison."); SendSysMessage(patient, who.name + " has stopped curing you."); else SendSysMessage(who,"You start to cure " + patient.name + "."); if(patient != who) SendSysMessage(patient, who.name + " starts to cure you."); endif cure(who, patient, counter); endif break; // Testing to see if things are fumbled. If they fumble too badly, elseif(GetHP(who) < chp) if((RandomInt(basehealamt) + 1) >= GetDexterity(who)) SendSysMessage(who, "Your fingers slip." ); if(count >= 5) healamt := -1; else healamt := (healamt * 0.90); count := count + 1; endif endif // The last cycle of the loop. All actual healing is done here. elseif(counter >= cycles) var diff := 100 - Cint((GetHP(patient) * 100.0) / GetMaxHP(patient)); if((CheckSkill(who, SKILLID_HEALING, diff, 0)) and (healamt != -1)) var chkamt := Cint(GetMaxHP(patient) - GetHP(patient)); if(healamt > chkamt) healamt := chkamt; SendSysMessage(who, "You have healed your patient completely."); SendSysMessage(patient, who.name + " has healed you completely."); else SendSysMessage(who, "You successfully heal " + patient.name); SendSysMessage(patient, who.name + " has healed you."); endif healdamage(patient, healamt); AwardPoints(who, SKILLID_HEALING, (healamt * 2)); break; else // Throw 'em a bone. No chance of gain, though. SendSysMessage(who,"You finish applying the bandages, but they barely help."); SendSysMessage(patient, who.name + " has tried to healed you, but has barely helped."); healdamage(patient, RandomInt(6)); break; endif endif counter := counter + 1; endwhile endfunction
function cure(who, patient, counter) var healamt := Cint(healing / 25) + Cint(anatomy / 50); var cycles; var count := 0; if(patient == who) var dexcheck := (GetBaseDexterity(who) / 33); cycles := (15 - dexcheck); else if(GetBaseDexterity(who) <= 33) cycles := 5; elseif(GetBaseDexterity(who) <= 67) cycles := 4; else cycles := 3; endif endif while(counter <= cycles) var chp := GetHP(who); sleep(1); if(!GetObjProperty(who, "HealTimer")) SendSysMessage(who, "You stop healing your patient."); SendSysMessage(patient, who.name + " has stopped healing you."); break; elseif(clock != GetObjProperty(who, "HealTimer")) break; elseif(dist(who, patient) > 1) SendSysMessage(who, "Your patient isn't close enough."); SendSysMessage(patient, who.name + " has stopped healing you."); break; elseif((patient.dead) and (patient != who)) SendSysMessage(who, "You start to resurrect " + patient.name + "."); SendSysMessage(patient, who.name + " starts to resurrect you."); resurrect_pc(who, patient, counter); break; elseif(ListPoisonsByType(patient, "defaultPoison").size() == 0) SendSysMessage(who,"You start to heal " + patient.name + "."); if(patient != who) SendSysMessage(patient, who.name + " starts to heal you."); endif heal(who, patient, counter); break; elseif(GetHP(who) < chp) if((RandomInt(100)+1) > GetBaseDexterity(who)) SendSysMessage( who, "Your fingers slip." ); healamt := (healamt - 1); count := count + 1; if(count >= 5) healamt := 0; endif endif endif if(counter >= cycles) if(CheckSkill(who, SKILLID_HEALING, 48, 0)) CurePoison(patient, 120, "defaultPoison", healamt); if (ListPoisonsByType(patient, "defaultPoison").size() == 0) SendSysMessage(who,"You have cured your patient completely."); SendSysMessage(patient, who.name + " has cured you completely."); AwardPoints(who, SKILLID_HEALING, (healamt * 100)); else SendSysMessage(who, "You have helped but your patient is still poisoned."); SendSysMessage(patient, who.name + " has tried to cure your poison."); AwardPoints(who, SKILLID_HEALING, (CInt(healamt/2) * 100)); endif break; else SendSysMessage ( who , "You could not heal him." ); endif endif counter := counter + 1; endwhile endfunction
function resurrect_pc(who, patient, counter) var healamt := 90; SendSysMessage(who,"You start to resurrect " + patient.name + "."); SendSysMessage(patient, who.name + " starts to resurrect you."); while(counter <= 10) var chp := GetHP(who); sleep(1); if(!GetObjProperty(who, "HealTimer")) SendSysMessage(who, "You stop reviving your patient."); SendSysMessage(patient, who.name + " has stopped reviving you."); break; elseif(clock != GetObjProperty(who, "HealTimer")) break; elseif(dist(who, patient) > 1) SendSysMessage(who,"Your patient isn't close enough."); SendSysMessage(patient, who.name + "has stopped healing you."); break; elseif(GetHP(who) < chp) if((RandomInt(100)+1) > GetBaseDexterity(who)) SendSysMessage(who, "Your fingers slip."); healamt := healamt + 5; endif elseif(!patient.dead) SendSysMessage(who, "You start to heal " + patient.name + "."); if(who != patient) SendSysMessage(patient, who.name + " starts to heal you."); endif heal(who, patient, counter); break; endif if(counter >= 10) if(CheckSkill(who, SKILLID_HEALING, healamt, 0)) AwardPoints(who, SKILLID_HEALING, 400); if(do_res(who, patient)) SendSysMessage(who, "You have resurrected " + patient.name + "."); else SendSysMessage(who, "The patient refused resurrection." ); endif else SendSysMessage(who, "You could not resurrect him."); endif break; endif counter := counter + 1; endwhile endfunction
function do_res(who, mobile) if(GetObjProperty(mobile, "#ResMenu")) return 0; else SetObjProperty(mobile, "#ResMenu", 1); if(ResNow(mobile) == 1) Resurrect(mobile); ResPenalties(mobile); EraseObjProperty(mobile, "#ResMenu"); return 1; else EraseObjProperty(mobile, "#ResMenu"); return 0; endif endif endfunction
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Sat Jun 24, 2006 6:37 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
Hello! Your my hero of the week.
But i do get an Error on line 20 and 20
program use_bandages(who, item)
if (!item) <-- Line 20
item := who[2];
patient := who[3]; <-- Line 22
who := who[1];
endif
And the Error looks like this:
Code: Compiling: I:/Program/Robin/Pol/pkg/skills/healing/healing.src Variable patient has not been declared on line 22. Error compiling statement at I:\Program\Robin\Pol\pkg\skills\healing\healing.src , Line 22 Error in IF statement starting at File: I:\Program\Robin\Pol\pkg\skills\healing\ healing.src, Line 20 Error compiling statement at I:\Program\Robin\Pol\pkg\skills\healing\healing.src , Line 20 Error detected in program body. Error occurred at I:\Program\Robin\Pol\pkg\skills\healing\healing.src, Line 22 Execution aborted due to: Error compiling file
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sat Jun 24, 2006 10:58 pm |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 744 Location: Chicago, IL USA
|
|
ugh missed one thing. Put - var patient; - on the line just after the program so it looks like this...
program use_bandages(who, item)
var patient;
if (!item)
item := who[2];
patient := who[3];
who := who[1];
endif
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Sun Jun 25, 2006 1:32 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
Hello and Thanks.
Everything ecompile succesfully but still same problem :O
When i type the command and click myself nothing happens.
Ima post the Codes one more time.
Code: use uo; use os;
program healme(who) // Read comment 1 below
SendSysMessage(who, "Who do you want to heal?"); var patient := Target(who); var check; foreach item in EnumerateItemsInContainer(who.backpack) // Comment 2 if(item.objtype == 0x0e21) var parms := array{who, item, patient}; // Comment 3 Start_Script(":healing:use_bandages", parms); check := 1; // Comment 4 break; // Comment 5 endif endforeach if (!check) SendSysMessage(who, "You dont have any bandages in your backpack."); endif endprogram
and then the top of the healing script. Code: use uo; use os; use npc; use util; use cfgfile;
include "include/dist"; include "include/client"; include "include/res"; include "include/resPenalty"; include "include/canAccess"; include "include/attributes"; include ":poisonwatcher:poisons";
var clock := ReadGameClock(); var healing; var Anatomy;
program use_bandages(who, item) var patient; if (!item) item := who[2]; patient := who[3]; who := who[1]; endif healing := GetAttribute(who, "healing"); Anatomy := GetAttribute(who, "anatomy"); EraseObjProperty(who, "IsMeditating"); if(!can_access(who, item)) return; endif var Sleeptime; if (!patient) SendSysMessage(who, "who would you like to heal?"); var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS); endif if(!patient) SendSysMessage(who, "Cancelled."); return; endif var poisons := ListPoisonsByType(patient, "defaultPoisons"); if(dist(who, patient) >= 2) SendSysMessage(who, "Your patient is too far."); return; elseif(!CheckLineOfSight(who,patient)) SendSysMessage(who,"You can't see your patient."); return; elseif((GetHp(patient) >= GetMaxHp(patient)) and (poisons.size() == 0)) SendSysMessage(who,"Your patient is at full heath"); return; endif detach(); SetObjProperty(who, "HealTimer", clock);
// If we're dealing with a person if((patient.graphic == 0x190) or (patient.graphic == 0x191) )
// if the patient is the doctor If(patient == who) if(poisons.size() > 0) SendSysMessage(who,"You start to cure yourself."); if(SubtractAmount(Item , 1)) cure(who, patient, 0); return; endif else SendSysMessage(who,"You start to heal yourself."); if(SubtractAmount(Item , 1)) heal(who, patient, 0); return; endif endif
I really appreciate your helpness  Thanks.
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sun Jun 25, 2006 2:07 am |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 744 Location: Chicago, IL USA
|
|
Are you the GM graphic (the human with the GM robe) or are you just a regular human graphic? It could possibly be that... just suspecting because this line
// If we're dealing with a person
if((patient.graphic == 0x190) or (patient.graphic == 0x191) )
wont be true if you're the GM graphic.
if((patient.graphic == 0x190) or (patient.graphic == 0x191) or (patient.graphic == 0x3DB) )
that would fix it if you were a GM graphic.
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Sun Jun 25, 2006 2:46 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
Ive tried the command as a Player and as player with GM graphic.
So i think its something else 
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sun Jun 25, 2006 5:04 am |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 744 Location: Chicago, IL USA
|
|
You get no messages or anything?
First, try doing this in the command script:
Start_Script(":healing:use_bandages", parms);
change that to
var script := Start_Script(":healing:use_bandages", parms);
SendSysMessage(who, CStr(script));
if that doesnt give you any info (basically if this returns Error..... this is where the problem lies) , you can return it back to what it was before and go on...
next, try adding a SendSysMessage near the beginning of the use_bandages script...
program use_bandages(who, item)
var patient;
if (!item)
item := who[2];
patient := who[3];
who := who[1];
endif
SendSysMessage(who, who.name + " is healing " + patient.name + " using " + item.name);
this should give a message like
"Damien is healing CWO with bandage"
if it gives you <uninitialized object> anywhere in that sentence (which I dont see how it will since the refs seem fine) then somehow the variable isnt being passed correctly and we need to look at that a bit. Do these and see what you can find then report back what it says.
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Sun Jun 25, 2006 5:32 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
This is extremely wierd:D
Still happens nothing i tried both ways you explained to me.
But when i ecompile they dont give error or anything but
still same thing, you dont start to heal.
Ive tried to heal myself and i tried to heal another player.
but nooothing
Also this message:
SendSysMessage(who, who.name + " is healing " + patient.name + " using " + item.name);
Never shows up.
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Sun Jun 25, 2006 4:53 pm |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 744 Location: Chicago, IL USA
|
|
Somehow the script isnt running... did you still put in the
var script := Start_Script(":healing:use_bandages", parms);
SendSysMessage(who, CStr(script));
what did that tell you exactly?
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Mon Jun 26, 2006 1:38 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
Hello, now i notice a text appear on the screen
Which is happy news :]
When i ecompile i get no warning no errors, but when i click .healme and click myself ingame [With Gm form and with Player form] i get same Error:
error errortext = "Script pkg/skills/healing/use_bandages.ecl does not exist."
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Mon Jun 26, 2006 6:30 am |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 744 Location: Chicago, IL USA
|
|
well now we're getting somewhere. Now look carefully at exactly where POL is looking. The file name and path explained in the error should be the exact place and name your use_bandages script should be.
Just kinda wondering... do you think the script in Start_script is ":script's name:Program or function name" ? If so, this is whats wrong. The text should go ":package name:script name". The package name comes from whatever name is defined in the pkg.cfg of that folder.
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Tue Jun 27, 2006 12:15 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
Yeah Thanks.
What i did was that i copied Healing.src and renamed the copied one to use_bandages and now it works :]
BUT when i heal myself i get this thing standing:
<appobj:ScriptExRef>
Damien is healing Damien using <--- and here it ends but i can fix that myself.
But my question is: Whats this: <appobj:ScriptExRef> :O and how can i do so its not showing everytime i heal myself? :O
And was it right to copy Healing.src and rename it to use_bandages or is it an easier way?
But im just Glad if this: <appobj:ScriptExRef> dissapears
Thanks i reallllly appreciate it.
|
|
| Top |
|
 |
|
OldnGrey
|
Post subject: Posted: Tue Jun 27, 2006 12:22 am |
|
Joined: Sat Feb 04, 2006 6:26 pm Posts: 539
|
|
Look above where is says:
SendSysMessage(who, who.name + " is healing " ...............
There will be another SendSysMessage line before that somewhere. That is trying to print a reference which it can't print.
|
|
| Top |
|
 |
|
Damien
|
Post subject: Posted: Tue Jun 27, 2006 12:31 am |
|
Joined: Sat Apr 15, 2006 11:50 am Posts: 66
|
I just discovered something new :O
If i click Esc while selecting a target i get this error:
<appobj:ScriptExRef>
Damien is healing error errortext =
"Object does not support members" using
who would you like to heal?
Cancelled.
Soo look here:
Code: program use_bandages(who, item) var patient; if (!item) item := who[2]; patient := who[3]; who := who[1]; endif SendSysMessage(who, who.name + " is healing " + patient.name + " using bandages" ); healing := GetAttribute(who, "healing"); Anatomy := GetAttribute(who, "anatomy"); EraseObjProperty(who, "IsMeditating"); if(!can_access(who, item)) return; endif var Sleeptime; if (!patient) SendSysMessage(who, "who would you like to heal?"); var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS); endif if(!patient) SendSysMessage(who, "Cancelled."); return; endif var poisons := ListPoisonsByType(patient, "defaultPoisons"); if(dist(who, patient) >= 2) SendSysMessage(who, "Your patient is too far."); return; elseif(!CheckLineOfSight(who,patient)) SendSysMessage(who,"You can't see your patient."); return; elseif((GetHp(patient) >= GetMaxHp(patient)) and (poisons.size() == 0)) SendSysMessage(who,"Your patient is at full heath"); return; endif detach(); SetObjProperty(who, "HealTimer", clock);
I think this part is fucking with me: Code: if (!patient) SendSysMessage(who, "who would you like to heal?"); var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS); endif if(!patient) SendSysMessage(who, "Cancelled."); return; endif var poisons := ListPoisonsByType(patient, "defaultPoisons"); if(dist(who, patient) >= 2) SendSysMessage(who, "Your patient is too far."); return; elseif(!CheckLineOfSight(who,patient)) SendSysMessage(who,"You can't see your patient."); return; elseif((GetHp(patient) >= GetMaxHp(patient)) and (poisons.size() == 0)) SendSysMessage(who,"Your patient is at full heath"); return; endif detach(); SetObjProperty(who, "HealTimer", clock);
:]
|
|
| Top |
|
 |
|
CWO
|
Post subject: Posted: Tue Jun 27, 2006 5:34 am |
|
Joined: Sat Feb 04, 2006 5:49 pm Posts: 744 Location: Chicago, IL USA
|
Yes the error is that you dont target anyone.
The <appobj:ScriptExRef> is fine. That means your Start_script is running now without errors. With that working, you can change
var script := Start_Script(":healing:use_bandages", parms);
SendSysMessage(who, CStr(script));
to just
Start_Script(":healing:use_bandages", parms);
To fix the error Object doesnt support members, in the command script, put
Code: program healme(who)
SendSysMessage(who, "Who do you want to heal?"); var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS); if (!patient) SendSysMessage(who, "Cancelled"); return; endif I also added to the Target command TGTOPT_HELPFUL + TGTOPT_CHECK_LOS because its true you should be able to check LOS and it should be flagged as something helpful so healing a grey and red are criminal actions... unless you dont want these, then you can adjust to the appropriate. As for Code: if (!patient) SendSysMessage(who, "who would you like to heal?"); var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS); endif if(!patient) SendSysMessage(who, "Cancelled."); return; endif
If this script isnt used for anything else but your command, you can remove
if (!patient)
SendSysMessage(who, "who would you like to heal?");
var patient := Target(who, TGTOPT_HELPFUL + TGTOPT_CHECK_LOS);
endif
but if this is still used by double clicking bandages and stuff, leave it there. What that says is, if it doesnt have a patient (if you got here some other way then the command, you probably dont have it yet) then give you a target. If you still dont have a patient afterwards, cancel. If its only for the command, the corrections to the command script I suggested in this post will handle the targeting.
|
|
| Top |
|
 |
|
Page 1 of 1
|
[ 19 posts ] |
|
Who is online |
Users browsing this forum: No registered users 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
|
|