| 06-19-2003, 08:36 PM | #31 |
Uhm... That problem just went away, I did as I usually do... write the code a little different, but really the same, and it just went away... Now I get a crash when I call GetCreepCamp instead. 0_o Does anyone know if GetCreepCamp expect some else function to be called before itself? This is my main method. Code:
function main takes nothing returns nothing
local unit creep
local boolean fighting = false
call Sleep(3)
call InitAI()
loop
call ClearHarvestAI()
call HarvestGold(0, 3)
call HarvestWood(0, GetUnitCountDone('hpea'))
call considerProduce('hpea')
call considerProduce('hhou')
call considerProduce('hlum')
call considerProduce('hfoo')
call considerProduce('hbar')
call considerProduce('halt')
call considerProduce('Hpal')
call considerProduce('hwtw')
call considerProduce('hgtw')
if not fighting and GetUnitCountDone('hfoo') > 7 then
call print("Trying to fight something in 60 sec" )
call Sleep(60)
set fighting = true
call print("Getting creep camp, this will make it crash!" )
call Sleep(10)
set creep = GetCreepCamp(1,6,false) // Major crash here. :-(
call print("InitAssault" )
call Sleep(10)
call InitAssault()
call print("AddAssault" )
call Sleep(10)
call AddAssault(GetUnitCountDone('hfoo'), 'hfoo')
call print("AddAssault" )
call Sleep(10)
call AddAssault(GetUnitCountDone('Hpal'), 'Hpal')
call print("Attack" )
call Sleep(10)
call AttackMoveXY(R2I(GetUnitX(creep)), R2I(GetUnitY(creep)))
call print("Attacking" )
endif
call Sleep(3)
endloop
endfunctionspecified unit is a good idea, if it think it is, it tries to produce it, with SetProduce(). This is my first try on actually getting my units to fight anything specific, so all could very possibly be totally wrong. :bangH: |
| 06-19-2003, 08:53 PM | #32 |
I have used GetCreepCamp quite extensively and never got a crash with it. It all looks pretty correct. Does the crash disappear when you comment out that GetCreepCamp line ? |
| 06-19-2003, 10:17 PM | #33 |
This is madness! One would probably be better of if one took a class in black magic before starting to create programs. ://// My code still has problems creating footmen... but when I manage to convince it to create a footman for real and having commented out GetCreepCamp, it crashes on InitAssault instead... :cuss: I guess that I have to rewrite it from scratch just to make sure what it is that makes it freak out. But that'll not be today... Maybe it's time to investigate AMAI a bit further to see how managed to convince WC not to freak out. |
| 06-19-2003, 10:38 PM | #34 |
Maybe your print function has some problem. Did you comment that out too when you commented out GetCreepCamp? |
| 06-21-2003, 05:35 PM | #35 |
I haven't tried to comment out my prints... but if they don't work I am in great trouble. Code:
function print takes string mess returns nothing call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 600, mess) endfunction Does someone know how to convince the Syntax Checker from http://jass.sourceforge.net to use a different common.ai when parsing ai scripts? |
| 06-21-2003, 05:54 PM | #36 |
Looks correct. Pretty strange :/ To use another common.ai with the syntax checker just copy the new common.ai in the Scripts subfolder of the checker overwriting the old one (make a backup if you don't want to lose it) |
| 06-21-2003, 06:13 PM | #37 |
But that would be way to easy. :gsmile: |
| 06-24-2003, 10:10 AM | #38 | |
Could someone show me a minimal working script that uses GetCreepCamp? My code just crashes WC. :( Code:
function main takes nothing returns nothing
local unit u
call Sleep(3)
set u = GetCreepCamp(1,9,false)
call Sleep(3)
endfunctionCode:
function main takes nothing returns nothing
local unit u = GetCreepCamp(1,9,false)
endfunctionQuote:
I would be happy if someone could try if it's the code that is wrong or if it's my installation. |
| 06-24-2003, 10:52 AM | #39 |
Don't ask me way (but please do explain), but this code actually works, no crash at least. GetMinorCreep() just calls GetCreepCamp... Code:
function peonThread takes nothing returns nothing
loop
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 3600, "peon")
call SetProduce(2, 'hpea', 0)
call SetProduce(1, 'hhou', 0)
call Sleep(15)
endloop
endfunction
function attackThread takes nothing returns nothing
local unit u
loop
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 3600, "attack")
call Sleep(5)
set u = GetMinorCreep()
endloop
endfunction
//======================================================================
function main takes nothing returns nothing
call Sleep(3)
call StandardAI(null, function peonThread, function attackThread)
endfunction |
| 07-26-2003, 10:30 PM | #40 |
How do you know all those function, how do you use it to make spells or improve spells? |
| 07-27-2003, 11:57 AM | #41 |
The functions can be found in common.j and common.ai. I know nothing of spell making though. |
| 08-04-2003, 09:02 PM | #42 |
Hey, Im trying to learn JASS to improve my triggering, but... Its hard... I understand some things, but soem dont make any sense to me, so Id like to show u a trigger in JASS and have sumone explain to me the things I make red, plz! function Trig_JASS_Test_Func001001 takes nothing returns boolean return ( GetUnitTypeId(GetDyingUnit()) == 'ngst' ) endfunction function Trig_JASS_Test_Func001002002 takes nothing returns nothing call KillDestructable( GetEnumDestructable () ) endfunction function Trig_JASS_Test_Actions takes nothing returns nothing if ( Trig_JASS_Test_Func001001() ) then call EnumDestructablesInRectAll ( gg_rct _Treez, function Trig_JASS_Test_Func001002002 ) else call DoNothing( ) endif endfunction //=========================================================================== function InitTrig_JASS_Test takes nothing returns nothing set gg_trg_JASS_Test = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_JASS_Test, EVENT_PLAYER_UNIT_DEATH ) call TriggerAddAction( gg_trg_JASS_Test, function Trig_JASS_Test_Actions ) endfunction Ok, about Takes nothing, what COULD it take, I dont get it.. Nothing seems to ever take anything About the ( )'s after certain things, what are those? And if I were making a trigger from scratch, how wud I know where to put one, Or wud I need to put the,? About the GG_Rct_ thing, I dont get it, Im sure rct means region right? But what is the GG?? About the getenumdestructable... Whats that mean? Finally, about enumdestructiblesinrectall What does enum mean, and tell me if Im right about this, that means it gets all destructibles in the region it will mention next, right?? Edit:What does BJ mean? Is that specific to the event?? Thanks in advance |
| 08-08-2003, 12:09 PM | #43 |
takes nothing: Means that the function doesn't take any parameters. you call it using: call MyFunction() if it would say: take integer I you would call it using: call MyFunc(1) or whatever Number you want to use gg_rct_Trees refers the Region you created in WE called "Trees" gg_rct is just a preset, there are also other priesets: udg_X = The global Variable called X Units, Destructables, Sounds ..... call EnumDestructablesInRectAll ( gg_rct _Treez, function Trig_JASS_Test_Func001002002 ) This call will execute the function Trig_JASS_Test_Func... for all Destructables in your region. GetEnumDestructalbe() then gets the Destructable for which the Function is currently running (it will be executed for every singel destructable in the region) |
| 08-16-2003, 03:43 PM | #44 |
now that the expansion came out an ai editor is included i dont know what to do with it can i get some help???:D :foot: 8) ;) :ggani: :gsmile: :mtk: :infth: :guns: :lch: |
| 09-20-2003, 03:53 PM | #45 |
hrmmm i wanted to create this custom ability of mine, it involves of creating certain actions when the hero learns a specific custom ability, the problem is, the custom's were not listed in the trigger editor ://// , and so i tried to experiment with converting it to custom scripts :bgrun: , well i tried changin the ' Aamk ' part of the script into ' A00K:Aamk ' which is the new custom ability's raw data name, well, it doesn't work :( , when i tried to save it some huge amount of lists of errors in scripting comes ://// , when i test the map the game wont start, the thing just went back to menu ://// , i think it's because i used a map that is created with the france version of the map editor :bgrun: , i used that map to test my spells because the spawn triggers and the terraining was set very nicely for spell testing, the map was made by my friend and i just picked it randomly to test my ideas for custom abilities, was it because the map was made in france version of the map editor :(??? or did i do something wrong? emote_confused |
