ambiera home ambiera home

Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:    
Ambiera Forum > CopperCube > Programming and Scripting
move click
Author Text

camagames
Registered User
Quote
2018-02-21 11:20:10

Hello everyone I read that with Coppercube you can play RTS games. I was wondering if you could give me an example of a script to move units with the click of the mouse. Thank you


areibma
Registered User
Quote
2018-02-21 12:01:39

https://www.ambiera.com/coppercube/download_extensions.html
Check the behavior section, first one is click to move rpg like but it can be changed to rts like movement.


camagames
Registered User
Quote
2018-02-21 12:34:47

(Move object by click into 3D world)And the only one that exists but does not allow a precise RTS function. You do not select a click and then move it.


areibma
Registered User
Quote
2018-02-22 07:58:49

No, it is like RPG movement. But it wouldn't be difficult to make it RTS like select and move movement. Try to implement.


Zoo
Guest
Quote
2018-02-22 19:30:43

I would also be interested in this as an action... I am not sure how to approach this even though have programmed a lot in coppercube.

I am quite interested in building a turn based rts where you can select multiple units to move X amount of distance in a certain direction per move.

Any ideas on how to do this?


areibma
Registered User
Quote
2018-02-23 06:25:38

Single entity could be selected using a ray mouse pick method.
For multiple entity selection, you will need to draw a rectangle and than check which entities are inside the selection rectangle and on mouse up if there is any entity inside selection rectangle than make them selected.
Entity movement will vary game to game.


ishmaru
Registered User
Quote
2018-02-23 13:37:08

I was inspired to try doing an RTS Script, not complete since its only unit movement but this is what i have so far:

Behavior:
https://drive.google.com/open?id...

Example Template:
https://drive.google.com/open?id...

Features:
*This behavior mimics RTS Movement, Left Click to select unit/units, and Right click tells them where to go.

* Left clicking while holding Shift alows you to select multiple units.

* Left clicking while holding Ctrl removes a unit from the selection.

* A Key Selects All units

* Space Unselects all units

* Units are programmed to position themselves randomly around the target point to prevent them from merging into one

* The amount of randomness and space between units can be controlled by the "PositionVariation" and "PositionMultiplier"

* This script assumes you have a hidden child node with the index of 0 (child directly below this node) that will be the selection indicator


If anyone is interested in figuring out how to do box selections and combat is free to add to this.


areibma
Registered User
Quote
2018-02-24 11:52:58

Here is my simple RTS like movement. It does not select multiple units, just single unit.
https://www.dropbox.com/s/aewuuhyy3s04eg9/RTS.7z?dl=0

Right now I just couldn't think how to make the multiple unit selection rectangle without those javascripts methods -
http://www.ambiera.com/forum.php?t=4892

There might be some other ways, need to figure out first.


Zoo
Guest
Quote
2018-02-24 16:00:52

Brilliant!

Adding to MTM


Zoo
Guest
Quote
2018-02-24 16:08:42

This is the best plugin that I have found on MTM...

Well done, I am going to use this for my next game!! Brilliant work!!

You should still sell your plugins ON mtm, so far I think that you are the most valuable resource as a community member that we have in this community +1

I never thought of the way you did it...I simply couldn't work out the best method and you resolved that problem like a champ.

I am an experienced programmer in CC, but you are even better.

That is for sure.

Thanks so much!!!!!!!!!!!!!!


hgi
Registered User
Quote
2018-03-06 11:44:52

This is dope, thanks so much ishmaru


ishmaru
Registered User
Quote
2018-03-06 18:11:40

Ishmaru RTS Script UPDATE!
Video showing progress:

https://www.youtube.com/watch?v=...


Features:
*This behavior mimics RTS Movement, Left Click to select unit/units, and Right click tells them where to go.

* Left clicking while holding Shift alows you to select multiple units.

* Left clicking while holding Ctrl removes a unit from the selection.

* A Key Selects All units

* Space Unselects all units

* Units are programmed to position themselves randomly around the target point to prevent them from merging into one

* The amount of randomness and space between units can be controlled by the "PositionVariation" and "PositionMultiplier"

* This script assumes you have a hidden child node with the index of 0 (child directly below this node) that will be the selection indicator.

* Also looks for hidden child node with the index of 1 for the muzzle/attack fx

* You can specify Actions on Death to create explosions/blood etc

* You can specify attack range, Attack Strength, Random multiplier, and specify multipliers based on unit Armor type

* You specify the armor type in the node's name value, place the armor type first the use a "_" to separate the armor from the name. EX: LIGHT_Rifleman or HEAVY_MainBattleTank where as "LIGHT" and "HEAVY" Are the armor type.

* You can specify weather a unit is controllable or not (Simply switch off to make AI)

* You can specify if units priortize following the move order or stop to engege all enemies they encounter. (AttackWhileMoving option)

*Teams are specified with Node folders, and with each unit you can specify which team(Node Folder) to attack.

*Damage is calculated completely by the Behavior no need to use the Character Behavior.

* On Unit creation 2 variables are made to represent that unit's current health and max health. It gets the unit name + a string of "Health" or "MaxHealth" (Ex: LIGHT_RiflemanHealth and LIGHT_RiflemanMaxHealth ) You can freely change these values in run time by just setting the variable.

*You can specify a value for unit Hp regeneration, it triggers every 2 seconds (never going above MaxHealth)

*In game cloning works

* Air Units!

* Very basic Ai every ~10 randomly moves and Engages any targets in their path.

PS targeting is not yet implemented so right now you just have to move units next to target, and let them attack on their own.
Also Code is slow, i'm currently looking at ways to lessen the burden on the machine, and too many units at once can crash the game.


you can try out the behavior here - download:
https://drive.google.com/open?id...


areibma
Registered User
Quote
2018-03-07 04:48:26

@ismaru: you should create a new thread for your template else it will be hard for others to find it and will be actually get ignored.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (you are not logged in)


Text:

 

  

Forum Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   





Software: Ambiera Light Forum. © 2008-2018 Nikolaus Gebhardt, Ambiera e.U.