• 🏆 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] WE says two lines are broken?

Status
Not open for further replies.
Level 12
Joined
Apr 18, 2007
Messages
1,130
  • Unit Group - Pick every unit in (Units in (Playable map area)) and do (Actions)
    • Loop - Actions
      • Custom script: if GetPlayerAlliance(GetOwningPlayer(GetEnumUnit()),GetTriggerUnit(),ALLIANCE_SHARED_CONTROL) then
      • Set tempPoint[3] = (Position of (Picked unit))
      • Unit - Order (Picked unit) to drop (Item carried by (Picked unit) in slot 1) at tempPoint[3]
      • Custom script: call RemoveLocation(udg_tempPoint[3])
      • Custom script: endif
That's my trigger's action.
Now, upon saving/enabling the trigger, I get these errors:
Line 1704: Invalid argument type (unit)
Line 1708: Expected a code statement (unit)
1704: if GetPlayerAlliance(GetOwningPlayer(GetEnumUnit()),GetTriggerUnit(),ALLIANCE_SHARED_CONTROL) then
1708: endif

Basically, I want a line of JASS that would be equal to this line of GUI:
  • ((Picked unit) belongs to an ally with full control of (Triggering player)) Equal to True
However, that's not a GUI function; the closest you get is
  • ((Picked unit) belongs to an ally of (Triggering player)) Equal to True
 
The function GetPlayerAlliance takes player sourcePlayer and player otherPlayer, but he provided a Unit instead of a player.
Anyway such a function which u're trying to use doesn't exist, but it doesn't mean you can't create it urself:
JASS:
function IsUnitAllyShared takes unit whichUnit, player whichPlayer returns boolean
    local integer index = 0
    if IsUnitAlly( whichUnit, whichPlayer ) and GetOwningPlayer( whichUnit ) != whichPlayer then
        loop
            if GetPlayerAlliance( Player( index ), whichPlayer, ALLIANCE_SHARED_CONTROL ) then
                return true
            endif
            set index = index + 1
            exitwhen index == bj_MAX_PLAYER_SLOTS
        endloop
    endif
    return false
endfunction

If you want to make it work for your own units aswell remove the line "and GetOwningPlayer( whichUnit ) != whichPlayer".
 
Level 12
Joined
Apr 18, 2007
Messages
1,130
You have an extra bracket after ALLIANCE_SHARED_CONTROL, try removing it

After doing said action, I get this error:
Line 1704: Expected '
1704: if GetPlayerAlliance(GetOwningPlayer(GetEnumUnit()),GetTriggerUnit(),ALLIANCE_SHARED_CONTROL then

Okay, never mind, Kingz helped me in chat and it's all going well now!
 
Last edited by a moderator:
Status
Not open for further replies.
Top