Jump to content
  • 0

Battleground Monsters on non-normally BG map not acting in accordance with set team


Synel

Question


  • Group:  Members
  • Topic Count:  16
  • Topics Per Day:  0.01
  • Content Count:  38
  • Reputation:   1
  • Joined:  01/09/17
  • Last Seen:  

Edit: Problem solved. Setting teams does not work with OnPCLoadMapEvent and must (seemingly) be triggered via npc direct activation. 

 

I'm trying to make town maps function with mobs that can attack players under certain conditions. The map I've decided to use has been added to the map index, I've set up a new type of battlegrounds in the battlegrounds db with the variables there matching the variables that I use in the actual script. I can get the maps to spawn, confirm that players get added to the BG team (or at least a variable of the same name is set) and the monsters are spawned using the set X BG_Monster command so the teams should all be correct. They still act hostile towards players who should be on the same team. 

Attached is the script. Help would be appreciated. 

 

//= Base Start scripts

-	script	TOWNBGTEAM	-1,{
OnPCLoadMapEvent:
	if( readparam(manner) >= 7 ) {
	bg_join($@Pront_Crim);
	}
	else if (manner <= 6 ) {
	bg_join($@Pront_Cit);
	}
OnPCDieEvent:
// Warp to jail and/or custom prison to be added here later		
	end;
}

prontera,160,70,0	script	PronteraBG2	111,{
	If( bg_get_data(Pront_Cit,0) >= 2 );
	mes  "MORE THAN ONE";
	close;
}

//Prontera

prontera,158,65,0	script	Pront_BG	111,{

bg_create("prontera",0,0);

set $@ProntG_1,	bg_monster($@Pront_Cit,"prontera",145,60,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_2,	bg_monster($@Pront_Cit,"prontera",145,50,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");	
set $@ProntG_3,	bg_monster($@Pront_Cit,"prontera",145,75,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_4,	bg_monster($@Pront_Cit,"prontera",146,108,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_5,	bg_monster($@Pront_Cit,"prontera",165,108,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_6,	bg_monster($@Pront_Cit,"prontera",164,174,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_7,	bg_monster($@Pront_Cit,"prontera",147,74,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_8,	bg_monster($@Pront_Cit,"prontera",185,197,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_9,	bg_monster($@Pront_Cit,"prontera",184,210,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_10,	bg_monster($@Pront_Cit,"prontera",166,237,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_11,	bg_monster($@Pront_Cit,"prontera",145,237,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_12,	bg_monster($@Pront_Cit,"prontera",127,210,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_13,	bg_monster($@Pront_Cit,"prontera",127,196,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_14,	bg_monster($@Pront_Cit,"prontera",145,257,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_15,	bg_monster($@Pront_Cit,"prontera",166,257,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_16,	bg_monster($@Pront_Cit,"prontera",163,267,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_17,	bg_monster($@Pront_Cit,"prontera",148,267,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_18,	bg_monster($@Pront_Cit,"prontera",149,305,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_19,	bg_monster($@Pront_Cit,"prontera",162,305,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_20,	bg_monster($@Pront_Cit,"prontera",143,330,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_21,	bg_monster($@Pront_Cit,"prontera",168,330,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_22,	bg_monster($@Pront_Cit,"prontera",200,324,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_23,	bg_monster($@Pront_Cit,"prontera",186,297,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_24,	bg_monster($@Pront_Cit,"prontera",232,274,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_25,	bg_monster($@Pront_Cit,"prontera",200,324,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_26,	bg_monster($@Pront_Cit,"prontera",185,297,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_27,	bg_monster($@Pront_Cit,"prontera",232,274,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_28,	bg_monster($@Pront_Cit,"prontera",245,255,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_29,	bg_monster($@Pront_Cit,"prontera",245,234,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_30,	bg_monster($@Pront_Cit,"prontera",247,214,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_31,	bg_monster($@Pront_Cit,"prontera",247,193,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_32,	bg_monster($@Pront_Cit,"prontera",267,193,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_33,	bg_monster($@Pront_Cit,"prontera",267,214,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_34,	bg_monster($@Pront_Cit,"prontera",245,170,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_35,	bg_monster($@Pront_Cit,"prontera",230,131,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_36,	bg_monster($@Pront_Cit,"prontera",230,64,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_37,	bg_monster($@Pront_Cit,"prontera",245,64,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_38,	bg_monster($@Pront_Cit,"prontera",79,133,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_39,	bg_monster($@Pront_Cit,"prontera",64,194,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_40,	bg_monster($@Pront_Cit,"prontera",64,213,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_41,	bg_monster($@Pront_Cit,"prontera",46,213,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_42,	bg_monster($@Pront_Cit,"prontera",46,194,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_43,	bg_monster($@Pront_Cit,"prontera",66,239,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_44,	bg_monster($@Pront_Cit,"prontera",66,260,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_45,	bg_monster($@Pront_Cit,"prontera",81,267,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");
set $@ProntG_46,	bg_monster($@Pront_Cit,"prontera",125,300,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_47,	bg_monster($@Pront_Cit,"prontera",113,325,"Prontera Guard",20542,"PronteraBG::OnMyMobDead");
set $@ProntG_48,	bg_monster($@Pront_Cit,"prontera",112,300,"Prontera Guard",20541,"PronteraBG::OnMyMobDead");

OnPCDieEvent:
// Warp to jail and/or custom prison to be added here later		
	end;

	end;

OnMyMobDead:
	//.@m$, = getattachedrid();
	//setd ".@l", = ("" + .@m$ + L");


initnpctimer;
	end;
	
OnTimer2000:
		stopnpctimer;

// work in progress
//	set .@m$,	bg_monster($@Pront_Cit,"prontera",.@l,"Prontera Guard",1973,"PronteraBG::OnMyMobDead");
	return;
	
}

// work in progress
//Startup variables
//ProntG_1L = 146,60;
//ProntG_2L = 145,50;
//ProntG_3L =
//ProntG_4L =
//ProntG_5L =
//ProntG_6L =
//ProntG_7L =
//ProntG_8L =
//ProntG_9L =
//ProntG_10L =
//ProntG_11L =
//ProntG_12L =
//ProntG_13L =
//ProntG_14L =
//ProntG_15L =
//ProntG_16L =
//ProntG_17L =
//ProntG_18L =
//ProntG_19L =
//ProntG_20L =
//ProntG_21L =
//ProntG_22L =
//ProntG_23L =
//ProntG_24L =
//ProntG_25L =
//ProntG_26L =
//ProntG_27L =
//ProntG_28L =
//ProntG_29L =
//ProntG_30L =
//ProntG_31L =
//ProntG_32L =
//ProntG_33L =
//ProntG_34L =
//ProntG_35L =
//ProntG_36L =
//ProntG_37L =
//ProntG_38L =
//ProntG_39L =
//ProntG_40L =
//ProntG_41L =
//ProntG_42L =
//ProntG_43L =
//ProntG_44L =
//ProntG_45L =
//ProntG_46L =
//ProntG_47L =
//ProntG_48L =
}

//0x6201E85
//0x4202085

 

Here's BG Database addition. There's no XY respawns because I had no plans on using the respawns. 

  - Id: 6
    Name: Prontera
    Locations:
      - Map: prontera
        StartEvent: Pront_BG::OnStart
        TeamA:
          DeathEvent: Pront_BG::OnPCDieEventPront
          QuitEvent: Pront_BG::OnPCQuitEventPront
          ActiveEvent: Pront_BG::OnPront_BG
          Variable: $@Pront_Cit
        TeamB:
          DeathEvent: Pront_BG::OnPCDieEventPront
          QuitEvent: Pront_BG::OnPCQuitEventPront
          ActiveEvent: Pront_BG::OnPront_BG
          Variable: $@Pront_Crim

 

Edited by Synel
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...