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

[JASS] Unit instant move

Status
Not open for further replies.
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

again I tried some vJass =S - I'm new to this but maybe someone can help me with it.

JASS:
scope Enter initializer InitTrig_Enter

    private function Conditions takes nothing returns boolean
        return IsUnitType(GetEnteringUnit(), UNIT_TYPE_HERO) == true
    endfunction

    private function Actions takes nothing returns nothing
        call IssuePointOrderLoc(GetEnteringUnit(), "SetUnitPositionLoc", GetRectCenter(gg_rct_Leave))
    endfunction

//===========================================================================
    function InitTrig_Enter takes nothing returns nothing
        set gg_trg_Enter = CreateTrigger(  )
        call TriggerRegisterEnterRectSimple( gg_trg_Enter, gg_rct_Enter )
        call TriggerAddCondition( gg_trg_Enter, Condition( function Conditions ) )
        call TriggerAddAction( gg_trg_Enter, function Actions )
    endfunction

endscope
The Plan: If a unit (HERO) enter the rect "Enter", he should INSTANTport to rect "Leave"

The problem is what is the String Order - for instant move?. ( I Just typed "move" - but than he only walks to the rect not instantmove. ( SetUnitPositionLoc - i just write it to test some orders )

Thanks =)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
IssuePointOrderLoc() will not work for you,,
JASS:
call SetUnitX(GetEnteringUnit(), GetRectCenterX(gg_rct_Leave))
call SetUnitY(GetEnteringUnit(), GetRectCenterY(gg_rct_Leave))

that will work. Also i reccomend to get used to coordinates (x and y) when using Jass instead of locations, because they suck.
 
Level 16
Joined
May 1, 2008
Messages
1,605
Ok i will test it =)

Now other problem: as i learn vJass i added something to this trigger. A 5 seconds massage. I tried it with:
JASS:
call DisplayTimedTextToPlayer(GetOwningPlayer(GetEnteringUnit()), 0, 0, 5, "You are now in: New City" )
Its all ok, but if i enter the target rect, the massage shows up TWICE. But only oneunit enter it. Where is the problem here?

Edit: If the unit is instantmoved - the unit try to move back to the "entering Rect" - whats this?

Thanks =)
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Why the hell would it move back? D: I suggested SetUnitX and SetUnitY for a reason,, BECAUSE it does not stop orders duh,, But he can just as well use SetUnitPosition() as well,,
 
Status
Not open for further replies.
Top