• 🏆 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!

[Trigger] Variables,probleme

Status
Not open for further replies.
Level 6
Joined
Sep 24, 2015
Messages
174
Hi, i'm stuck at one variable...

I can't find the variable type (RegGroupA) of this code... I tried region, unittype..nothing worked. still got an error.


Code:
lb 1
    Event
        Temps - Every 1.00 seconds of game time
    Conditions
    Actions
        Set RegTypeUA = Lumber Base 1
        Custom script:   set udg_RegGroupA = GetUnitsOfTypeIdAllFix(udg_RegTypeUA)
        Custom script:   set bj_wantDestroyGroup = true
        Groupe unit - Pick every unit in (Units in RegGroupA) and do (Actions)
            Loop - Actions
                Joueur - Add 25 to (Owner of (Picked unit)) current wood
 
Level 13
Joined
May 10, 2009
Messages
868
The original function "GetUnitsOfTypeIdAll" returns a unit group: function GetUnitsOfTypeIdAll takes integer unitid returns group

However, because it is a custom function (suffix "Fix"), I can't say if it returns the same thing. Even though, I'll assume it returns a group.

The following custom script set udg_RegGroupA = GetUnitsOfTypeIdAllFix(udg_RegTypeUA) is trying to assign a group to the "RegGroupA" variable, which should be a region (Rect) data type. Why? The person who made that trigger managed to select it in a function that requires a region (rect).

So, the solution would be:

Change the variable RegGroupA data type to Unit Group, and change this:
  • Unit Group - Pick every unit in (Units in RegGroupA) and do (Actions)
into this:
  • Unit Group - Pick every unit in RegGroupA and do (Actions)
 
Last edited:
Level 6
Joined
Sep 24, 2015
Messages
174
I did like you showed but it doesn't give any lumber to the player...

Code:
lb 1
    Event
        Temps - Every 1.00 seconds of game time
    Conditions
    Actions
        Set RegTypeUA = Lumber Base 1
        Custom script:   set udg_RegGroupA = GetUnitsOfTypeIdAllFix(udg_RegTypeUA)
        Custom script:   set bj_wantDestroyGroup = true
        Groupe unit - Pick every unit in RegGroupA and do (Actions)
            Boucle - Actions
                Joueur - Add 25 to (Owner of (Picked unit)) current wood

I have to change Reg to Rect?

Edit:It's okay i found how to give lumber in fact i wasn't building the good building xD, ty :)
 
Last edited:
Status
Not open for further replies.
Top