Moving objects on the Z axis

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
Whity
New User
Posts: 5
Joined: Wed May 30, 2007 5:14 pm

Moving objects on the Z axis

Post by Whity »

Hello im new in Pol and im a little confused. I tried to move a sign ob the Z axis but none oft the commands would work. Could someone explain me, why it doesnt work or is it just not implented Oo'

Greetings !
Yukiko
Distro Developer
Posts: 2826
Joined: Thu Feb 02, 2006 1:41 pm

Post by Yukiko »

Well, if you are using mpz the syntax is as follows:

mpz <amount_to_move> where amount_to_move is an integer. If amount_to_move is positive the item will move up (positive Z movement) the amount specified. If it is a negative integer the item will move down the specified amount.

Is that the command you used? If so did you specify an amount?

You can also use iteminfo and change the Z parameter in the gump but mpz is quicker.
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

If you're talking about the function MoveObjectToLocation then you must put MOVEOBJECT_FORCELOCATION in the function. (if you're using .mpz, this is already in that command)
Whity
New User
Posts: 5
Joined: Wed May 30, 2007 5:14 pm

Post by Whity »

Hello again,

the problem isnt solved yet.
My testing object is a brass sign and im using the pol 097...
I tried what both of you said but all that won't work.

Code: Select all

use uo;

program textcmd_movez(who)
  var what := Target(who, TGTOPT_NOCHECK_LOS);
  if (!what)
    return;
  endif
 
  var values:= Splitwords(RequestInput(who, who.backpack , "How much do you want to Change the coords?" ));
  MoveObjectToLocation(what, what.x + CInt(values[1]) , what.y + CInt(values[2]) , what.z + CInt(values[3]) );

endprogram
The command will work fine with the x and y axis but the z axis still won't change. If i add the MOVEOBJECT_FORCELOCATION nothing will work.

Am i doing somethin completly wrong?
[/code]
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

Are you placing the forcelocation in the realm spot?

This should work

MoveObjectToLocation(what, what.x + CInt(values[1]), what.y + CInt(values[2]), what.z + CInt(values[3]), what.realm, MOVEOBJECT_FORCELOCATION);

notice the what.realm must be between the z and the forcelocation. Theres another way you can do it without the realm parameter which I'll list below. I do it the way I listed above mostly for completeness since I personally don't like seeing parameters just being skipped.

MoveObjectToLocation(what, what.x + CInt(values[1]), what.y + CInt(values[2]), what.z + CInt(values[3]), flags := MOVEOBJECT_FORCELOCATION);
Whity
New User
Posts: 5
Joined: Wed May 30, 2007 5:14 pm

Post by Whity »

Thanks a lot CWO now its working, btw that means that the converted zip files are wrong , maybe someone could check them for that, i would do it if it would be replaced after ;)

Greetings and Thanks!
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post by CWO »

Saying the converted zip files were from POL095 originally, they were using the old way, MoveItemToLocation which had no realm parameter since realms didn't exist before POL096.
Post Reply