• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[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 40
Joined
Feb 27, 2007
Messages
5,095
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