identical scripts dont work on different instances - spawn


(mazdaplz) #1

well so back when making my capturable spawn i couldnt make it work as in the 2bit tutorial

so i said screw this and i made the script by my own:

i have a team_wolf_checkpoint
targetname: flagpole1
spawnflags: spawnpoint
scriptname: cp1

and a team_wolf_objective
target: flagpole1
targetname: forward_wobj
description: axis shore spawn
no spawnflags.

the checkpoint is not pointing to any flags, but i have redspawn and bluespawn with targetname theflaga and theflagb (allied and axis) and they get triggered by script

then i added this script

cp1
{

spawn
	{
	accum 0 set 2 // Who owns flag: 0-Axis, 1-Allied, 2-Nobody
	}

trigger axis_capture // Touched by an Axis player
	{
	accum 0 abort_if_equal 0 // do Axis own flag?
	accum 0 trigger_if_equal 1 cp1 axis_reclaim // Reclaimed from Allies
	accum 0 set 0 // Axis own the flag
	wm_announce "Axis have captured the axis shore spawn Flag!"
	setstate forward_wobj default
	alertentity theflaga
	setautospawn "axis shore spawn" 0
	}

trigger axis_reclaim
	{
	alertentity forward_wobj // Switch command map marker
	alertentity theflagb
	}

trigger allied_capture // Touched by an allied player
	{
	accum 0 abort_if_equal 1 // do Allies own flag?
	accum 0 trigger_if_equal 0 cp1 allies_reclaim 
	accum 0 set 1 // Allied own the flag
	wm_announce "Allies have captured the axis shore spawn Flag!"
	setstate forward_wobj default
	alertentity forward_wobj // Switch command map marker
	alertentity theflagb
	setautospawn "axis shore spawn" 1
	} 

trigger allies_reclaim
	{
	alertentity forward_wobj // Switch command map marker
	alertentity theflaga
	}

}


i was pretty happy with it, in fact worked perfectly; so i cloned the thing and i added a second capturable spawn

cp2
{

spawn
	{
	accum 0 set 2 // Who owns flag: 0-Axis, 1-Allied, 2-Nobody
	}

trigger axis_capture // Touched by an Axis player
	{
	accum 0 abort_if_equal 0 // do Axis own flag?
	accum 0 trigger_if_equal 1 cp1 axis_reclaim // Reclaimed from Allies
	accum 0 set 0 // Axis own the flag
	wm_announce "Axis have captured the island main spawn Flag!"
	setstate forward_wobj2 default
	alertentity theflaga2
	setautospawn "central spawn" 0
	}

trigger axis_reclaim
	{
	alertentity forward_wobj2 // Switch command map marker
	alertentity theflagb2
	}

trigger allied_capture // Touched by an allied player
	{
	accum 0 abort_if_equal 1 // do Allies own flag?
	accum 0 trigger_if_equal 0 cp1 allies_reclaim 
	accum 0 set 1 // Allied own the flag
	wm_announce "Allies have captured the island main spawn Flag!"
	setstate forward_wobj2 default
	alertentity forward_wobj2 // Switch command map marker
	alertentity theflagb2
	setautospawn "central spawn" 1
	} 

trigger allies_reclaim
	{
	alertentity forward_wobj2 // Switch command map marker
	alertentity theflaga2
	}

}

this worked great also;

but now i need to have a third spawn by capturable flag, so when i add another instance of the same code/entities with the numbers 3 (eg: theflaga3, theflagb3, forward_wobj3) it doesnt work right;
the Allied reclaim is messed up only in this 3rd spawn, allies reclaim the flag but axis can still spawn there

this is making me scratch my head

do you have any advice?


(mazdaplz) #2
cp3
{

spawn
	{
	accum 0 set 2 // Who owns flag: 0-Axis, 1-Allied, 2-Nobody
	}

trigger axis_capture // Touched by an Axis player
	{
	accum 0 abort_if_equal 0 // do Axis own flag?
	accum 0 trigger_if_equal 1 cp1 axis_reclaim // Reclaimed from Allies
	accum 0 set 0 // Axis own the flag
	wm_announce "Axis have captured the allied shore spawn Flag!"
	setstate forward_wobj3 default
	alertentity theflaga3
	setautospawn "allied shore spawn" 0
	}

trigger axis_reclaim
	{
	alertentity forward_wobj3 // Switch command map marker
	alertentity theflaga3
	}

trigger allied_capture // Touched by an allied player
	{
	accum 0 abort_if_equal 1 // do Allies own flag?
	accum 0 trigger_if_equal 0 cp1 allies_reclaim 
	accum 0 set 1 // Allied own the flag
	wm_announce "Allies have captured the allied shore spawn Flag!"
	setstate forward_wobj3 default
	alertentity forward_wobj3 // Switch command map marker
	alertentity theflagb3
	setautospawn "allied shore spawn" 1
	} 

trigger allies_reclaim
	{
	alertentity forward_wobj3 // Switch command map marker
	alertentity theflagb3
	}

}

this is the bit that fails to work; i have no clue to why as it’s basically identical to the ones that work right there on the same map


(Diego) #3

I’ll have to check my script when I get home, but don’t you need to alert the spawn point entities as well as the wobj turn them off?


(mazdaplz) #4

maybe so, but the script that i have there is working fine for 2/3 spawns so maybe not. i think i need to do this third spawn more traditional style- as opposed to my messy scripting


(Flippy) #5

Did you notice that you are calling ‘alertentity forwardwobj3’ and ‘alertentity theflagb3’ twice? Once in the allied_capture part and once in the allies_reclaim part.

You also do this for script 1 and 2, only here you take ‘alertentity theflagb<number>’ in the normal part and you take ‘alertentity fheflaga<number>’ in the ‘team_reclaim’ part…

That’s probably your bug.


(mazdaplz) #6

oh wow, lol you wont believe this

i tried out what you said; it didnt seem to make any difference triggering any spawn or deleting commands;

later i found out the reason why:

the bug was

cp2
{

spawn
   {
   accum 0 set 2 // Who owns flag: 0-Axis, 1-Allied, 2-Nobody
   }

trigger axis_capture // Touched by an Axis player
   {
   accum 0 abort_if_equal 0 // do Axis own flag?
   accum 0 trigger_if_equal 1 cp1 axis_reclaim // Reclaimed from Allies
   accum 0 set 0 // Axis own the flag
   wm_announce "Axis have captured the island main spawn Flag!"
   setstate forward_wobj2 default
   alertentity theflaga2
   setautospawn "central spawn" 0
   }

trigger axis_reclaim
   {
   alertentity forward_wobj2 // Switch command map marker
   alertentity theflagb2
   }

trigger allied_capture // Touched by an allied player
   {
   accum 0 abort_if_equal 1 // do Allies own flag?
   accum 0 trigger_if_equal 0 cp1 allies_reclaim
   accum 0 set 1 // Allied own the flag
   wm_announce "Allies have captured the island main spawn Flag!"
   setstate forward_wobj2 default
   alertentity forward_wobj2 // Switch command map marker
   alertentity theflagb2
   setautospawn "central spawn" 1
   }

trigger allies_reclaim
   {
   alertentity forward_wobj2 // Switch command map marker
   alertentity theflaga2
   }

}

it’s triggering accum 0 trigger_if_equal 1 cp1 axis_reclaim the function on CP1; even though this script is called cp2; lol!

the reclaim parts dont seem to be wrong on cp1 and 2; you were right about cp3 with the backwards thing, but i had just done that to test out why it wasnt working, and i forgot to write it back
the solution was to add the according cp2 and cp3 where needed

i am sorry for wasting your time i havent been sleeping much these days
im also thankful for the responses


(Flippy) #7

I still think it’s weird that you alertentity the wobj twice :stuck_out_tongue: doesn’t make any sence in my mind… Wouldn’t that just switch it from axis, to allies, back to axis?


(mazdaplz) #8

now that i think about it; it is :roll:

however; the flag doesnt have any targets so triggering it twice probably does nothing hahaha

i’ll just leave it be for now, i have to play with light compiles :expressionless:

(i hate having to wait hour[s] before seeing any results at all)


(Flippy) #9

Why don’t you just chop your map into pieces and take one small bit of each ‘area’ you have and compile that… then just imitate the lighting settings on the main map… ^^


(mazdaplz) #10

good idea :shock:

i’ll definitely chop and use the terrain part for this