Anyone can help me with Jass?

Vetadors

New Member
Reaction score
1
I am trying to create a Maze map and i want to create a trigger like that;

Trigger
Events
Unit - A unit enters in a terrain of type <gen>
Conditions
(Unit-type of (Entering unit)) Equal to Peasant
Actions
Unit - Kill (Entering unit)

But i know the only solution of that is to create a Jass trigger! And i dont understand how to use the Jass... If anyone know how to use jass, please can you say me the code for this trigger?? :(
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Which terrain type is it that you want to kill units on when they enter? What player(s) control the hostile creeps etc? Do you have a respawn point?
 

CaptDeath

New Member
Reaction score
103
you can create that kinda trigger w/o jass
just
type <gen>
needs to be the name of a rect
make a rect br pressing r in world editor
 

Charapanga

New Member
Reaction score
46
Why don't you get NewGen and Convert it to custom text
Its in the Edit thingy that stretches down...

for that it would be something like
JASS:
function TrigTrigger_Conditions takes nothing returns boolean 
    return GetUnitTypeId(GetEnteringUnit()) == &#039;hpea&#039;
endfunction

function TrigTrigger_Actions takes nothing returns nothing
    call KillUnit(GetEnteringUnit())
endfunction

function InitTrig_Trigger takes nothing returns nothing
    set gg_trg_Trigger = CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_Trigger, gg_rct_in_a_terrain_of_type)
    call TriggerAddCondition(gg_trg_Trigger, Condition(function TrigTrigger_Conditions))
    call TriggerAddAction(gg_trg_Trigger, function TrigTrigger_Actions)
endfunction


its freehand, untested
 

Vetadors

New Member
Reaction score
1
Which terrain type is it that you want to kill units on when they enter? What player(s) control the hostile creeps etc? Do you have a respawn point?

I dont have any respawn point. I just want to kill the peasant (hero) in my game when he enter in a terrain of type; Ice, Poison or Lava
 

darkbeer

Beer is Good!
Reaction score
84
.... unless you want to do millions of rects use a periodic timer, thats what all maze maps do( at least the ones i know of)

would look like this:

Code:
Events - Every 0.04 seconds
Actions - 
set TempGroup = Units in Playable Map area matching unit is a hero <-- wahtever you need here
Unit Group - For TempGroup do actions 
  - set TempPoint = Position of Picked unit
  - if (Terrain type at TempPoint) Gleich XXX then <-- use  an OR for multiple terrain types
        -- Unit - kill Picked unit
  - Custom script: call RemoveLocaiton(udg_TempPoint)
Custom script: call DestroyGroup(udg_TempGroup)
 

Vetadors

New Member
Reaction score
1
Why don't you get NewGen and Convert it to custom text
Its in the Edit thingy that stretches down...

for that it would be something like
JASS:
function TrigTrigger_Conditions takes nothing returns boolean 
    return GetUnitTypeId(GetEnteringUnit()) == &#039;hpea&#039;
endfunction

function TrigTrigger_Actions takes nothing returns nothing
    call KillUnit(GetEnteringUnit())
endfunction

function InitTrig_Trigger takes nothing returns nothing
    set gg_trg_Trigger = CreateTrigger()
    call TriggerRegisterEnterRectSimple(gg_trg_Trigger, gg_rct_in_a_terrain_of_type)
    call TriggerAddCondition(gg_trg_Trigger, Condition(function TrigTrigger_Conditions))
    call TriggerAddAction(gg_trg_Trigger, function TrigTrigger_Actions)
endfunction


its freehand, untested

I have put your Jass but its say "Trigger 'Jass' has been disabled due to error." when i test the map.
 

darkbeer

Beer is Good!
Reaction score
84
It does.

you only need NewGen for vJass, but seriously you just converted his trigger and added a rect ...

take a look at my post above.
 

Vetadors

New Member
Reaction score
1
.... unless you want to do millions of rects use a periodic timer, thats what all maze maps do( at least the ones i know of)

would look like this:

Code:
Events - Every 0.04 seconds
Actions - 
set TempGroup = Units in Playable Map area matching unit is a hero <-- wahtever you need here
Unit Group - For TempGroup do actions 
  - set TempPoint = Position of Picked unit
  - if (Terrain type at TempPoint) Gleich XXX then <-- use  an OR for multiple terrain types
        -- Unit - kill Picked unit
  - Custom script: call RemoveLocaiton(udg_TempPoint)
Custom script: call DestroyGroup(udg_TempGroup)

I have do your trigger but its say du to error because you have type a error on "- Custom script: call RemoveLocaiton(udg_TempPoint)" I have modified your error to "Location" but still due to error...
 

Azlier

Old World Ghost
Reaction score
461
RemoveLocation

Typos will not be tolerated by JASS! Unacceptable!

Well... there goes my 666 post count.
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
This could be maybe what you're looking for:

Just make sure to create those variables in the variable editor with those exact names.

JASS:
//Requires the following variables:
//
//GlobalN - integer variable
//GlobalUnit - unit array variable
//GlobalTimer - timer array variable
//
//Make sure you have these variables created with those exact names for this to work.

function KillUnitOnTerrain_TerrainType takes real x, real y returns boolean
    //Replace the rawcodes with the ones you have in your map if they do not work.
    if (GetTerrainType(x, y) == &#039;Cpos&#039;) or (GetTerrainType(x, y) == &#039;Nice&#039;) or (GetTerrainType(x, y) == &#039;Dlav&#039;) then
        return true
    endif
    
    return false
endfunction

function KillUnitOnTerrain_CreepPlayer takes nothing returns player
    return Player(12)    //The player owning creeps on your map, Player(0) equal to player 1 red, Player(12) equal to neutral hostile.
endfunction

function KillUnitOnTerrain_Respawn takes nothing returns boolean
    return true    //Set to true if players shall revive.
endfunction

//If there is no respawn, ignore the rest of the functions.

function KillUnitOnTerrain_RespawnTime takes nothing returns real
    return 5.    //Time in seconds that it takes for units to revive.
endfunction

function KillUnitOnTerrain_RespawnX takes nothing returns real
    return -222.    //The X value of the respawn point.
endfunction

function KillUnitOnTerrain_RespawnY takes nothing returns real
    return 280.    //The Y value of the respawn point.
endfunction

//Do not edit anything below here.

function KillUnitOnTerrain_RespawnFunc takes nothing returns nothing
    local integer i = udg_GlobalN
    loop
        exitwhen i &lt;= 0
        if (GetExpiredTimer() == udg_GlobalTimer<i>) then
            call ReviveHero(udg_GlobalUnit<i>, KillUnitOnTerrain_RespawnX(), KillUnitOnTerrain_RespawnY(), true)
            if (GetLocalPlayer() == GetOwningPlayer(udg_GlobalUnit<i>)) then
                call SelectUnit(udg_GlobalUnit<i>, true)
            endif
            
            set udg_GlobalUnit<i> = udg_GlobalUnit[udg_GlobalN]
            set udg_GlobalTimer<i> = udg_GlobalTimer[udg_GlobalN]
            set udg_GlobalN = udg_GlobalN - 1
        endif
        
        set i = i - 1
    endloop
endfunction

function KillUnitOnTerrain_GroupFilter takes nothing returns boolean
    local unit u = GetFilterUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    if KillUnitOnTerrain_TerrainType(x, y) and (GetOwningPlayer(u) != KillUnitOnTerrain_CreepPlayer()) and (GetWidgetLife(u) &gt; .405) then
        call KillUnit(u)
        if KillUnitOnTerrain_Respawn() then
            set udg_GlobalN = udg_GlobalN + 1
            set udg_GlobalUnit[udg_GlobalN] = u
            
            call TimerStart(udg_GlobalTimer[udg_GlobalN], KillUnitOnTerrain_RespawnTime(), false, function KillUnitOnTerrain_RespawnFunc)
        endif
    endif
    
    set u = null
    
    return false
endfunction

function KillUnitOnTerrain_Callback takes nothing returns nothing
    local group g = CreateGroup()
    
    call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, Filter(function KillUnitOnTerrain_GroupFilter))
    call DestroyGroup(g)
    
    set g = null
endfunction

function InitTrig_KillUnitOnTerrain takes nothing returns nothing
    call TimerStart(CreateTimer(), 0.03125, true, function KillUnitOnTerrain_Callback)
endfunction</i></i></i></i></i></i>
 

Vetadors

New Member
Reaction score
1
I do your Jass and i got a error;

Its say " The Trigger 'Jass' must have an initialization fonction called 'InitTrig_Jass' "

So i put 'InitTrig_Jass' in the trigger but after that, its say "'1 Compile error' Expected end of line"
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Is the trigger named exactly like this: KillUnitOnTerrain

Nothing additional, it must be named exactly like that.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1
  • The Helper The Helper:
    New recipe is another summer dessert Berry and Peach Cheesecake - https://www.thehelper.net/threads/recipe-berry-and-peach-cheesecake.194169/

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top