• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Portal System v1.8

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
  • Like
Reactions: 88WaRCraFT3
12th Dec 2015
IcemanBo: For long time as NeedsFix. Rejected.


Zeatherann Presents:

An Anthro-Vixen System


Portal System


Reason for Making

I hated getting put into Violet Hold from Wow,
but it's portal system it used for the waves where very unique.
My system is basically a copy of it.
Also if you go into the technicalities of it my system evenly matches it.
Graphics not counted as you can change what effects to use.



Configurables
  • The look of the portal.
  • the look of the teleporting effect.
  • The look of the channeling beam and the channeling effect on the summoner unit.
  • The unit type(s) to create.
  • How fast it creates units.
Tehnical Side
  • MUI via Hashtables.
  • GUI friendly.
  • Only uses 4 SFX per portal.
  • Repeating trigger that turns itself off when not needed.
  • Doesn't use Locations only Coordinates.
Installing
  1. Open this map, open your map, open Trigger Editor.
  2. Go to Window->This map (should be the first one).
  3. Click the map name (where custom code is) and copy the newportal function.
  4. Go to Window->Your map (should be the second one).
  5. Paste newportal function into your map's header.
  6. Back to my map.
  7. Copy the trigger category (folder) Portal System.
  8. Check 'create unknown variables'
  9. Close my map.
  10. paste the trigger category (folder) into the trigger editor on your map.
  11. Done! Now make your dummy spell/ect...
JASS:
///////////////////////////////////////////////////////////////////////////
//////////////////////PORTAL SYSTEM////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
constant function PortalS_Lightning takes nothing returns integer
    return 0
endfunction
constant function PortalS_Player takes nothing returns integer
    return 1
endfunction
constant function PortalS_Previewer takes nothing returns integer
    return 2
endfunction
constant function PortalS_Rate takes nothing returns integer
    return 3
endfunction
constant function PortalS_SFXChannel takes nothing returns integer
    return 4
endfunction
constant function PortalS_SFXPortal takes nothing returns integer
    return 5
endfunction
constant function PortalS_SFXSummon takes nothing returns integer
    return 6
endfunction
constant function PortalS_Summoned takes nothing returns integer
    return 7
endfunction
constant function PortalS_Tick takes nothing returns integer
    return 8
endfunction
constant function PortalS_X takes nothing returns integer
    return 9
endfunction
constant function PortalS_Y takes nothing returns integer
    return 10
endfunction
function Portal_Reset takes nothing returns nothing
    set udg_PortalS_BeamLink = "CLPB"
    set udg_PortalS_Player = Player(0)
    set udg_PortalS_Preview = false
    set udg_PortalS_Rate = 1
    set udg_PortalS_SFXChannel = ""
    set udg_PortalS_SFXPortal = ""
    set udg_PortalS_SFXSummon = ""
    set udg_PortalS_Summoned = -1
    set udg_PortalS_Summoner = -1
    set udg_PortalS_X = 0.00
    set udg_PortalS_Y = 0.00
    set udg_PortalS_Keep=false
endfunction
function newportal takes nothing returns nothing
    local unit u=CreateUnit(udg_PortalS_Player,udg_PortalS_Summoner,udg_PortalS_X,udg_PortalS_Y,0)
    local integer id=GetHandleId(u)
    call GroupAddUnit(udg_PortalSG_ActivePortals,u)
    call SaveLightningHandle(udg_PortalSG_Hash,id,PortalS_Lightning(),AddLightningEx(udg_PortalS_BeamLink,true,udg_PortalS_X,udg_PortalS_Y,350,GetUnitX(u),GetUnitY(u),25))
    call SaveInteger(udg_PortalSG_Hash,id,PortalS_Rate(),udg_PortalS_Rate)
    call SaveInteger(udg_PortalSG_Hash,id,PortalS_Tick(),udg_PortalS_Rate)
    call SaveInteger(udg_PortalSG_Hash,id,PortalS_Summoned(),udg_PortalS_Summoned)
    call SaveEffectHandle(udg_PortalSG_Hash,id,PortalS_SFXPortal(),AddSpecialEffect(udg_PortalS_SFXPortal,udg_PortalS_X,udg_PortalS_Y))
    call SaveEffectHandle(udg_PortalSG_Hash,id,PortalS_SFXChannel(),AddSpecialEffectTarget(udg_PortalS_SFXChannel,u,"chest"))
    call SaveStr(udg_PortalSG_Hash,id,PortalS_SFXSummon(),udg_PortalS_SFXSummon)
    call SaveReal(udg_PortalSG_Hash,id,PortalS_X(),udg_PortalS_X)
    call SaveReal(udg_PortalSG_Hash,id,PortalS_Y(),udg_PortalS_Y)
    
    set u=null
    if udg_PortalS_Preview then
        set u=CreateUnit(udg_PortalS_Player,udg_PortalS_Summoned,udg_PortalS_X,udg_PortalS_Y,GetRandomReal(0,360))
        call SetUnitPathing(u,false)
        call SetUnitPosition(u,udg_PortalS_X,udg_PortalS_Y)
        call SaveUnitHandle(udg_PortalSG_Hash,id,PortalS_Previewer(),u)
        call UnitAddAbility(u,'Amrf')
        call UnitRemoveAbility(u,'Amrf')
        call SetUnitFlyHeight(u,325,2500)
        call PauseUnit(u,true)
        call UnitAddAbility(u,'Avul')
        call UnitAddAbility(u,'Aloc')
        call SetUnitVertexColor(u,255,255,255,128)
        set u=null
    endif
    if udg_PortalS_Keep==false then
        call Portal_Reset()
    else
        set udg_PortalS_Keep=false
    endif
    call EnableTrigger(gg_trg_Portal_System)
endfunction
JASS:
function Trig_Portal_System_Loop takes nothing returns nothing
    //Load values spacific to each portal
    local unit CurPortal=GetEnumUnit()
    local integer id=GetHandleId(CurPortal)
    local integer Tick=LoadInteger(udg_PortalSG_Hash,id,PortalS_Tick())
    local effect Portal=LoadEffectHandle(udg_PortalSG_Hash,id,PortalS_SFXPortal())
    local effect Channel=LoadEffectHandle(udg_PortalSG_Hash,id,PortalS_SFXChannel())
    local lightning Beam=LoadLightningHandle(udg_PortalSG_Hash,id,PortalS_Lightning())
    local unit Previewer=LoadUnitHandle(udg_PortalSG_Hash,id,PortalS_Previewer())
    set udg_PortalS_Player = GetOwningPlayer(CurPortal)
    set udg_PortalS_Rate = LoadInteger(udg_PortalSG_Hash,id,PortalS_Rate())
    set udg_PortalS_SFXSummon = LoadStr(udg_PortalSG_Hash,id,PortalS_SFXSummon())
    set udg_PortalS_Summoned = LoadInteger(udg_PortalSG_Hash,id,PortalS_Summoned())
    set udg_PortalS_X = LoadReal(udg_PortalSG_Hash,id,PortalS_X())
    set udg_PortalS_Y = LoadReal(udg_PortalSG_Hash,id,PortalS_Y())
    
    set udg_PortalS_Count=udg_PortalS_Count+1
    
    call MoveLightningEx(Beam,true,udg_PortalS_X,udg_PortalS_Y,350,GetUnitX(CurPortal),GetWidgetY(CurPortal),25)
    set Tick=Tick-1
    call SetUnitPosition(Previewer,udg_PortalS_X,udg_PortalS_Y)
    call SetUnitFacingTimed(Previewer,GetUnitFacing(Previewer)+30,.25)
    if Tick<=0then
        set Tick=udg_PortalS_Rate
        call CreateUnit(udg_PortalS_Player,udg_PortalS_Summoned,udg_PortalS_X,udg_PortalS_Y,0)
        call DestroyEffect(AddSpecialEffect(udg_PortalS_SFXSummon,udg_PortalS_X,udg_PortalS_Y))
    endif
    //save changed values
    call SaveInteger(udg_PortalSG_Hash,id,PortalS_Tick(),Tick)
    //if it needs to be removed, remove it +effects
    if GetWidgetLife(CurPortal)<=0.405 and IsUnitType(CurPortal,UNIT_TYPE_DEAD)then
        call DestroyEffect(Portal)
        call DestroyEffect(Channel)
        call RemoveUnit(Previewer)
        call DestroyLightning(Beam)
        call GroupRemoveUnit(udg_PortalSG_ActivePortals,CurPortal)
        call FlushChildHashtable(udg_PortalSG_Hash,id)
    endif
    set Portal=null
    set Beam=null
    set Channel=null
    call Portal_Reset()
endfunction
function Trig_Portal_System_Actions takes nothing returns nothing
    set udg_PortalS_Count=0
    call ForGroup(udg_PortalSG_ActivePortals,function Trig_Portal_System_Loop)
    if udg_PortalS_Count<1then
        call DisableTrigger(gg_trg_Portal_System)
    endif
endfunction
function InitTrig_Portal_System takes nothing returns nothing
    set gg_trg_Portal_System=CreateTrigger()
    call DisableTrigger(gg_trg_Portal_System)
    call TriggerRegisterTimerEvent(gg_trg_Portal_System,.25,true)
    call TriggerAddAction(gg_trg_Portal_System,function Trig_Portal_System_Actions)
endfunction


1.0
  • Spell Uploaded!
1.1
  • Fixed description.
  • Added spell code to description.
1.2
  • Removed nearly all BJ's.
  • Documented how to use the system using GUI trigger.
1.3
  • Removed all undeaded BJ's.
  • Made all eye candy configurable globally + doc.
1.4
  • Removed the last BJ using my own counter.
1.5
  • Changed the base trigger in how it counts units.
  • Localized the teleport effect, so now it can change on a portal by portal basis.
  • Optimized the code a little bit more, should be most effective +leakless.
1.6
  • Redid the description to be fully useful, and look nicer.
  • Made a better test map +minigame.
  • Redid some code to make it easier (mostly in in-editor doc)
1.7
  • Revamped entire system.
  • Made variables better named.
  • Rewrote the system to make it leak less.
  • Added constant functions.
  • Fixed bug with portal closing.
1.8
  • Removed a global variable.
  • Removed useless code.


Spell is made in JASS.

Keywords:
portal, summon, system, teleport, wow, violet hold, world of warcraft
Contents

Portal System (Map)

Reviews
Bribe: A lot of those map-specific things still leak. Instead of using a trigger + timer event, just use a single timer. If you need to pause/unpause it, just set it to a global. This way it creates fewer handles and saves RAM. I don't fully...

Moderator

M

Moderator

Bribe:

A lot of those map-specific things still leak.

Instead of using a trigger + timer event, just use a single timer. If you need to pause/unpause it, just set it to a global. This way it creates fewer handles and saves RAM.

I don't fully grasp what this system is supposed to do. It just seems like a pseudo-spawn system but it's not nearly dynamic enough. I couldn't tell if there was something I could do to speed up the process of "reinforcements" but something like this should certainly be implemented because those skeletons were kicking my ass ;).

Before I opened the map I thought this was actually something that teleports units around to make travel quicker... but it's definitely a spawn system. I definitely recommend you update the system to people who've never played world of war.
 
Level 5
Joined
Oct 24, 2007
Messages
90
Hey, Zeatherann

This is a great idea! At first, I thought this was going to be one of those boring systems where you create 2 portals and make one port to the other, but I was wrong! I might end up rewriting it in vJASS and using it for a little practice map or something like that... The system is well done and is pretty original. I've played WoW's Violet Hold, and it doesn't seem the idea came from there (it isn't an exact copy of it, IMO... that's why I consider it original). Of course, if I rewrite it and use it in my map, I will give you credits for the idea :)

+rep
 
Fixed it! Now only one BJ remaining (and no way of getting rid of it effectively).

the count units... ^_^

anyway, its up to you if you actually want to change it...

JASS:
function GroupLoop takes nothing returns nothing
  set UnitCount = UnitCount + 1
endfunction

function Trig_Portals_Actions takes nothing returns nothing
    call ForGroup(udg_GPOR_Portals, function GroupLoop)
    if UnitCount > 0 then
        call ForGroup(udg_GPOR_Portals,function Trig_Portals_Loop)
    else
        call DisableTrigger(gg_trg_Portals)
    endif
endfunction
 
Level 28
Joined
Jan 26, 2007
Messages
4,789
1) How to close portals?
2) Spelling mistakes.

JASS:
set u=null
if preview then
    set u=CreateUnit(p,spawn,x,y,GetRandomReal(0,360))
    // Some actions
    set u=null
endif
You could just null 'u' at the end.

The code looks good, but being able to close portals would greatly improve the system.
I believe you can do this by setting an integer variable (for example "lastCreatedPortal") to the handle ID.
Then the coder can easily save every portal and close them whenever he wishes.
 
Top