Moving CRPL core

Started by milkev, February 15, 2016, 07:12:39 PM

Previous topic - Next topic

milkev

Hello, I have a custom unit (CRPL core) that produces anticreeper when supplied with ammo. I wanted the player to be able to move it around, Is there a script that allows this?

GameGibu

#1
It could exist somewhere, but not likely in a place you can access it.

So if you feel up to it, you could write it based on these instructions:


  • make a var like "isSelected"
  • give it a value of 1 when A) mouse position is over button and B) mouse button is down and C) isSelected was previously 0
  • set isSelected to 0 whenever the spacebar is pressed
  • next time the mouse is down while isSelected is 1, getMouseCoords pixelToCell <-speed QueueMove

That's a rough guide to getting that core clickable and moveable, but the stuff that'll make it look nice or not is entirely up to you.

-GameGibu

Edit: instead of detecting spacebar down, do:
:UserCancelAction
      0 ->isSelected
Bringing you Custom maps since 2971!
☆CRPL Master☆

milkev

#2
Quote from: GameGibu on February 15, 2016, 11:35:01 PM
It could exist somewhere, but not likely in a place you can access it.

So if you feel up to it, you could write it based on these instructions:


  • make a var like "isSelected"
  • give it a value of 1 when A) mouse position is over button and B) mouse button is down and C) isSelected was previously 0
  • set isSelected to 0 whenever the spacebar is pressed
  • next time the mouse is down while isSelected is 1, getMouseCoords pixelToCell <-speed QueueMove

That's a rough guide to getting that core clickable and moveable, but the stuff that'll make it look nice or not is entirely up to you.

-GameGibu
Yes ill definitely try it!
Edit: okay, i think this is how i do it....


$isselect:0

"MouseCoords" CurrentCoords neq <-isselect "=" 1

<-isselect 1 eq CurrentCoords "=" "MouseCoords"

Is this right for testing if the mouse is over the crpl and if it is, moved the crpl to the mouse coords until deselected(currently no code for that)?
and how do i test for the spacebar? " " doesn't work. sry if its just a stupid mistake i have to get off right away :P