ID:167971
 
well im having some problems with this system. i want to make it so when u hit the verb u pick an obj then u can move it but it can move it?
client/obj
North()
if(src.mob.Moveobj!=null)
step(src.mob.Moveobj,North)
return
..()
client/obj
South()
if(src.mob.Moveobj!=null)
step(src.mob.Moveobj,South)
return
..()
client/obj
East()
if(src.mob.Moveobj!=null)
step(src.mob.Moveobj,East)
return
..()
client/obj
West()
if(src.mob.Moveobj!=null)
step(src.mob.Moveobj,West)
return
..()
mob/verb
Telekavorka(obj/O in view())
usr.Moveobj= O
O.Move()
mob/var/obj/Moveobj
any1 have ideas?
Heh, that coding is way off... objects dont have clients...
and for telekinesis, try using MouseDrag, you can make it move with your mouse! it would be something like this

obj
MouseDrag(src_location)
src.loc=src_location
In response to Killer22
could u give me more detail on mousedrag?
In response to Hobowantdollar
<dm>Please use DM tags.</dm>
In response to Detnom
n e other ideas than mousedrag?
In response to Hobowantdollar
What about clicking on the object to set it as the target, then click the new location to place it there?

Seems like you wouldn't even need or want verbs.

tsfreaks
In response to Tsfreaks
how would i do this like?
obj/Click()   
tab src.loc= Click.loc?
as u can see i have no idea wut to do
In response to Hobowantdollar
Try this:

mob/var/obj/moveobj

obj/DblClick() //when an obj is double clicked
usr.moveobj=src //it becomes your moveobj
atom/Click()if(loc) //when any atom with a loc is clicked
if(!usr.moveobj) //(no moveobj, use default action)
..()
else //and there is a moveobj
usr.moveobj.Move(loc) //move moveobj to loc


This is untested, so... whatever. Double click what you want to move, then click where you want to move it to.
In response to HM Geek
nope it doesnt work
In response to Hobowantdollar
I put together a quick demo. I'm a novice coder so I'm sure it's not perfect but it does work. You will have to draw your own images and map. Perhaps it could be submitted as a demo. I'd like to get feedback from more experienced DM'ers before submitting though. It would need to be commented for sure.

Images required in the test.dmi. Each must be named
1. water (turf)
2. grass (turf)
3. player (mob)
4. bucket_empty (obj)
5. bucket_filled (obj)
6. target (obj)

The target is the image that highlights the target you have selected. It can be anything you want. Example: [ ].

DM
Create one dm file
Copy and paste the following code into it.
Build it.

Map
Create a standard map at 10x10x1
Fill it with grass
Add some water (at least 1 turfs worth)
Place a bucket ot two on it.

Run it

1. Click a bucket to select it. Then click on the grass to move it.
2. Click on the water to select it. Then click the bucket to fill it.
3. With the bucket filled, select it. Then click the grass to move the filled bucket.

Hope this helps more than hurts. :)

[EDIT: Fixed some indentation problems after copy and paste to forum.]

tsfreaks

var
targetImage;
mob
icon='test.dmi';
icon_state="player";
density = 1;
opacity = 0;
var
target;
turf
grass
icon='test.dmi';
icon_state="grass";
density = 0;
opacity = 0;
water
icon='test.dmi';
icon_state="water";
density = 1;
opacity = 0;
obj
bucket
bucket_empty
icon='test.dmi';
icon_state="bucket_empty";
density = 1;
opacity = 0;
bucket_filled
icon='test.dmi';
icon_state="bucket_filled";
density = 1;
opacity = 0;
target
icon='test.dmi';
icon_state="target";
density = 0;
opacity = 0;
proc
HandleTargetRect()
del(targetImage);

client.Click(clickedItem)
if(clickedItem)
HandleTargetRect();
if(istype(clickedItem, /obj/bucket))
var/obj/bucket/b;
if(istype(clickedItem, /obj/bucket/bucket_empty))
var/obj/bucket/bucket_empty/be = clickedItem
b = be;
else
var/obj/bucket/bucket_filled/bf = clickedItem
b = bf;
if(usr.target)
if(istype(usr.target, /turf/water))
b.icon_state = "bucket_filled";
usr.target = null;
HandleTargetRect();
else
usr.target = b;
targetImage = image('test.dmi',b,"target")
else
usr.target = b;
targetImage = image('test.dmi',b,"target")
else if(istype(clickedItem, /turf))
var/turf/water/w;
if(istype(clickedItem, /turf/water))
w = clickedItem;
usr.target = w;
targetImage = image('test.dmi',w,"target")
else if(istype(clickedItem, /turf/grass))
var/turf/grass/g = clickedItem;
if(usr.target)
var/obj/bucket/b;
if(istype(usr.target, /obj/bucket/bucket_empty))
var/obj/bucket/bucket_empty/be = usr.target
b = be;
else if(istype(usr.target, /obj/bucket/bucket_filled))
var/obj/bucket/bucket_filled/bf = usr.target
b = bf;
if(b)
b.loc = locate(g.x,g.y,g.z);
usr.target = null
HandleTargetRect();
else
usr.target = g;
src << targetImage;
In response to Hobowantdollar
Hobowantdollar wrote:
nope it doesnt work

What was wrong with it? Just out of curiosity...