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

Custom Script

Status
Not open for further replies.
Ooh I know how to do this, i'll give a brief explanation. Just let me edit and i'll show you.

Edit:

If it is a normal number array just do this:

  • example
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set leakpoint[1] = (Center of (Playable map area))
      • Unit - Create 1 Footman for Player 1 (Red) at leakpoint[1] facing Default building facing degrees
      • Custom script: RemoveLocation(udg_leakpoint[1])
But if you are talking about an array that is stored in a variable then do this:

1: Start with the trigger:

  • example
    • Events
      • Player - Player 1 (Red) types a chat message containing test as An exact match
    • Conditions
    • Actions
      • Set leakpoint[(Player number of (Triggering player))] = (Center of (Playable map area))
      • Unit - Create 1 Footman for Player 1 (Red) at leakpoint[(Player number of (Triggering player))] facing Default building facing degrees
      • Custom script: RemoveLocation(udg_leakpoint[?????])
2: Convert to custom text:

JASS:
function Trig_example_Actions takes nothing returns nothing
    set udg_leakpoint[GetConvertedPlayerId(GetTriggerPlayer())] = GetRectCenter(GetPlayableMapRect())
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), udg_leakpoint[GetConvertedPlayerId(GetTriggerPlayer())], bj_UNIT_FACING )
    RemoveLocation(udg_leakpoint[?????])
endfunction

//===========================================================================
function InitTrig_example takes nothing returns nothing
    set gg_trg_example = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_example, Player(0), "test", true )
    call TriggerAddAction( gg_trg_example, function Trig_example_Actions )
endfunction

3: Now, as you noticed, you have probably seen what looks like an array in custom script. The custom script array went like this:

JASS:
[GetConvertedPlayerId(GetTriggerPlayer())]

So then we are going to copy paste it into the action:

  • Custom script: RemoveLocation(udg_leakpoint[GetConvertedPlayerId(GetTriggerPlayer())])
And then it should be working perfectly.

  • example
    • Events
      • Player - Player 1 (Red) types a chat message containing test as An exact match
    • Conditions
    • Actions
      • Set leakpoint[(Player number of (Triggering player))] = (Center of (Playable map area))
      • Unit - Create 1 Footman for Player 1 (Red) at leakpoint[(Player number of (Triggering player))] facing Default building facing degrees
      • Custom script: RemoveLocation(udg_leakpoint[GetConvertedPlayerId(GetTriggerPlayer())])
 
Level 6
Joined
Oct 14, 2010
Messages
58

  • add "call" to custom script
    • Custom script: call RemoveLocation(Location)
:ogre_icwydt:

and if y knowlage jass, use so
JASS:
function Trig_example_Actions takes nothing returns nothing
    local real x = GetLocationX(udg_leakpoint[1])
    local real y = GetLocationY(udg_leakpoint[1])
    local unit u
    set u = CreateUnit(GetPlayerId(Player(1)), 'unitid', x,y, bj_UNIT_FACING)
    call RemoveLocation(udg_leakpoint[1])
    set u = null
    call DestroyTrigger(GetTriggeringTrigger()) // if your trigger have single-use type
endfunction
//=============
function InitTrig_example takes nothing returns nothing
    set gg_trg_example = CreateTrigger(  )
    call TriggerRegisterPlayerChatEvent( gg_trg_example, Player(0), "test", true )
    call TriggerAddAction( gg_trg_example, function Trig_example_Actions )
endfunction

OR // if your trigger not have single-use type, I make so, maybe its true=)

function InitTrig_example takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(t, Player(0), "test", true)
    call TriggerAddAction(t, function Trig_example_Actions)
    set t = null
endfunction

In my opinion it trigger not have leakage
 
Last edited:
Level 14
Joined
Dec 29, 2009
Messages
931
I don't know jass, nor do I know how to use it. I'm assuming that function is for the trigger you posted, so I shall post my own trigger.

  • FS Run
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Feared Strike
    • Actions
      • Set FS_OriginalLoc00[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Set FS_TempUnit00[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
      • Set FS_TempLoc00[(Player number of (Owner of (Triggering unit)))] = (Position of FS_TempUnit00[(Player number of (Owner of (Triggering unit)))])
      • Unit - Cause (Triggering unit) to damage FS_TempUnit00[(Player number of (Owner of (Triggering unit)))], dealing ((Real((Level of (Ability being cast) for (Triggering unit)))) x 50.00) damage of attack type Spells and damage type Normal
      • Unit - Pause (Triggering unit)
      • Unit - Move (Triggering unit) instantly to FS_TempLoc00[(Player number of (Owner of (Triggering unit)))]
      • Special Effect - Create a special effect at FS_TempLoc00[(Player number of (Owner of (Triggering unit)))] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Move (Triggering unit) instantly to FS_OriginalLoc00[(Player number of (Owner of (Triggering unit)))]
      • Unit - Unpause (Triggering unit)
      • Custom script: call RemoveLocation(udg_FS_OriginalLoc00)
      • Custom script: call RemoveLocation(udg_FS_TempLoc00)
 
Level 6
Joined
Oct 14, 2010
Messages
58
I don't know jass, nor do I know how to use it. I'm assuming that function is for the trigger you posted, so I shall post my own trigger.

  • Custom script: call RemoveLocation(udg_FS_OriginalLoc00)
  • Custom script: call RemoveLocation(udg_FS_TempLoc00)

mmm, where array value?

  • fix end
    • Custom script: call RemoveLocation(udg_FS_OriginalLoc00[(Player number of (Owner of (Triggering unit)))])
    • Custom script: call RemoveLocation(udg_FS_TempLoc00[[(Player number of (Owner of (Triggering unit)))])
if yu will not use any more a unit variable in other triggers, add it:

  • Unit clean leak
    • Custom script: set udg_FS_TempUnit00[(Player number of (Owner of (Triggering unit)))] = null
In my opinion it to a place, correct me, if it not so
 
I don't know jass, nor do I know how to use it. I'm assuming that function is for the trigger you posted, so I shall post my own trigger.

  • FS Run
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Feared Strike
    • Actions
      • Set FS_OriginalLoc00[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Set FS_TempUnit00[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
      • Set FS_TempLoc00[(Player number of (Owner of (Triggering unit)))] = (Position of FS_TempUnit00[(Player number of (Owner of (Triggering unit)))])
      • Unit - Cause (Triggering unit) to damage FS_TempUnit00[(Player number of (Owner of (Triggering unit)))], dealing ((Real((Level of (Ability being cast) for (Triggering unit)))) x 50.00) damage of attack type Spells and damage type Normal
      • Unit - Pause (Triggering unit)
      • Unit - Move (Triggering unit) instantly to FS_TempLoc00[(Player number of (Owner of (Triggering unit)))]
      • Special Effect - Create a special effect at FS_TempLoc00[(Player number of (Owner of (Triggering unit)))] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Move (Triggering unit) instantly to FS_OriginalLoc00[(Player number of (Owner of (Triggering unit)))]
      • Unit - Unpause (Triggering unit)
      • Custom script: call RemoveLocation(udg_FS_OriginalLoc00)
      • Custom script: call RemoveLocation(udg_FS_TempLoc00)

You don't need to know JASS to do it, I barely understand it either.
 
Level 6
Joined
Oct 14, 2010
Messages
58
To the person JNGP is necessary

There is a lot of helpful information(clean leaks, native function, how to convert slowly BJ to useful Native function etc)

With JNGP it is easier to learn Jass. On the simple war3map editor it is difficult to write Jass triggers.

In JNGP there is an illumination of the main words, it is very useful and facilitates work
 
Level 14
Joined
Dec 29, 2009
Messages
931
This is all I had to do?

  • Custom script: call RemoveLocation(udg_FS_OriginalLoc00[(Player number of (Owner of (Triggering unit)))])
  • Custom script: call RemoveLocation(udg_FS_TempLoc00[[(Player number of (Owner of (Triggering unit)))])
EDIT: Nope, new error message.
 
Level 8
Joined
Aug 2, 2008
Messages
193
JASS:
call RemoveLocation(udg_FS_OriginalLoc00[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])

call RemoveLocation(udg_FS_TempLoc00[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])

Copy those 2 lines as a custom script and it should work properly. :)

For each line one custom script of course.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
Honestly GUI is totally usless. Atleast JASS adopts some elements of programming languages into it. If you can program python scripts you should have no problem learning JASS.

like all languages, arrays taken an intiger "index" which runs from 0 to max array size (in jass that is 8191). You are permited to insert any statement into the index field of an array which outputs an integer.

yourarray[0]
is a statement which reuturns element 0 from yourarray.

yourarray[88/3]
is a statement which reuturns element 88/3 (29) from yourarray.

In GUI, to avoid name space collisions the globlas have a prefix of udg_ on them.

a variable called yourarray in GUI is actually called udg_yourarray.

Unless you learn or understand how this stuff works, you will be unable to make good maps in WC3.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I don't know jass, nor do I know how to use it. I'm assuming that function is for the trigger you posted, so I shall post my own trigger.

  • FS Run
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Feared Strike
    • Actions
      • Set FS_OriginalLoc00[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Set FS_TempUnit00[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
      • Set FS_TempLoc00[(Player number of (Owner of (Triggering unit)))] = (Position of FS_TempUnit00[(Player number of (Owner of (Triggering unit)))])
      • Unit - Cause (Triggering unit) to damage FS_TempUnit00[(Player number of (Owner of (Triggering unit)))], dealing ((Real((Level of (Ability being cast) for (Triggering unit)))) x 50.00) damage of attack type Spells and damage type Normal
      • Unit - Pause (Triggering unit)
      • Unit - Move (Triggering unit) instantly to FS_TempLoc00[(Player number of (Owner of (Triggering unit)))]
      • Special Effect - Create a special effect at FS_TempLoc00[(Player number of (Owner of (Triggering unit)))] using Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl
      • Special Effect - Destroy (Last created special effect)
      • Animation - Play (Triggering unit)'s attack animation
      • Unit - Move (Triggering unit) instantly to FS_OriginalLoc00[(Player number of (Owner of (Triggering unit)))]
      • Unit - Unpause (Triggering unit)
      • Custom script: call RemoveLocation(udg_FS_OriginalLoc00)
      • Custom script: call RemoveLocation(udg_FS_TempLoc00)

Is this MUI ?
 
Level 8
Joined
Aug 2, 2008
Messages
193
This is only MUI when there is no timer that does something with the variables.
If there is any timer, this Code isn't MUI, but MPI, meaning just one unit per player can be affected.
And btw, Gui will be converted to Jass anyway, but the code, the editor creates is ugly and stupid as hell...
Learning Jass or vJass should solve this problem... :ogre_haosis:
 
Status
Not open for further replies.
Top