• 🏆 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!
  • ✅ Time to vote for the top 3 models! The POLL for Hive's 6th HD Modeling Contest: Mechanical is now open! 📅 Poll close on July 16, 2024! 🔗 Cast your vote now!

[JASS] GetConstructingStructure question

Status
Not open for further replies.
Level 7
Joined
Feb 14, 2008
Messages
289
Would this apply to the last constructing structure?

Here is my code
Code:
function Portal_Ability_Actions takes nothing returns nothing
        local real ax
        local real bx
        local real ay
        local real by
        local unit dummy
        local unit caster
        local unit a
        local unit b
    if(GetSpellAbilityId()=='A02D')then
        set ax = GetSpellTargetX()
        set ay = GetSpellTargetY()
        set bx = GetUnitX(GetTriggerUnit())
        set by = GetUnitY(GetTriggerUnit())
        set dummy = CreateUnit(GetTriggerPlayer, 'u001', ax, ay, 270)
        call IssuePointOrderById(dummy, 'h003', ax, ay)
        set a = GetConstructingStructure()
        set dummy = CreateUnit(GetTriggerPlayer, 'u001', bx, by, 270)
        call IssuePointOrderById(dummy, 'h003', bx, by)
        set b = GetConstructingStructure()
    else
        DoNothing()
    endif
    endfunction
 
Level 14
Joined
Jul 1, 2008
Messages
1,314
There is no constructing structure in your trigger as your event is some spell event, right? I think GetConstructingStructure() is rather used as an event response.
Also are you sure that GetTriggerPlayer() returns something in your case? I think it does not. Use GetOwninglayer(GetTriggerUnit())
 
Level 7
Joined
Feb 14, 2008
Messages
289
There is no constructing structure in your trigger as your event is some spell event, right? I think GetConstructingStructure() is rather used as an event response.

It is indeed originating as a spell event, so your argument makes sense. What would you suggest?
Because here is how the steps will be in my mind:
1. You cast spell on a loc
2. You get 2 dummy units
3. Both dummy units make a waygate unit on their location
4. Both waygate units are activated and have coordinates set to the location of the other one

A lot of that comes down to the local coordinates of both sides, which isnt hard in and of itself. The biggest hiccup is just taking the building that the dummies are constructing and putting those into locals. Once that is done, it should be downhill from there.

Also are you sure that GetTriggerPlayer() returns something in your case? I think it does not. Use GetOwninglayer(GetTriggerUnit())

That makes sense. No, I don't know if it returns something, but your second piece looks like it would be more valid.
 
Level 41
Joined
Feb 27, 2007
Messages
5,182
You can't issue an order that's the Rawcode of a unit and expect it to do anything! Orders by ID are just things like "rainoffire" and "smart" turned into the internal integer orders that wc3 uses. Instead you'll want to just create 2 waygates. You may find this thread very helpful for understanding how Waygates work; turns out there are some waygate natives!:
JASS:
native WaygateActivate unit waygate, boolean activate nothing
native WaygateGetDestinationX unit waygate real
native WaygateGetDestinationY unit waygate real
native WaygateIsActive unit waygate boolean
native WaygateSetDestination unit waygate, real x, real y

So what you'll want to do is this:
JASS:
set dummy = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'h003', ax, ay, 270.00)
call WaygateSetDestination(dummy, bx, by)
call WaygateActivate(dummy, true)

set dummy = CreateUnit(GetOwningPlayer(GetTriggerUnit()), 'h003', bx, by, 270.00)
call WaygateSetDestination(dummy, ax, ay)
call WaygateActivate(dummy, true)

I am assuming 'h003' is your custom waygate unit. If not you should make one and then use that unit's rawcode for the CreateUnit call. Now when you do this you may find that enemy units can use your waygates! If that's the case, you'll need to go edit the waygate unit's waygate ability and change its targets allowed to be "player unit" or "allied" however you want. This should fix units using it when the shouldn't.

You can also test if the waygate will work for enemies by ordering an enemy unit to "smart" the waygate. "Smart" is the right-click order, and right-clicking is what tells units to use waygates. With this method they should automatically use the waygate to get around the map if its quicker to do so.
 
Last edited:
Status
Not open for further replies.
Top