Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • 0
Sign in to follow this  
DynamiteKaitorn

Object Carrying

Question

I'm trying to produce a script that allows the player to pick up an object and move it around. So far, I have this as my script but all it does is simply move the box to one specific location (regardless of where I look) whenever I execute the script.

 

Any ideas?

 

Spoiler

#include "zcommon.acs"

script 1 (void)
{
    while (TRUE)
    {
        CheckProximity (0, "Cube", 32.0);
        SetActorPosition (1, (CheckPlayerCamera(PlayerNumber()) == -1), (CheckPlayerCamera(PlayerNumber()) == -1), (CheckPlayerCamera(PlayerNumber()) == -1) , 0);
        delay(1);
    }
}

 

Share this post


Link to post

11 answers to this question

Recommended Posts

  • 0

SetActorPosition accepts x, y, z coordinates for the second through fourth arguments. You are passing the result of a == comparison here, which is being interpreted as 0 or 1. What you want here is a position that is near and in front of the player. To find the position of a player/the activator you should be using GetActorX and friends. You probably want to use that in combination with GetActorAngle and a little bit of math to compute an x, y, z position that is just in front of where the player is facing. You would then pass the x, y, z elements of that  position to your SetActorPosition call. 

Share this post


Link to post
  • 0
28 minutes ago, DynamiteKaitorn said:

That script doesn't even work >_>

Just checked, working fine.

 

How to use:
1. Look at the corpse or pickable bonus,
2. Press binded key (default: K),
3. Move somewhere,
4. Press binded key again or look away.

 

If you describe how it is not working for you, I may be able to help.

 

Share this post


Link to post
  • 0

As in it literally isn't even executing when I press the "pick up" key.

 

EDIT:

The file itself works but when I try to run it with my map, it doesn't even react to the box. (Though the dragging script really is inefficient and doesn't allow the player to move the object UP.)

Share this post


Link to post
  • 0

What "pick up" key?

 

To use this script, you have to bind "Toggle Drag" key in Customize Controls.

Then look at the corpse or an item, press that binded key, and move forward, for example. The thing that you are looking at will follow.

Share this post


Link to post
  • 0
1 minute ago, m8f said:

What "pick up" key?

 

To use this script, you have to bind "Toggle Drag" key in Customize Controls.

Then look at the corpse or an item, press that binded key, and move forward, for example. The thing that you are looking at will follow.

 

i know. I just said I tested the .pk3 away from my map and it works (albeit a little buggy) but has no effect on the box in my map.

Share this post


Link to post
  • 0

"it works (albeit a little buggy)" is pretty far from "That script doesn't even work" =\

 

How can my script, that is written specifically for dead things and pickable items, work for some box in your map? You need to modify the script to accept other things. Take a look at line 21 in DragThings.acs. You may want to set other flags, so PickActor (https://zdoom.org/wiki/PickActor) function will accept your thing.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×