OMG I Have A Question!!!

Darg

Administrator
Reaction score
51
I'm currently working on the local variable death trigger thing for darkassaisin, but I've hit a bump.

Can someone paste this code into a trigger in a blank map and tell me what I'm doing wrong:

Code:
function Trig_a_unit_dies_Actions takes nothing returns nothing
    local unittype udg_DeadUnitType
    local location udg_DeadUnitLocation
    local player udg_DeadUnitOwner
    set udg_DeadUnitType = GetUnitTypeId(GetDyingUnit())
    set udg_DeadUnitLocation = GetUnitLoc(GetDyingUnit())
    set udg_DeadUnitOwner = GetOwningPlayer(GetDyingUnit())
    call TriggerSleepAction( 60.00 )
    call CreateNUnitsAtLoc( 1, udg_DeadUnitType, udg_DeadUnitOwner, udg_DeadUnitLocation, bj_UNIT_FACING )

//===========================================================================
function InitTrig_a_unit_dies takes nothing returns nothing
    set gg_trg_a_unit_dies = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_a_unit_dies, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_a_unit_dies, function Trig_a_unit_dies_Actions )
endfunction

The map doesn't like my local variable declaration of the unit-type and I don't know why (that's the first line in the trigger if you can't see it)

maybe sats you can work on this thing while I work on your thing hehe :)
 
Ohhhh man.
Darg, you`re supposed to be the guy with all the answers around here hehe.

K Ill give it a shot, but no promises. I, well... uhh... Im not really that good with JASS. But Ill do my best.

Whats the trigger supposed to do anyway?
 
Ok, I wont pretend I have any idea how to fix this, but...
I was thinking, why do you need local variables. Couldnt you just
pass what they are supposed to be directly into the function
"call CreateNUnitsAtLoc" ?

And what does the "TriggerSleepAction" do?
 
yeah its my fault, I should have explained what the thing does hehe :)

When any unit dies, the trigger waits 60 secs, and then creates another unit of the same type at the same place that other unit died.

Local variables are needed beacuse many units might die at the one time.

TriggerSleepAction = wait

CreateNUnitsAtLoc = create N <unit-type> at <some location> facing <some angle>

AddSpecialEffectTargetUnitBJ = add special effect attached to unit
 
Ehhh, Darg...
I think I did it, but... lol I used GUI
A unit dies
Events
Unit - A unit Dies
Conditions
Actions
Wait 25.00 seconds
Unit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at (Position of (Triggering unit)) facing Default building facing degrees

Anyway, you still wouldnt need variables, couse when ever a trigger runs its treated as a seperate trigger, as it seems.

Stop smashing your head to the wall, its not worth it ;)
 
ok you're right, guess I'm a dumbass for not testing it.

I put the wait at 120 seconds (as per what darkassaisin wants), and it also worked. This is a good thing, because it meant that the trigger still kept the unit information in there well after the unit's corpse had disappeared from the battlefield.

so here is the trigger for you darkassasin:

Code:
someone dies
    Events
        Unit - A unit Dies
    Conditions
    Actions
        Game - Display to (All players) for 3.00 seconds the text: dead
        Wait 120.00 game-time seconds
        Game - Display to (All players) for 3.00 seconds the text: life
        Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit)) 
        at (Position of (Dying unit)) 
        facing Default building facing degrees
 
An interesting thing I've found out is that declaring more than 1 local global variable in the one trigger can't be done, its a bug which makes the game crash.

e.g.
Code:
someone dies
    Events
        Unit - A unit Dies
    Conditions
    Actions
        Custom script:   local integer udg_DeadUnitType
        Set DeadUnitType = (Unit-type of (Dying unit))
is ok.
Code:
someone dies
    Events
        Unit - A unit Dies
    Conditions
    Actions
        Custom script:   local integer udg_DeadUnitType
        Custom script:   local location udg_DeadUnitLocation
        Set DeadUnitType = (Unit-type of (Dying unit))
        Set DeadUnitLocation = (Position of (Dying unit))
crashes the game.
 
thanks but should i use it if it crashes it? and u cussed i m gonna report u to a mod lol u r a mod but really do i use that trigger?
 
it crashes it becausesATaRa told me that if a gate is open it is dead and there r many open gates on there and it keeps doing the trigger till it crashses i had a problem similar to this when Du had a map when u step in a region it transports u to another region which transports u back to the other one so it was going back and forth till it crashed same here the gates keep being remade
 
Well why would this have anything to do with gates? Am I missing something?
This trigger should work just fine:

code:-----------------------------------------------------------------------------
someone dies
Events
Unit - A unit Dies
Conditions
Actions
Game - Display to (All players) for 3.00 seconds the text: dead
Wait 120.00 game-time seconds
Game - Display to (All players) for 3.00 seconds the text: life
Unit - Create 1 (Unit-type of (Dying unit)) for (Owner of (Dying unit))
at (Position of (Dying unit))
facing Default building facing degrees

Although I`ve noticed that it doesnt work for flying units, at least it didnt when I tested it.
 
Originally posted by sATARa

Although I`ve noticed that it doesnt work for flying units, at least it didnt when I tested it.

Um... I think thats because of the decay time. While a unit decays, it still qualifies for 'dying unit' in the trigger code. You can still manipulate it.

Flyers die fast and hard. Therefore, 120 seconds later, the dying unit is gone and no longer applies.

I had some trouble in that area. I had to use a unit store.

Set unit_type = Unit type of (dying unit)

Then later say....

Create 1 unit_type.....

Etc.
 
no variables!

Flyers die fast and hard. Therefore, 120 seconds later, the dying unit is gone and no longer applies.

You missed my previous comment Ryoko:

I put the wait at 120 seconds (as per what darkassaisin wants), and it also worked. This is a good thing, because it meant that the trigger still kept the unit information in there well after the unit's corpse had disappeared from the battlefield.

I'm pretty sure the reason it doesn't work for flying units is because flying units don't leave corpses. As you said, they die "fast and hard". Can anyone verify that a spell like animate dead can resurrect flyers? I can't remember if it can or not.

Oh yeah, and the "magical" property that sets apart flying units from ground units is the absence of a "decay" animation. Check the animations for yourself, you'll notice all flyers don't decay.
 
ok a few things sATARa, the trigger u used was the same as the trigger i had before but i will check and do it agin, and i m not going to put flying units in my map cause many of the units r melee and i decided to change the wait time to 60 seconds which may help and can i use the trigger that sATARa made or r we not done finding one yet?
 
Ok, to avoid any confusion here`s what you do...
First of all, this has nothing to do with gates, use those triggers freely as I showed you before.
This trigger should work just fine, and do what Darg told me it should do...

A unit dies
Events
Unit - A unit Dies
Conditions
Actions
Wait 60.00 seconds
Unit - Create 1 (Unit-type of (Triggering unit)) for (Triggering player) at (Position of (Triggering unit)) facing Default building facing degrees

I think you must use the triggering unit n triggering player insted of dying unit, because many units die... but Im not sure, I havent tried it.
Just use the above trigger, and add some of the text stuff and effects if you like.
 
Memory Usage? Observation..

Since as you say the units are stored in memory well after the corpse is removed from the battlefield.. would this over time of a spawning type map slowly create a huge memory storage and cause problems with lag/server splits?
 
A unit is stored in memory as long as its corpse exists. Once it disappears, the unit is removed from memory. The only time it stays in memory, is if it was created by a trigger action "create unit..." ... but in that case after the unit corpse decays, the unit itself becomes untrackable, meaning "lost in memory". In other words, a memory leak.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Varine Varine:
    Today I had to scramble, I didn't work most of dinner service and no one told me shit. They had a rough few hours lol
  • Varine Varine:
    I have two salmon, Sockeye and Atlantic. Atlantic is used for the kids salmon and the salmon and beet salad, and can also be added onto any dish or just as a side. Atlantic salmon will almost exclusively ever be FARMED, as it is endangered in the wild, and we ALWAYS cut them to 4 ounces.
  • Varine Varine:
    SOCKEYE salmon, very different and this IS wild caught. We have an ENTREE version, and an add on version. The entree is 7 ounces, the add on is 4. Why? Because that is how someone that wasn't me set up the computer.
  • Varine Varine:
    I had to have this conversation like ten fucking times tonight
  • Varine Varine:
    The issue being, I came into work and had none of this whatsoever
  • Varine Varine:
    No one told me shit
  • Varine Varine:
    So, taking into consideration that what I typed out up there is kind of some fucking nonsense that under normal circumstances no one really needs to fucking be able to explain in any rational way
  • Varine Varine:
    Let alone trying to figure it out from a wildly stressed out me that is also on a phone call trying to get something to show up from Seattle tomorrow while trying to explain this salmon situation, that also is barely solved in maybe a few hours and and but I am bulking it with a few steelhead filets I have and that is a WHOLE fucking different thing to the 19 year old server that got put on day shift C crew that doesn't know who I am.
  • Varine Varine:
    I did however really want days. I like getting off at 4 half the time, and that makes it worth it!
  • Varine Varine:
    Also I hate my job right now but I think that was the hard part. Now it's just work
  • Varine Varine:
    @jonas I'm sorry? I don't know what you're referring to.
  • Varine Varine:
    Once we hit winter I feel like I get to back to having a pretty cool job. Like I bitch about it all the time, but it's work. I'm still gonna bitch
  • Varine Varine:
    All in all though I think this summer is going really well. Some complicated things, but at the end of the day it isn't THAT big of a deal. Not all of our servers have quite realized they are technically sales
  • Varine Varine:
    Like yeah it is a substitute, but FOMO. Chef isn't getting this again this year, he has to figure it out, so it's slightly off on the menu, but that is more or less the LOWEST quality and price. Right now, steelhead is a real stealhear, right?
  • Varine Varine:
    Like fuck off even I can do it
  • Varine Varine:
    I am going to get one of my servers to do that in her server voice and you'll see my point
  • Varine Varine:
    Maybe the bartender. Idk, it's one of my favorite things to hear them go from calm to customer service voice. They will translate it to like "The chef is trying to change that a bit right now so he does have a Alaskan river steelhead. Yeah like the one you might fish probably!" And then the girls can bat their eyes and do pretty girl server shit
  • Varine Varine:
    At least that's how imagine some of them. Did you know mayonnaise is dairy free? A suprisingly amount of people don't\
  • The Helper The Helper:
    mayo is eggs right?
  • The Helper The Helper:
    Seems I never watched the Witcher - looks like i have a lot of content
  • The Helper The Helper:
    Season 1 Episode 8 the marathon continues...
  • jonas jonas:
    mayo is eggs & oil
    +1
  • The Helper The Helper:
    I got halfway season 2 on The Witcher and it lost me. I am going to have to pick this one up again later.
  • jonas jonas:
    season 2 is with the new actor right? it's so far below the first one
  • The Helper The Helper:
    first season was good the 2nd season is bleh I hope I can make it through it for 3

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top