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

Script not running on a specific map

Status
Not open for further replies.
Level 1
Joined
Jul 15, 2019
Messages
6
Greerings,
sorry to bother you, but after a weekend of headache i finally decided to ask for help.

I recently updated my WC3 to 1.31 and started working on a new campaign. However, my creation of first mission got stuck, when the game seemingly refused to accept my scripts.

- AI players are human with preset units (some custom, but they don't need to use them) and the scripts are very simple: just simulate gathering and create a small defence group.

- I tried rewriting the script several times, erasing and adding lines, but the result is still the same.

- I attached these scripts to triggers, which are activated by writing a message. No effect. I tried quickly creating another map outside the campaign to test it. There, the AI started mining gold immedeately (why?), and then, after triggering the script, started acting accordingly.

- I tried creating a new script through AI editor (to prevent syntax errors) and triggering it in similar way, yet, still no effect.

- I even tried to remove all the custom units, both from the map and the script. Guess what? :/

So, please, do you have any idea what might cause my problem?

(... i'll attach the script once i learn how to do it.)
 
Level 1
Joined
Jul 15, 2019
Messages
6
Thank you, dear sir. You see, i'm quite new to this forum. :)

So... as i said, nothing extra. Just defining units (which are not needed anyway so far) and basic setting.

JASS:
//============================================================================
//  LWC 01 - Universal script for villages
//============================================================================
globals
    player Daelin = Player(0)
    constant integer SKIRMISHER   = 'n604' // Grunt
    constant integer SPEARMAN     = 'n605' // Spearman
    constant integer GOLEM        = 'n607' // Golem
    constant integer WORKER       = 'h600' // Self-explanatory
    constant integer TENT         = 'n606' // Farma
    constant integer CHAPLAIN     = 'n600' // Priest
    constant integer TOWER        = 'o600'
    constant integer CAMP         = 'n602'
endglobals

//============================================================================
//  main
//============================================================================
function main takes nothing returns nothing

    call CampaignAI(HOUSE,null)
    call SetReplacements(1,1,3)
    call SetPeonsRepair(false)
    set do_campaign_farms = false
call ClearHarvestAI()
    set campaign_wood_peons = 2
    set campaign_gold_peons = 3

    call CampaignDefenderEx( 3,3,3, FOOTMAN         )
   call CampaignDefenderEx( 1,1,2, RIFLEMAN    )
endfunction
 
Level 1
Joined
Jul 15, 2019
Messages
6
Update:
I've added a second map to that campaign and tried the same script there - nothing. It seems the problem is within campaign itself, but... what could it be? I have a campaign i created few years ago with its own custom scripts, and it works fine.
 
Level 1
Joined
Jul 15, 2019
Messages
6
Do these scripts work in non-campaign (standalone) maps? If so it might be a bug with file paths and the campaign maps are trying to look for the files in the wrong place.
Thank you for your concern. Yes, the very same script worked in a standalone map. The actual problem seems to be my campaign not accepting any scripts. Do you know how should i solve this problem?
 
Level 1
Joined
Jul 15, 2019
Messages
6
Perhaps you have the same problem mentioned here: [code=jass] - JASS AI only works in a standalone map
Well. I've read your conversation and did what you suggested to him, and it seems that 'fixed player settings' did the trick. I knew it has something to do with map settings, i just didn't consider this important. Thank you very much, it's nice to know one can find helpful guys when he needs them. :)

... btw, do you know why does computer start gathering resources even before receiving any script?
 
Level 12
Joined
Jun 15, 2016
Messages
472
Not really. I can tell you it doesn't always happen.

Since all it takes for peons to start harvesting is one order, maybe there's some default behavior that makes the AI do something. Otherwise, maybe your script actually started but crashed when calling one of the set AI natives, who knows.
 
Level 1
Joined
Jul 15, 2019
Messages
6
Seems i'll side with your 'default behaviour' hypothesis. Otherwise the AI had no reason to start doing anything before i triggered the script.
Anyway... i'll just ignore it and be glad that it finally works.
 
Status
Not open for further replies.
Top