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

[Trigger] Custom script help needed

Status
Not open for further replies.
Level 11
Joined
May 31, 2008
Messages
698
I need to know how to remove these variables via custom script:

Pulse_Caster_Point[(Player number of (Owner of Pulse_Caster[(Player number of (Owner of (Triggering unit)))]))]

Pulse_Target_Point[(Player number of (Owner of (Picked unit)))]

Pulse_Move[(Player number of (Owner of (Picked unit)))]

I especially need help with the first one. I dont think that the values matter. All of these variables are point arrays. +Rep for help thanks in advance.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
Im cute and I have a great solution for you
Make a variable called TEMPLOC
and make it like
TEMPLOC = <Another Location Variable>
Custom script: call RemoveLocation(udg_TEMPLOC)

That will make the Location pointed by <Another Location Variable> you put there removed
 
Level 11
Joined
May 31, 2008
Messages
698
Come on guys pls read what i said and understand it before you respond. I dont want to turn the trigger off because i still need it throughout the entire map. And i dont think that will even remove the leaks. And Need_O2 if i could use a variable as simple as that dont you think i would?? I am using arrays for a reason, i kno how to remove simple variables like that but im not that experienced with jass or custom script or whatever and i dont know how to remove all array type variables. So someone please help me!
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
no no you dont understand

Set TEMPLOC to
Pulse_Caster_Point[(Player number of (Owner of Pulse_Caster[(Player number of (Owner of (Triggering unit)))]))]
Custom script: call RemoveLocation(udg_TEMPLOC)

This will remove
Pulse_Caster_Point[(Player number of (Owner of Pulse_Caster[(Player number of (Owner of (Triggering unit)))]))]



Locations are like units, they are existances
When you say
Blabla[Player Number of (Owner of Someone)] = Position of Someunit, a new Location gets created
The function of variable here is to point it, I mean When I call Blabla[Player Number of (Owner of Someone)] it will point me to the Location which is created there
When I say
SomelocationVariable = Blabla[Player Number of (Owner of Someone)]
Now SomelocationVariable ALSO points the same location
And When I say call RemoveLocation(SomelocationVariable) the location these both variables are pointing gets removed
So also Blabla[Player Number of (Owner of Someone)] gets removed
so no leaks

I dont know how else can I explain it but if you ask other users with avarage or more trigger experince, they will agree with this
 
Level 11
Joined
May 31, 2008
Messages
698
So you want me to set 2 locations?? If i do that then it is no longer an array and i will still have to remove the first one. This trigger runs every .01 seconds and it is for an ability so there can be multiple locations at one time. So if i try and set the array of locations to one location i dont think it would work.
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
  • It doesnt matter if its 0.01 or 0.000001
  • Events
    • Time - Every 0.01 seconds
  • Conditions
  • Actions
    • Set Pulse_Caster_Point[(Player number of (Owner of Pulse_Caster[(Player number of (Owner of (Triggering unit)))]))] to (Center of Map)
    • Set TEMPLOC to Pulse_Caster_Point[(Player number of (Owner of Pulse_Caster[(Player number of (Owner of (Triggering unit)))]))]
    • Custom script: call RemoveLocation(udg_TEMPLOC)
    • Set Pulse_Target_Point[(Player number of (Owner of (Picked unit)))] to (somewhere in Nevada)
    • Set TEMPLOC to Pulse_Target_Point[(Player number of (Owner of (Picked unit)))]
    • Custom script: call RemoveLocation(udg_TEMPLOC)
    • Set Pulse_Move[(Player number of (Owner of (Picked unit)))] to (Random Point in Bunny Land)
    • Set TEMPLOC to Pulse_Move[(Player number of (Owner of (Picked unit)))]
    • Custom script: call RemoveLocation(udg_TEMPLOC)
No leaks
 
Level 19
Joined
Aug 24, 2007
Messages
2,888
okay you know what forget it just wait until some pro with higher rep and no doctor octagonapus ( I mean someone "SERIUS") comes and tells you that Im right...
OMFG LOL Ive problems >.<
Anyway kidding

Just read the "I will try to explain it in This way" in Post #5 and you will probably understand
or just ask someone else (why do I even care anyway, oh right I dont like to have ppl around with doing stuff without knowing what they are actually doing, anyway I should stop writing my speechs with myself to everywhere)

P.S. to myself: You suck at joking at late night
 
Level 11
Joined
May 31, 2008
Messages
698
0o0o0o0o0o snap! I think it works. Here is how i tested it if you were wondering:

test
Events
Unit - A unit Begins casting an ability
Conditions
Actions
Set Pulse_Target_Point[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
Set TEMPLOC = Pulse_Target_Point[(Player number of (Owner of (Triggering unit)))]
Unit - Create 1 Footman for Player 1 (Red) at Pulse_Target_Point[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees
Unit - Create 1 Footman for Player 1 (Red) at TEMPLOC facing Default building facing degrees
Custom script: call RemoveLocation(udg_TEMPLOC)
Wait 0.50 seconds
Unit - Create 1 Footman for Player 1 (Red) at TEMPLOC facing Default building facing degrees
Unit - Create 1 Footman for Player 1 (Red) at Pulse_Target_Point[(Player number of (Owner of (Triggering unit)))] facing Default building facing degrees

So for the first footmen it obviously created both, but for second two it didnt create either, therefore the point didnt exist, therefore it was removed, therefore it doesnt leak :D. Thanks very much for the help. Sorry for not believing you lol. Sometimes the things that you can do with triggers just dont seem that logical to me :p Thanks again +REP
 
Level 6
Joined
Jan 27, 2007
Messages
208
well, it seems you solved your problem

but, i`ve question due i have problem like this but solved in different ways...

I have this trigger :
  • Nature Spasm
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to [Forest Keeper]Nature Spasm
    • Actions
      • Set NatureSpasmUnitGroup[(Player number of (Owner of (Triggering unit)))] = (Units in (Entire map) matching ((((Matching unit) has buff Nature Steam ) Equal to True) and ((((Matching unit) belongs to an enemy of (Owner of (Triggering unit))) Equal to True) and (((Matching unit) is alive) Equal to True))))
      • Unit Group - Pick every unit in NatureSpasmUnitGroup[(Player number of (Owner of (Triggering unit)))] and do (Actions)
        • Loop - Actions
          • Unit - Cause (Triggering unit) to damage (Picked unit), dealing ((Real((Intelligence of (Triggering unit) (Include bonuses)))) x 3.00) damage of attack type Spells and damage type Normal
          • Special Effect - Create a special effect attached to the origin of (Picked unit) using Units\NightElf\Wisp\WispExplode.mdl
          • Special Effect - Destroy (Last created special effect)
      • Custom script: call DestroyGroup(udg_NatureSpasmUnitGroup[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
does it leak? since i tried to convert first this trigger into JASS Script and see "[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))]" after variable setting...
 
Level 12
Joined
Dec 10, 2008
Messages
850
Ya that sounds like its correct, GetConvertedPlayerId is the same as your Player number , GetOwningPlayer is the Owner of part, GetTriggerUnit() is the Triggering unit part.
Converting is generaly not a good idea, read some intros to JASS tuts and they should say why.

(Correct me if I'm wrong, but I did only pick up on JASS in the last few days)
 
Status
Not open for further replies.
Top