Scripting Resources & Utilities > Stealth Snippets\Library
[Pascal Example] dxrom's stealth subs
dxrom:
I'm going to start updating this thread with various subs that I utilize with stealth, hopefully other people find uses for them as well.
Skill training sub:
--- Code: ---Program SkillTrainingSub;
VAR
SKILLTIMER : Cardinal;
procedure Skill(Name:String; Level:Double; Delay:Integer; Target:Cardinal);
begin
if( GetSkillValue(Name) <= Level ) AND ( GetTickCount>SKILLTIMER ) then
begin
if( Target=0 ) then
begin
UseSkill(Name);
SKILLTIMER:=GetTickCount()+(Delay*1000);
end
else begin
CancelTarget();
UseSkill(Name);
if( WaitForTarget(1000) ) then
begin
TargetToObject(Target);
SKILLTIMER:=GetTickCount()+(Delay*1000);
end;
end;
end;
Wait(125);
end;
--- End code ---
Example of Skill training sub:
--- Code: ---Skill('Tracking',100,12,0);
Skill('Detect Hidden',100,12,Self);
--- End code ---
dxrom:
My default Init sub:
--- Code: --- Program Init;
VAR
SelfID : Cardinal;
SelfIDStr : String;
Procedure Init;
begin
SelfIDStr := '$' + (IntToHex(Self,8));
SelfID := StrToInt(SelfIDStr);
end;
--- End code ---
Checking Special Abilities sub:
--- Code: ---Program CheckSpecials;
//Requires default init.
procedure CheckSpecial(Wep:Cardinal; Ability:String; Special:String; Hands:Integer);
begin
if( Hands = 1 ) then
begin
if( GetType(ObjAtLayer(RHandLayer())) = Wep ) then
begin
if( (GetActiveAbility<> Ability) AND (GetMana(SELFID)>10) ) then
begin
if( Special = 'Primary' ) then
begin
UsePrimaryAbility;
end;
if( Special = 'Secondary' ) then
begin
UseSecondaryAbility;
end;
ClientPrint(GetActiveAbility);
wait(175);
end;
end;
end;
if( Hands = 2 ) then
begin
if( GetType(ObjAtLayer(LHandLayer())) = Wep ) then
begin
if( (GetActiveAbility<> Ability) AND (GetMana(SELFID)>10) ) then
begin
if( Special = 'Primary' ) then
begin
UsePrimaryAbility;
end;
if( Special = 'Secondary' ) then
begin
UseSecondaryAbility;
end;
ClientPrint(GetActiveAbility);
wait(175);
end;
end;
end;
end;
--- End code ---
Example of how to use the sub to check special abilities:
--- Code: ---CheckSpecial($26C2,'Armor Ignore','Primary',2);
--- End code ---
You'll need to figure out the TYPE of the weapon.
dxrom:
Spell Casting Sub:
--- Code: ---Program SpellCasting;
VAR
Fizzle : Boolean;
CastTimer : Cardinal;
procedure CastSpell(Name:String; CastTime: Integer; Target:Cardinal);
var
i:Integer;
timer:TDateTime;
begin
if( Target=0 ) then
begin
i:=0;
timer:=Now;
if( GetTickCount>CastTimer ) then
begin
Cast(Name);
repeat
i:=i+100;
wait(100);
until( (InJournalBetweenTimes('concentration is|', timer, Now)<>-1) OR (i > 1000));
CastTimer:=GetTickCount+2000;
end;
end;
if( Target<>0 ) then
begin
i:=0;
timer:=Now;
if( GetTickCount>CastTimer ) then
begin
Cast(Name);
repeat
i:=i+100;
wait(100);
until( (InJournalBetweenTimes('concentration is|', timer, Now)<>-1) OR ( i > 2000) OR (TargetPresent()));
if( TargetPresent ) then
begin
TargetToObject(Target);
CastTimer:=GetTickCount()+2000;
end;
end;
end;
if( InJournalBetweenTimes('concentration is|', timer, Now)<>-1 ) then
begin
Fizzle:=True;
end
else
begin
Fizzle:=False;
end;
wait(200);
end;
--- End code ---
Example of Spell Casting sub:
--- Code: ---CastSpell('Enemy of One',1,0);
--- End code ---
For setting up timers and such you can utilize the Fizzle variable. IE:
--- Code: ---Program ConWep;
VAR
ConWepTimer : Cardinal;
CastSpell('Consecrate Weapon',1,0);
if( Fizzle=False ) then
begin
ConWepTimer:=GetTickCount()+9000;
end;
--- End code ---
You can apply the target to the pass also...
--- Code: ---CastSpell('Remove Curse',3,SELFID);
--- End code ---
Masscre:
Thank you for these DXRom. I have been looking for some small script to pick apart on stealth. I really want to learn stealth now that I am having a little more time to play with UO, but not alot of script for stealth out there to look at. That is my best way to learn is pick it apart and figure what does what.
dxrom:
--- Quote from: Masscre on September 23, 2013, 05:33:36 AM ---Thank you for these DXRom. I have been looking for some small script to pick apart on stealth. I really want to learn stealth now that I am having a little more time to play with UO, but not alot of script for stealth out there to look at. That is my best way to learn is pick it apart and figure what does what.
--- End quote ---
No problem man. I had to do the same thing when learning stealth, and am still doing it. I learn something new every time I get my hands on one of crome's scripts :>
Navigation
[0] Message Index
[#] Next page
Go to full version