scripting problem


(morphdoc) #1

Hi guys, I have a problem with scripting…

// ENABLE NEW SPAWN
  trigger cp_spawn_wobj on
  
  // If first time, then set new spawn as default
  accum 4 abort_if_equal 1
  accum 2 set 1      
  
  setautospawn    "CP Spawn"   1

somewhere earlier there is a command

accum 4 set 1

when objective 4 is completed.

Basically, I want the script to abort setautospawn “CP Spawn” when objective 4 is completed before objective 2 (build CP)

and I can’t work this out…clearly, once the obj 4 is completed, command is triggered: accum 4 set 1

but when I build the CP, the “setautospawn CP” is triggered… even tho it says accum 4 abort_if_equal 1

HELP!


(stealth6) #2

Most likely you’re trying to use a local accum as a global accum. Global accum can be accessed from anywhere in the script, local only in the same code block if that makes any sense.

http://games.chruker.dk/enemy_territory/scripting_reference.php#accum_registers


(morphdoc) #3

Thanks! worked perfectly! Each time I add something new to the map, I learn something new:)


(twt_thunder) #4

aaaahh the hard way to learning… LOL we have all experienced that :smiley:
just keep it going and result will be amazing :slight_smile:


(morphdoc) #5

[QUOTE=twt_thunder;514550]aaaahh the hard way to learning… LOL we have all experienced that :smiley:
just keep it going and result will be amazing :)[/QUOTE]

I have got you guys:P after the last time, when I spent 3 days researching the answer for my scripting problem and got the answer within 10 minutes of posting on this forum, I decided to just post on the forum (unless it can be found through SEARCH!..ofcourse:P)


(morphdoc) #6

another issue :open_mouth:

in game error: G_Scripting: trigger has unknown name: antenna

antenna_trigger_allies
{
trigger invisible
{
setstate antenna_trigger_allies invisible
}

trigger visible
{
setstate antenna_trigger_allies default
}
}

antenna_activator_allies
{
trigger allies
{
trigger antenna move_allies
}
}

antenna_trigger_axis
{
spawn
{
setstate antenna_trigger_axis invisible
}

trigger invisible
{
setstate antenna_trigger_axis invisible
}

trigger visible
{
setstate antenna_trigger_axis default
}
}

antenna_activator_axis
{
trigger axis
{
trigger antenna move_axis
}
}

antenna
{
spawn
{
accum 5 set 0
}

trigger axis
{
wm_announce “^1Axis have rearranged the Antenna!”
wm_objective_status 5 0 1
wm_objective_status 5 1 2

  trigger antenna_trigger_allies visible
  trigger antenna_trigger_axis invisible
  trigger game_manager stop_countdown
  wait 1000
  accum 2 set 0
  globalaccum 1 inc -1
  accum 5 set 0
  resetscript

}

trigger allies
{
wm_announce “^1Allies have changed the Antenna orientation!”
wm_objective_status 5 0 2
wm_objective_status 5 1 1

  globalaccum 1 inc 1
  trigger game_manager start_countdown
  trigger antenna_trigger_allies invisible
  trigger antenna_trigger_axis visible
  wait 1000
  accum 2 set 0
  accum 5 set 1
  resetscript

}

trigger move_allies
{
accum 1 abort_if_equal 1
accum 2 abort_if_equal 1
accum 2 set 1
trigger antenna allies
}

trigger move_axis
{
accum 1 abort_if_equal 0
accum 2 abort_if_equal 1
accum 2 set 1
trigger antenna axis
}
}

what is wrong with this?

Basically, the script_trigger in the game triggers “allies” under “antenna_activator_allies” block. But it then says “unknown name: antenna”


(Mateos) #7

Is antenna a scriptname of one of your map entities?


(Cambodunum) #8

antenna_activator_allies
{
trigger allies
{
trigger antenna move_allies
}
}

antenna_activator_axis
{
trigger axis
{
trigger antenna move_axis
}
}

Sorry, just had a quick look at it … “trigger antenna move_axis” and “trigger antenna move_allies” seems to be wrong … should be “trigger move_axis and/or trigger move_allies” if you ask me … but without any guarantee

greetz Cambo


(Cambodunum) #9

trigger move_axis
{
accum 1 abort_if_equal 0
accum 2 abort_if_equal 1
accum 2 set 1
trigger antenna axis
}
}

… seems buggy too … there is no “antenna axis” trigger defined …

greetz Cambo


(morphdoc) #10

No, I do not have any entities with “scriptname antenna”. My target_script_trigger has this:

Scriptname: antenna_activator_allies
Targetname: antenna_activator_allies
Target: allies

So, it seems that the script works fine until it executes allies in antenna_activator_allies script block. It triggers allies, but it does not trigger “trigger antenna move_allies”

antenna_activator_allies
{
trigger allies
{
trigger antenna move_allies
}
}

I thought that this mean: trigger move_allies in script block called “antenna”


(morphdoc) #11

OK, sorted. I just had to create some random brush with scriptname “antenna” attached to it!


(Mateos) #12

Could have used the game_manager is really necessary to be outside the entities you use instead of creating a new useless one that server and clients will happily care about…