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

[Spell] Need some help with an automatic spawn system

Status
Not open for further replies.
Level 5
Joined
Jul 17, 2010
Messages
140
Hello!

I want this system to work. the way that, when he have this buff active there will spawn 2 units.
And if 1 or both die, they spawn up to 2 units again.


Code:
Initialization
    Events
        Time - Elapsed game time is 0.00 seconds
    Conditions
    Actions
        -------- Set up variables --------
        Set W_P_Group[1] = (All players controlled by a User player)
        Set W_Point = (Center of (Playable map area))
        Set W_Point2 = (Center of (Playable map area))
        Set W_X = (Number of players in (All players controlled by a User player))
        -------- I advice not to touch unless you really know what are you doing --------
        -------- This creates multi board and all the variables --------
        For each (Integer W_Int) from 1 to W_X, do (Actions)
            Loop - Actions
                Set W_PetOwner[W_Int] = No unit
                Set W_Pet1[W_Int] = No unit
                Set W_Pet2[W_Int] = No unit
                Set W_Pet3[W_Int] = No unit
                Set W_Rolumn[W_Int] = 0
                Set W_Range[W_Int] = 100.00
        -------- Remove Location leaks --------
        Custom script:   call DestroyForce(udg_W_P_Group[1])
        Custom script:   call RemoveLocation(udg_W_Point)
        Custom script:   call RemoveLocation(udg_W_Point2)

Code:
Pet Gen
    Events
        Time - Every 0.20 seconds of game time
    Conditions
        ((Triggering unit) has buff |cff00ff00Set: Felheart|r (6)) Equal to True
    Actions
        -------- These triggers adds pets to the multi board --------
        For each (Integer W_Int) from 1 to W_X, do (Actions)
            Loop - Actions
                -------- All these triggers are necessary for the pet system, don't delete anything --------
                Custom script:   if ( GetLocalPlayer() == Player(( udg_W_Int-1)) ) then
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        W_Pet1[W_Int] Equal to No unit
                    Then - Actions
                        Set W_PetOwner[W_Int] = (Triggering unit)
                        Set W_Point = (Position of W_PetOwner[W_Int])
                        -------- ----------------------- --------
                        -------- While creating new pets don't forget to change what pet it will spawn --------
                        -------- ----------------------- --------
                        Unit - Create 1 Flame Imp for (Owner of (Triggering unit)) at W_Point facing Default building facing degrees
                        Set W_Pet1[W_Int] = (Last created unit)
                        Unit - Hide W_Pet1[W_Int]
                        Custom script:   call RemoveLocation(udg_W_Point)
                    Else - Actions
                Custom script:   endif
Code:
Pet Fallow
    Events
        Time - Every 0.10 seconds of game time
    Conditions
    Actions
     
        -------- These triggers make all your pets fallow you if range between <W_PetOwner[*]> and <W_Pet[*]> is bigger then varialbe <W_Range[*]> --------
        -------- And if you character attacks a unit, pet also will attack --------
        For each (Integer W_Int) from 1 to W_X, do (Actions)
            Loop - Actions
                Custom script:   if ( GetLocalPlayer() == Player(( udg_W_Int-1)) ) then
                Set W_Point = (Position of W_PetOwner[W_Int])
                Set W_Point2 = (Position of W_Pet[W_Int])
                If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    If - Conditions
                        (Distance between W_Point and W_Point2) Greater than or equal to W_Range[W_Int]
                    Then - Actions
                        Unit - Order W_Pet[W_Int] to Right-Click W_PetOwner[W_Int]
                    Else - Actions
                Custom script:   call RemoveLocation(udg_W_Point2)
                Custom script:   call RemoveLocation(udg_W_Point)
                Custom script:   endif


Thank your help in advance!

-Dominic
 
Last edited:
Status
Not open for further replies.
Top