• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Custom Scripts / creating unit groups

Status
Not open for further replies.
Level 7
Joined
Sep 19, 2012
Messages
204
Hey there :)

can somebody tell me how to properly use custom scripts to create a specific unit group in a group array.
I need to number it as follows: Custom value of Unit + (Player Nr. of owner casting unit * 10)

is that even possible?

greetings

CodeBlack
 
Level 39
Joined
Feb 27, 2007
Messages
4,994
An easy way to always be able to do it yourself is just to use variables. Don't forget their udg_ prefix in CS lines:
  • Set INT = (Custom value of UNIT) + (Player Number of (Owner of (Triggering Unit))) * 10)
  • Custom script: set udg_GROUP[udg_INT] = CreateGroup()
 
Level 7
Joined
Sep 19, 2012
Messages
204
An easy way to always be able to do it yourself is just to use variables. Don't forget their udg_ prefix in CS lines:
  • Set INT = (Custom value of UNIT) + (Player Number of (Owner of (Triggering Unit))) * 10)
  • Custom script: set udg_GROUP[udg_INT] = CreateGroup()

You could also create such a statement in GUI, then copy the trigger and convert it to custom script to see the generated JASS and copy it from there.

thank you very much :) this is exactly what i was looking for!

  • Set Unit = your unit
  • Custom script: set udg_Group[GetConvertedPlayerId(GetOwningPlayer(udg_Unit)) * 10 + GetUnitUserData(udg_Unit)] = CreateGroup()

this as well, but the other ideas are more reusable for me xD
 
Status
Not open for further replies.
Top