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

[JASS] No Problem = A Problem

Status
Not open for further replies.
Level 6
Joined
Oct 10, 2009
Messages
1,425
FIXED
thanks to watermelon_1234

well, i have a vJass trigger that has no errors in it that JNPG can pick up, but when i enable it i cannot test my map. WE crashes... anybody know why?

JASS:
function Trig_CreateUnitByChat_Actions takes nothing returns nothing
    local integer i = 0
    loop
        call CreateUnitByName(Player(1),GetEventPlayerChatString(),87.8,907.3,90)
        set i = i + 1
        exitwhen i == 13
    endloop
endfunction

//===========================================================================
function InitTrig_CreateUnitByChat takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(t,Player(0),"",false)
    call TriggerAddAction(t, function Trig_CreateUnitByChat_Actions)
endfunction

+Rep and a big thanks to whoever helps or fixes :/
 
Last edited:
Level 14
Joined
Nov 18, 2007
Messages
1,084
The code works fine for me as well. Do you think there might be another trigger that conflicts with this?

On an unrelated note:
JASS:
function Trig_CreateUnitByChat_Actions takes nothing returns nothing
    local integer i = 0
    loop
        call CreateUnitByName(Player(1),GetEventPlayerChatString(),87.8,907.3,90)
        set i = i + 1
        exitwhen i == 13
    endloop
endfunction

//===========================================================================
function InitTrig_CreateUnitByChat takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterPlayerChatEvent(t,Player(0),"",false)
    call TriggerAddAction(t, function Trig_CreateUnitByChat_Actions)
endfunction
Using a loop is much better than manually copying the function 13 times.

On an even more unrelated note: Please don't use rainbow tags for stating your problem.
 
Level 6
Joined
Oct 10, 2009
Messages
1,425
Hm, I phrased that badly. What I meant: The trigger seems to work fine for me, so I think something else (As in not what the code is actually doing) might be causing the problem.

Do you know what error it is exactly? Is it just a crash?

Try using my code. Make sure the trigger name is CreateUnitsByChat.


and well i tried enabling/disabling all my triggers until i got it down to just this one trigger causing it.

i phrased my "crash" bad as well, very bad:p whenever i go to test it, it brings up the wc3 home screen. no map. and if i try to go to it via create custom game it wont let me.

ahh, [rainbow]I LOVE YOU[/rainbow] J/K:grin: but seriouly Thanks a lot.(for optimising as well:p) and yes, now i see why it wasnt working, WE is very picky:p simple name messed everything up:ugly: but anyways thanks and +rep :wsmile:
 
Status
Not open for further replies.
Top