| 05-12-2009, 06:05 PM | #1 |
All right, to begin, I am a complete "newbie" at Jassing, so please try to keep it as simple as possible when trying to help me. Anyways, my problem is relatively simple, I guess. I have a trigger called NewTrigger, just for learning purposes. JASS:globals quest q = CreateQuest() endglobals function Trig_NewTrigger_Actions takes nothing returns nothing call QuestSetTitle(q,"Title") call QuestSetDescription(q,"QuestDesc.") endfunction function InitTrig_NewTrigger takes nothing returns nothing set gg_trg_NewTrigger = CreateTrigger() call TriggerAddAction(gg_trg_NewTrigger, function Trig_NewTrigger_Actions) endfunction I am using JNGP, if that matters. Any help would be greatly appreciated, thanks in advance. |
| 05-12-2009, 06:11 PM | #2 |
Do this: JASS:function InitTrig_NewTrigger takes nothing returns nothing local trigger t = CreateTrigger() call TriggerAddAction(t, function Trig_NewTrigger_Actions) set t = null endfunction |
| 05-12-2009, 06:14 PM | #3 |
The syntax checker now says it works, but the map crashes before even load, saying something like: "FATAL ERROR ... Memory could not be read." |
| 05-12-2009, 06:55 PM | #4 |
weird... I'm pretty sure it's in other part of the code. EDIT: The problem is taht you're setting the quest at map init, and this can't be done in that stage, you should do something like this: JASS:globals quest q = CreateQuest() endglobals function Trig_NewTrigger_Actions takes nothing returns nothing call QuestSetTitle(q,"Title") call QuestSetDescription(q,"QuestDesc.") call DestroyTimer(GetExpiredTimer()) endfunction function InitTrig_NewTrigger takes nothing returns nothing call TimerStart(CreateTimer(), 0.1, false, function Trig_NewTrigger_Actions) endfunction |
| 05-12-2009, 07:17 PM | #5 |
Using your code moyack, still same problem. :/ "This application has encountered a critical error: FATAL ERROR! Program: C:\Program Files\Warcraft III\War3.exe Exception: 0xC00000005 (ACCESS_VIOLATION) at 001B:6F475270 The instruction at '0x6F465270' referenced memory at '0x00000010c'. The memory could not be 'read'. Press OK to terminate the application." |
| 05-12-2009, 07:40 PM | #6 |
Try this then: JASS:globals quest q endglobals function Trig_NewTrigger_Actions takes nothing returns nothing set q = CreateQuest() call QuestSetTitle(q,"Title") call QuestSetDescription(q,"QuestDesc.") call DestroyTimer(GetExpiredTimer()) endfunction function InitTrig_NewTrigger takes nothing returns nothing call TimerStart(CreateTimer(), 0.1, false, function Trig_NewTrigger_Actions) endfunction |
| 05-12-2009, 07:49 PM | #7 |
It's safer to pause timers before destroying them... JASS:globals quest q endglobals function Trig_NewTrigger_Actions takes nothing returns nothing set q = CreateQuest() call QuestSetTitle(q,"Title") call QuestSetDescription(q,"QuestDesc.") call PauseTimer(GetExpiredTimer()) call DestroyTimer(GetExpiredTimer()) endfunction function InitTrig_NewTrigger takes nothing returns nothing call TimerStart(CreateTimer(), 0.1, false, function Trig_NewTrigger_Actions) endfunction |
| 05-12-2009, 09:40 PM | #8 | |
Quote:
@Linaze: Could you disable the trigger and run the game? just to ensure this trigger is the cause. |
| 05-13-2009, 02:50 AM | #9 | |
Quote:
EDIT: Moyack, I'm pretty sure you can create quests at map init.. Just tested the original code and it's crashing because you're creating the quest in the global declaration. This works fine though: JASS:globals quest q endglobals function Trig_NewTrigger_Actions takes nothing returns nothing set q=CreateQuest() call QuestSetTitle(q,"Title") call QuestSetDescription(q,"QuestDesc.") endfunction function InitTrig_NewTrigger takes nothing returns nothing set gg_trg_NewTrigger = CreateTrigger() call TriggerAddAction(gg_trg_NewTrigger, function Trig_NewTrigger_Actions) endfunction |
| 05-13-2009, 03:27 AM | #10 |
I don't see how that's working fine, since there's no event to trigger those actions... Meh, if you say it works, I guess it works. |
| 05-13-2009, 03:41 AM | #11 |
I think he ticked run at map initialization. |
| 05-13-2009, 03:47 AM | #12 |
well, he could call Triggerexceute somehwere |
