Author Topic: help with using an item at +/- my characters position  (Read 2604 times)

0 Members and 1 Guest are viewing this topic.

Offline rbestoneTopic starter

  • Newbie
  • *
  • Posts: 9
  • Activity:
    0%
  • Reputation Power: 1
  • rbestone has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
help with using an item at +/- my characters position
« on: March 29, 2014, 04:17:25 PM »
0
looking for info about using an object located at -1, -2 of your character in a field of same type objects.
im working on a fishing script that picksup and replaces traps. i can get it to do everything except, it just picks up random traps instead of the one i want. i cant figure out how to make it see a specific spot, based off my char position.
Code: [Select]
7pick&replace:
findItem CZZ G_ 5    ;i dont know how to make this - or + charpos instead of ground 5
if #findKind = -1
{
      wait 10
      goto trap
            }
            else
{
set #ltargetKind
set #lobjectID #findID
  set #ltargetKind 1
event macro 17 0
wait 10
set #lTargetX #charposx +  +1 ; i know its to late here
set #lTargetY #charposy +  -1 ; and here
set #lTargetZ 1
wait 25

Offline TrailMyx

  • Officially retired from UO
  • Administrator
  • *
  • *
  • Posts: 13305
  • Activity:
    0.8%
  • Reputation Power: 154
  • TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!TrailMyx is awe-inspiring!
  • Gender: Male
  • Viper!
  • Respect: +1349
  • Referrals: 33
    • View Profile
    • ScriptUO
Re: help with using an item at +/- my characters position
« Reply #1 on: March 29, 2014, 04:45:13 PM »
0
When you do a "finditem" command, you also get information about where the item is located and that is returned in #FINDX, #FINDY and #FINDZ.  If you subtract your #CHARPOSX from #FINDX, you get a relative location of the item.  Same goes for the Y and Z coords.  This gives you an idea where the item is located relative to your position.
Please read the ScriptUO site RULES
Come play RIFT with me!

Offline manwinc

  • Elite
  • *
  • *
  • Posts: 2556
  • Activity:
    0%
  • Reputation Power: 32
  • manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!manwinc is a rising star!
  • Gender: Male
  • "The Devs Hard at Work"
  • Respect: +123
  • Referrals: 1
    • View Profile
Re: help with using an item at +/- my characters position
« Reply #2 on: March 29, 2014, 09:04:48 PM »
0
Hmm.... Probably the easiest method for you to work with would be to build individual Subs for Each Trap Location Based on Position.

Code: [Select]
Sub Trap1
Finditem CZZ G_5
if #Findcnt > 0
{
For #Findindex 1 #Findcnt ; Index's Through all the items That are Found of that Type within the Range
{
if #Findx = #Charposx - 2 && #Findy = #Charposy -1 ; here is where you setup your Coordinates
{
; DO STUFF
}
}
}
Return


Then you Could Build a Sub For Each Trap And when you wanted to pull a specific one you just Gosub to it.

Gosub Trap1
Gosub Trap2
Gosub Trap3

etc etc etc
« Last Edit: March 29, 2014, 09:06:22 PM by manwinc »
Monkeys and Typewriters!

" Oh I know, We'll make a Boss Encounter that requires 3 keys per player to enter, Then we'll make it not a closed instance so you never know if you are going to pop into a fresh room or a boss that has 1% Health left with 20 dudes smashing its face in, wasting your time and effort"

Offline rbestoneTopic starter

  • Newbie
  • *
  • Posts: 9
  • Activity:
    0%
  • Reputation Power: 1
  • rbestone has no influence.
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: help with using an item at +/- my characters position
« Reply #3 on: March 30, 2014, 03:53:39 AM »
0
thank you both for the info and explanation of how/why it works. i will give it a whirl and let you know.

Offline Fluwton

  • Jr. Member
  • **
  • Posts: 16
  • Activity:
    0%
  • Reputation Power: 1
  • Fluwton has no influence.
  • Shorn scrotum and fancy-free!
  • Respect: 0
  • Referrals: 0
    • View Profile
Re: help with using an item at +/- my characters position
« Reply #4 on: May 09, 2014, 12:27:12 PM »
0
They didn't let you know.

I fear that this all may have been an elaborate ruse to get you guys to waste valuable electrons on a response.

The fiend!

Tags: