Push object system

Wratox1

Member
Reaction score
22
Hello, ive decided to do some wc3 map making again.

So, i have this knight/warrior(the captain/swordsman model) and i want him to be able to push boxes and other objects around, but only when his shield is raised(using the defend ability).
He should only be able to push the object north/south/east/west, and the objects should be pushed in the direction he is facing. Also the objects should only move if the knight is moving and should only move if the knight is right behind the object.

How would i make this? I dont know any Jass.

Ideas and tips are welcome.

thanks in advance
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
Well, to start off, If Defend doesn't apply a buff to your knight (which if I remember, it does),
then create a buff for it and apply it to your knight when he uses defend.

Secondly check that when your knight is within, lets say 100 units to your box or object, you check whether he has the defend buff or not, and then save the angle between your knight and the box as a variable

Lastly check what the angle is and move accordingly, so if the angle is between:
  • -pi/4 and pi/4 you move the box east
  • pi/4 and 3xpi/4 you move the box north
  • 3xpi/4 and 5xpi/4 you move the box west
  • 5xpi/4 and 7xpi/4 you move the box south
 

Wratox1

Member
Reaction score
22
Well, to start off, If Defend doesn't apply a buff to your knight (which if I remember, it does),
then create a buff for it and apply it to your knight when he uses defend.

I actually tried making a system myself before i posted this thread, but that system wasnt very good, but there i checked if a unit used the defend ability and set a boolean to true, and when it was turned off, i set it to false. I did that since the defend ability didnt give the knight the buff i added to the ability and i felt it was easier to just set a boolean than to make a dummy unit cast a ability to add the buff.

Secondly check that when your knight is within, lets say 100 units to your box or object, you check whether he has the defend buff or not, and then save the angle between your knight and the box as a variable

Thats almost what i did with my system, however, i also want it to check if the knight is moving or standing still, and i have no idea on how to do that. Got any ideas? Also, im not really sure about the best method about checking the distance, at the moment the box is a unit with a box model, whats best to use: (i am going to have alot of these boxes/objects) a unit comes within range event or a periodic event + pick all units in range?

Lastly check what the angle is and move accordingly, so if the angle is between:
  • -pi/4 and pi/4 you move the box east
  • pi/4 and 3xpi/4 you move the box north
  • 3xpi/4 and 5xpi/4 you move the box west
  • 5xpi/4 and 7xpi/4 you move the box south

Thats easy enough i guess, ill get back to you if get any problems.

Edit: when i check the angle, what should i use as the comparison operator? Like, Less
than or equal to, greater than or equal to, etc. Also, is there a pi variable in the editor?

Another thing, im not entirely sure if im going to use the mouse for movement or perhaps the arrowkeys, if i use the arrowkeys it would be easy to restrict the pushing to only north/south/east/west, but i would rather have "wasd" instead of the arrowkeys, and from what ive heard there is no way to do that :(
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
it was easier to just set a boolean
That would work too, I would just see it as a wasted global variable but thats not much of a problem if you don't have thousands of them.
i also want it to check if the knight is moving or standing still
Hmm, if your knight moves within the range of a box, the box will move, so unless it reaches the edge of the map, your knight should never actually catch up with the box, therefore if won't matter if your knight is standing still, he'll only ever get within range if he's moving
im not really sure about the best method about checking the distance
There is a distance between two units method, it should be under the math operations.
a unit comes within range event or a periodic event?
I think a unit comes with range would be a better event, because like you said, you'll have a lot of these units, therefore if you're picking all units, and doing checks on everyone of them its just wasted memory again. If you're not using waits, all the actions will finish on one specific box, so you don't have to worry about the trigger starting on one box and halfway switching to another box.
when i check the angle, what should i use as the comparison operator?
In my first example it would be greater than -pi/4 and smaller than then pi/4 and so forth
Also, is there a pi variable in the editor?
Yes, if I remember correctly when choosing your Real values, so when set your Smaller Than value, click on the preset drop down menu, and it's right at the bottom, Pi
Remember that your angle is a Real value
but i would rather have "wasd" instead of the arrowkeys, and from what ive heard there is no way to do that :(
If you wanted to use wasd, you'd have to have four abilities and it just gets messy after that, so unfortunately its arrow keys or the mouse
 

DrEvil

FCRI Associate!
Reaction score
111
  • -pi/4 and pi/4 you move the box east
  • pi/4 and 3xpi/4 you move the box north
  • 3xpi/4 and 5xpi/4 you move the box west
  • 5xpi/4 and 7xpi/4 you move the box south


If he is using GUI(Says he knows no Jass) the angles between (a) and (b) will be in degrees not radians:

-45 and 45 = east
45 and 135 = north
135 and 225 west
225 and 315 south
 

SouLEDGE

Damn you advanced calculus
Reaction score
75
Hmm, I thought it returned real values and there was a function that converted
to degrees, but it could my programming brain at work
 

Wratox1

Member
Reaction score
22
That would work too, I would just see it as a wasted global variable but thats not much of a problem if you don't have thousands of them.
Hmm, if your knight moves within the range of a box, the box will move, so unless it reaches the edge of the map, your knight should never actually catch up with the box, therefore if won't matter if your knight is standing still, he'll only ever get within range if he's moving
thats not true, or well, it depends on how fast the box is moving, but if the knight is faster than the speed the box is moving, he can stand still for a second or so and the box is still moving, also if he approaches the box with his shield lowered and then brings up the shield, the box would get moved a bit..
There is a distance between two units method, it should be under the math operations.
i know that, but thats not what i meant, this was meant to be a part of the question about unit comes in range or periodic event, sorry for not being more clear..
I think a unit comes with range would be a better event, because like you said, you'll have a lot of these units, therefore if you're picking all units, and doing checks on everyone of them its just wasted memory again. If you're not using waits, all the actions will finish on one specific box, so you don't have to worry about the trigger starting on one box and halfway switching to another box.
i did not mean to check every box with the periodic but rather check the area around the knight..
In my first example it would be greater than -pi/4 and smaller than then pi/4 and so forth
ok
Yes, if I remember correctly when choosing your Real values, so when set your Smaller Than value, click on the preset drop down menu, and it's right at the bottom, Pi
Remember that your angle is a Real value
thanks, i found it
If you wanted to use wasd, you'd have to have four abilities and it just gets messy after that, so unfortunately its arrow keys or the mouse
yeah, thats what i thought:(
If he is using GUI(Says he knows no Jass) the angles between (a) and (b) will be in degrees not radians:

-45 and 45 = east
45 and 135 = north
135 and 225 west
225 and 315 south
thanks, but i displayed the angle after i calculated it, and when approaching the box from north(to move it south) it displayed -101 as the value..
 

Wratox1

Member
Reaction score
22
okay, so ive decided to change to arrowkey-movement, but i havent found any system that i liked yet, ive checked here, hive and wc3c.

Does anyone know of a arrowkey-movement system where you dont attack normal, but rather you press a to attack? I also need a good third person camera system, can someone suggest a good one, it can be written in Jass but there should be instructions on how to use it with gui.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/
  • The Helper The Helper:
    Decided to put up a healthier type recipe to mix it up - Honey Garlic Shrimp Stir-Fry https://www.thehelper.net/threads/recipe-honey-garlic-shrimp-stir-fry.193595/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top