Summoning NPC's from a menu

DJGameFreakTheIguana

Active member
One script I've not been able to get much done with for years. I asked this for Beast Mode where it was suggest I long into the D&D mod, wise of Warduke, I did but couldn't make anything out and never got back to it. I decided to look back into last night where I ended up finding the entities I needed to find.

As far as I can tell, it's a few scripts working all at once, and the menu itself is actually using an image. As best I can, I'm going to list the scripts at work, and anyone who can take a look at it can see if they know how to change it for what I need, which is just summoning 2 or more NPC's of my choice.

First, I was told of this character, Strongheart, who summons's NPC with "@cmd SHSummon -100 10 1". I found he uses this script:

Code:
void SHSummon(float fX, float fY, float fZ)
{//Strongheart's special summon NPC script based on selected NPC
 //fX: X location adjustment
 //fY: Y location adjustment
 //fZ: Z location adjustment

    void self = getlocalvar("self"); //Get calling entity
    int PIndex = getentityproperty(self,"playerindex");
    int MagicS = getglobalvar(PIndex+"1");
    void vSpawn;

    if(MagicS=="Elkhorn"){
      summon("Elkhorn", fX, fY, fZ, "Elkhorn");
    } else if(MagicS=="Peralay"){
      summon("Peralay", fX, fY, fZ, "Peralay");
    } else if(MagicS=="Ringlerun"){
      summon("Ringlerun", fX+300, fY, fZ, "Ringlerun");
    } else if(MagicS=="Char"){
      summon("Char", fX, fY, fZ, "Char");
    } else if(MagicS=="Sarken"){
      summonSarken(fX, fY, fZ);
    }
}

For a menu, there's this shop I triggered in the game, a guy that sells stuff for bows.

Code:
name		Bowyer
score		0 -1
health		100
speed		0
nomove		1
type		enemy
gfxshadow	1
nodrop		1
defense		all 0
noatflash	1
nolife		1
animationscript	data/scripts/villager.c


anim idle
	loop	1
	delay	50
	offset	32 84
	bbox    22 10 25 75
	frame	data/chars/misc/civilian/merchant/bowyer.png

anim pain
	delay	5
	offset	32 84
	frame	data/chars/misc/civilian/merchant/bowyer.png
	delay	42
	@cmd	spawnDial 160 0 206 320
	frame	data/chars/misc/civilian/merchant/bowyer.png
	delay	52
	frame	data/chars/misc/civilian/merchant/bowyer.png

Inside villager.c

Code:
void spawnDial(float fX, float fY, float fZ, int Edge)
{//Spawns dialogue next to caller
// Spawned dialogue matches entity's alias
 //fX: X location adjustment
 //fY: Y location adjustment
 //fZ: Z location adjustment
 //Edge: Screen length (not used)

   void self = getlocalvar("self"); //Get calling entity
   char Name = getentityproperty(self,"name");
	
   spawn06(Name, fX, fY, fZ); //Spawn dialogue
}

void spawnAlias(char Name, float fX, float fY, float fZ, char Alias)
{//Spawns entity next to caller
 //Name: Entity to be spawned
 //fX: X location adjustment
 //fY: Y location adjustment
 //fZ: Z location adjustment
 //Alias: It's alias

   void Spawn;
	
   Spawn = spawn01(Name, fX, fY, fZ); // Spawn                 
   changeentityproperty(Spawn, "name", Alias); // Change alias
}

Searching for Bowyer with Notepad++, I found it's alias, BowyerD

Code:
name		BowyerD
type		none
facing		1
palette		none
setlayer 	10000
animationscript	data/scripts/shop/shopS.c
script		data/scripts/shop/bowshop.c


anim idle
	delay	6
	offset	160 206
	@cmd	DeControl 0 1
	@cmd	DeControl 1 1
	@cmd	noplayerJoin 1
	frame	data/chars/dialogues/1.png
	frame	data/chars/dialogues/2.png
	frame	data/chars/dialogues/3.png
	delay	200
	frame	data/chars/dialogues/shop/bowyer1.png
	frame	data/chars/dialogues/shop/bowyer2.png
	delay	4
	frame	data/chars/dialogues/4.png
	frame	data/chars/dialogues/5.png
	frame	data/chars/dialogues/6.png
	frame	data/chars/dialogues/7.png
	frame	data/chars/dialogues/8.png
	frame	data/chars/dialogues/9.png
	@cmd	spawnHand "Hand1" 0 120 80 200 320 0
	@cmd	spawnHand "Hand2" 1 200 80 200 320 1
	frame	data/chars/dialogues/shop/bowyer3.png
	delay	20000
	frame	data/chars/dialogues/shop/bowyer3.png
	delay	4
	@cmd	killHand 0
	@cmd	killHand 1
	frame	data/chars/dialogues/9.png
	frame	data/chars/dialogues/8.png
	frame	data/chars/dialogues/7.png
	frame	data/chars/dialogues/6.png
	frame	data/chars/dialogues/5.png
	frame	data/chars/dialogues/4.png
	delay	100
	frame	data/chars/dialogues/shop/bowyer4.png
	delay	6
	frame	data/chars/dialogues/3.png
	frame	data/chars/dialogues/2.png
	frame	data/chars/dialogues/1.png
	delay	16
	@cmd	DeControl 0 0
	@cmd	DeControl 1 0
	@cmd	noplayerJoin 0
	@cmd	suicide
	frame	data/chars/misc/empty.gif

Bowshop.c

Code:
void main()
{// Update script for displaying hand in bowyer & handles what hand shows
    void vSelf = getlocalvar("self"); //Get player
    void vAniPos = getentityproperty(vSelf, "animpos"); //Get current animation frame
    int XPos = openborvariant("xpos");

    void Hand1 = getentityvar(vSelf, 0);
    void Hand2 = getentityvar(vSelf, 1);

    void iJump1 = playerkeys(0, 1, "jump");
    void iJump2 = playerkeys(1, 1, "jump");

    int x1;
    int y1;
    int x2;
    int y2;

    if(Hand1){ 
      x1 = getentityproperty(Hand1,"x"); //Get Hand1's x coordinate
      y1 = getentityproperty(Hand1,"a"); //Get Hand1's y coordinate

//      drawstring(150,110,1,x1-XPos);
//      drawstring(150,150,1,y1);

      if(vAniPos==12){
        if(x1 >= XPos + 55 && x1 <= XPos + 170 && y1 >= 110 && y1 <= 125){
          setentityvar(Hand1, 0, "Crossbow");
          setentityvar(Hand1, 1, 5000);
          setentityvar(Hand1, 2, "Magic");
          setentityvar(Hand1, 3, NULL());
//          drawstring(150,140,1,"Crossbow");
        } else if(x1 >= XPos + 55 && x1 <= XPos + 150 && y1 >= 85 && y1 <= 100){
          setentityvar(Hand1, 0, "1");
          setentityvar(Hand1, 1, 100);
          setentityvar(Hand1, 2, "Bolt");
          setentityvar(Hand1, 3, NULL());
//          drawstring(150,140,1,"Bolt");
        } else if(x1 >= XPos + 55 && x1 <= XPos + 165 && y1 >= 60 && y1 <= 75){
          setentityvar(Hand1, 0, "2");
          setentityvar(Hand1, 1, 200);
          setentityvar(Hand1, 2, "Bolt");
          setentityvar(Hand1, 3, NULL());
//          drawstring(150,140,1,"Fire_Bolt");
        } else if(x1 >= XPos + 55 && x1 <= XPos + 180 && y1 >= 35 && y1 <= 50){
          setentityvar(Hand1, 0, "3Arrow");
          setentityvar(Hand1, 1, 5000);
          setentityvar(Hand1, 2, "Magic");
          setentityvar(Hand1, 3, NULL());
//          drawstring(150,140,1,"Triple_Arrows");
        } else if(x1 >= XPos + 145 && x1 <= XPos + 175 && y1 >= 15 && y1 <= 25){
          setentityvar(Hand1, 0, NULL());
          setentityvar(Hand1, 1, NULL());
          setentityvar(Hand1, 2, "Menu");
          setentityvar(Hand1, 3, 13);
//          drawstring(150,140,1,"EXIT");
        } else {
          setentityvar(Hand1, 0, NULL());
          setentityvar(Hand1, 1, NULL());
          setentityvar(Hand1, 2, NULL());
          setentityvar(Hand1, 3, NULL());
        } 
        if(iJump1){          
          updateframe(vSelf, 13);
        }
      }
    }

    if(Hand2){
      x2 = getentityproperty(Hand2,"x"); //Get Hand2's x coordinate
      y2 = getentityproperty(Hand2,"a"); //Get Hand2's y coordinate

      if(vAniPos==12){
        if(x2 >= XPos + 55 && x2 <= XPos + 170 && y2 >= 110 && y2 <= 125){
          setentityvar(Hand2, 0, "Crossbow");
          setentityvar(Hand2, 1, 5000);
          setentityvar(Hand2, 2, "Magic");
          setentityvar(Hand2, 3, NULL());
        } else if(x2 >= XPos + 55 && x2 <= XPos + 150 && y2 >= 85 && y2 <= 100){
          setentityvar(Hand2, 0, "1");
          setentityvar(Hand2, 1, 100);
          setentityvar(Hand2, 2, "Bolt");
          setentityvar(Hand2, 3, NULL());
        } else if(x2 >= XPos + 55 && x2 <= XPos + 165 && y2 >= 60 && y2 <= 75){
          setentityvar(Hand2, 0, "2");
          setentityvar(Hand2, 1, 200);
          setentityvar(Hand2, 2, "Bolt");
          setentityvar(Hand2, 3, NULL());
        } else if(x2 >= XPos + 55 && x2 <= XPos + 180 && y2 >= 35 && y2 <= 50){
          setentityvar(Hand2, 0, "3Arrow");
          setentityvar(Hand2, 1, 5000);
          setentityvar(Hand2, 2, "Magic");
          setentityvar(Hand2, 3, NULL());
        } else if(x2 >= XPos + 145 && x2 <= XPos + 175 && y2 >= 15 && y2 <= 25){
          setentityvar(Hand2, 0, NULL());
          setentityvar(Hand2, 1, NULL());
          setentityvar(Hand2, 2, "Menu");
          setentityvar(Hand2, 3, 13);
        } else {
          setentityvar(Hand2, 0, NULL());
          setentityvar(Hand2, 1, NULL());
          setentityvar(Hand2, 2, NULL());
          setentityvar(Hand2, 3, NULL());
        } 
        if(iJump2){          
          updateframe(vSelf, 13);
        }
      }
    }
}

Check next post for the other script, they went over the character limit.

x)
 
Oh yeah, that's pretty easy, most of the trial and error should come out of just trying to position them properly. One of my mid bosses has the same summoning attack as show at 0:42 of your video. Here's ow it looks like.
Code:
anim	freespecial4
	loop	0
	delay	7
	offset	125 110
	bbox	110 48 34 61
	range	20 200
	@cmd	shoot "ScNik1" -360 0 10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik2" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik3" -360 0 -10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik4" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik2" -360 0 10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik3" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik4" -360 0 -10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik1" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik3" -360 0 10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik4" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik1" -360 0 -10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik2" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik4" -360 0 10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik1" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik2" -360 0 -10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik3" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif

of course he's shooting these but summoning is really no different, I just use shoot so players get credit for the attack when they summon something like special effects, with those effects having nomove 1 in their header and move # in their animation. Since your example works the same way, I'll give you the shoot function so attack NPC's still gets you the points.
Code:
void shoot(void Shot, float dx, float dy, float dz)
{ // Shooting projectile
   void self = getlocalvar("self");
   int Direction = getentityproperty(self, "direction");
   int x = getentityproperty(self, "x");
   int y = getentityproperty(self, "a");
   int z = getentityproperty(self, "z");

   if (Direction == 0){ //Is entity facing left?                  
      dx = -dx; //Reverse X direction to match facing
   }

   projectile(Shot, x+dx, z+dz, y+dy, Direction, 0, 0, 0);
}

EDIT:
There's another example I have with using Yamato, the ninja boss from Streets of Rage 3, where he if he connects with a dash attack, he summons a clone and they both attack the target. This was when I noticed I was getting no point for this and used @cmd shoot to summon the clone.

x)
 
DJGameFreak TheIguana said:
Oh yeah, that's pretty easy, most of the trial and error should come out of just trying to position them properly. One of my mid bosses has the same summoning attack as show at 0:42 of your video. Here's ow it looks like.
Code:
anim	freespecial4
	loop	0
	delay	7
	offset	125 110
	bbox	110 48 34 61
	range	20 200
	@cmd	shoot "ScNik1" -360 0 10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik2" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik3" -360 0 -10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik4" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik2" -360 0 10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik3" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik4" -360 0 -10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik1" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik3" -360 0 10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik4" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik1" -360 0 -10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik2" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik4" -360 0 10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik1" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik2" -360 0 -10
	frame	data/chars/Scratch/FSP3.gif
	@cmd	shoot "ScNik3" -360 0 0
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif
	frame	data/chars/Scratch/FSP3.gif

of course he's shooting these but summoning is really no different, I just use shoot so players get credit for the attack when they summon something like special effects, with those effects having nomove 1 in their header and move # in their animation. Since your example works the same way, I'll give you the shoot function so attack NPC's still gets you the points.
Code:
void shoot(void Shot, float dx, float dy, float dz)
{ // Shooting projectile
   void self = getlocalvar("self");
   int Direction = getentityproperty(self, "direction");
   int x = getentityproperty(self, "x");
   int y = getentityproperty(self, "a");
   int z = getentityproperty(self, "z");

   if (Direction == 0){ //Is entity facing left?                  
      dx = -dx; //Reverse X direction to match facing
   }

   projectile(Shot, x+dx, z+dz, y+dy, Direction, 0, 0, 0);
}

EDIT:
There's another example I have with using Yamato, the ninja boss from Streets of Rage 3, where he if he connects with a dash attack, he summons a clone and they both attack the target. This was when I noticed I was getting no point for this and used @cmd shoot to summon the clone.

x)

I think this will come in handy when I am making more beat em ups for the Openbor in the future, that is if I get fully done with the Dungeon Magic mod that is.
 
@Jeremiah:

I have scripts for that formation spawn,
First is this:
Code:
void spawn04(void vName, float fX, float fY, float fZ)
{
	//Spawns entity based on left screen edge and center of playing field
	//
	//vName: Model name of entity to be spawned in.
	//fX: X distance relative to left edge
	//fY: Y height from ground
      //fZ: Z location adjustment

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int Direction = getentityproperty(self, "direction");
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int Screen = openborvariant("hResolution"); // Get screen width

	clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

   if (Direction == 0){ //Is entity facing left?                  
      fX = Screen-fX; //Reverse X direction to match facing and screen length
   }

      fZ = fZ+(openborvariant("PLAYER_MIN_Z") + openborvariant("PLAYER_MAX_Z") )/2 ;

	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX + XPos, fZ, fY); //Set spawn location.
	return vSpawn; //Return spawn.
}

This is for summoning formation of spearmen at 0:06, horsemen at 0:18 and archers at 0:31. One declaration for one entity so you need to declare 6 of this for one formation, each with its own coords

Second it this:
Code:
void spawn02(void vName, float fX, float fY, float fZ)
{
	//Spawns entity based on left screen edge
	//
	//vName: Model name of entity to be spawned in.
	//fX: X distance relative to left edge
	//fY: Y height from ground
      //fZ: Z location adjustment

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int Direction = getentityproperty(self, "direction");
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int Screen = openborvariant("hResolution"); // Get screen width

	clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

   if (Direction == 0){ //Is entity facing left?                  
      fX = Screen-fX; //Reverse X direction to match facing and screen length
   }

      fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.

	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX + XPos, fZ, fY); //Set spawn location.
	return vSpawn; //Return spawn.
}

This is for summoning band of soldiers at 0:11, band of civilians at 0:42, double swordmen at 0:51, and band of rogues at 0:57
Just like spawn04, spawn02 spawns only one entity so you'd need to declare more of this to spawn more

I'm not sure about assassins summon at 0:25. If the assassin's x position depends summoner's, spawn01 should do the trick. However if the assassins adjust their own position after being summoned, spawn02 should be enough :)

@DJ:

1. I need some script to spawn the icons for locked chars based on if their flagged as unlocked.

Hmm... you will need another entity as the Xs, padlocks or whatever to be placed on top of the icon to show they are locked. And a script to check unlocked status to prevent summoning

3. Spawning the menu from a fixed position so it's not based on where the player is, as it could easily have icons off screen.

I forgot why I used spawnbind instead of spawn01 to spawn the menu. One thing for sure, the spawn function must register spawned menu in spawner's entity variable to allow the latter to kill the former when summoning is done

Anyways, to spawn relative to screen, you might need this function:
Code:
void spawn06(void vName, float fX, float fY, float fZ)
{
	//Spawns entity based on left screen edge and z axis
	//Auto adjust with camera's position
	//vName: Model name of entity to be spawned in.
	//fX: X distance relative to left edge
	//fY: Y height from ground
      //fZ: Z coordinate

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int Direction = getentityproperty(self, "direction");
        int XPos = openborvariant("xpos"); //Get screen edge's position
        int YPos = openborvariant("ypos"); // Get camera position
        int Screen = openborvariant("hResolution"); // Get screen width

	clearspawnentry(); //Clear current spawn entry.
      setspawnentry("name", vName); //Acquire spawn entity by name.

   if (Direction == 0){ //Is entity facing left?                  
      fX = Screen-fX; //Reverse X direction to match facing and screen length
   }

	vSpawn = spawn(); //Spawn in entity.

	changeentityproperty(vSpawn, "position", fX + XPos, fZ + YPos, fY); //Set spawn location.
	return vSpawn; //Return spawn
}

and other script to store the spawned menu
 
Ok, so I used spawn06 and it worked, so there's that. I just have to reposition the cursor again, I'll get to that later. There is one thing though, Spown06 must not be registered to the spawner cause it's not being killed off when I turn it off. If you look at the screenshot closely, you can see there's multiple copies of the menu.

x)

[attachment deleted by admin]
 
Bloodbane said:
Hmm... you will need another entity as the Xs, padlocks or whatever to be placed on top of the icon to show they are locked. And a script to check unlocked status to prevent summoning

Got to working on this and redid the menu so it shows ever secret character, and made another entity that spawns over all of their icons. Here's the setup, and the entity covering the secret icons is NPCSel0a.
Code:
anim	CHARGEATTACK
@script
  if(frame == 1){
    void self = getlocalvar("self");
    int PIndex = getentityproperty(self,"playerindex");
    
    setglobalvar(PIndex+"A3", NULL());
  }
  if(frame == 3){
    void self = getlocalvar("self");
    int PIndex = getentityproperty(self,"playerindex");
    int A = getglobalvar(PIndex+"A3");

    if(A == NULL()){
      updateframe(self, 2);
    } else {}
  }
@end_script
	 chargetime 0.5
	shadowcoords 218 198
	offset	76 96
	 delay      5
	frame	data/chars/empty.gif
	 delay      10
	@cmd	stealth 350
	#@cmd	spawnBind2 "NPCSel0" 10 110 -1 2 0 1
	#(void vName, float fX, float fY, float fZ)
	@cmd	spawn06 "NPCSel0" 240 1 136
	@cmd	spawn06 "NPCSel0a" 240 1 136
	@cmd	spawn06 "NPCSel0a" 264 1 136
	@cmd	spawn06 "NPCSel0a" 288 1 136
	@cmd	spawn06 "NPCSel0a" 312 1 136
	@cmd	spawn06 "NPCSel0a" 336 1 136
	@cmd	spawn06 "NPCSel0a" 360 1 136
	@cmd	spawn06 "NPCSel0a" 384 1 136
	@cmd	spawn06 "NPCSel0a" 408 1 136
	@cmd	spawn06 "NPCSel0a" 432 1 136
	@cmd	spawn06 "NPCSel0a" 456 1 136
	##########
	@cmd	spawn06 "NPCSel0a" 240 1 161
	@cmd	spawn06 "NPCSel0a" 264 1 161
	@cmd	spawn06 "NPCSel0a" 288 1 161
	@cmd	spawn06 "NPCSel0a" 312 1 161
	@cmd	spawn06 "NPCSel0a" 336 1 161
	@cmd	spawn06 "NPCSel0a" 360 1 161
	@cmd	spawn06 "NPCSel0a" 384 1 161
	@cmd	spawn06 "NPCSel0a" 408 1 161
	@cmd	spawn06 "NPCSel0a" 432 1 161
	##########
	@cmd	spawnChild "NPCSel1" 1 1 1 1 1 2
	###################
	#@cmd	spawnBind2 "NPCSel0" 0 60 -1 2 0 1
	#@cmd	spawnChild "NPCSel1" -75 116 1 1 1 2
	 delay      5
	#frame	data/chars/Knuckles/Idle1(1).gif
	frame	data/chars/empty.gif
	frame	data/chars/empty.gif
	frame	data/chars/empty.gif
	@cmd	stealth 0
	@cmd	killgun 1 0
	@cmd	killgun 2 0
	frame	data/chars/empty.gif

x)
 
Ok, so I ran into a snag after this but I was caught up with SUB that I didn't post about it, but since the menu uses that script for it's coards, the select entity never matches up since it's still spawning near the player. I didn't think about this before but I think what I need is a script to position the selector where I need it to be, maybe in a spawn animation for it.

EDIT:
Might as well get this part out the way to.
Bloodbane:
Hmm... you will need another entity as the Xs, padlocks or whatever to be placed on top of the icon to show they are locked. And a script to check unlocked status to prevent summoning

Yeah, I'll need this script, or maybe even a script that kills the X covering the unlocked char, whichever is easier.

x)

[attachment deleted by admin]
 
I have an idea on how to implement this but since this is a system, I might need to look at the demo myself
Can you PM a demo of this mod so I can modify the system?
 
Well it's been a while, and I went over to Universe Brawl, but I slowed up on it lately to get a little work done with this menu. I started doing NPC of every Sonic character, and as of now the Menu pretty much works, though there's still something I need to work out with Bloodbane, none of the Sonic characters can be spawned again until I close the game.

EDIT: Disregard what I just said, completely forgot about a file I need to update with the new NPCs.

EDIT2: I was right, after updating said file, Sonic characters are spawning in every match now. Still need a little more work but this makes up a good chunk of it.

x)
 

Attachments

  • bor - 0414.png
    bor - 0414.png
    21.3 KB · Views: 7
  • bor - 0415.png
    bor - 0415.png
    42.6 KB · Views: 8
  • bor - 0416.png
    bor - 0416.png
    45.9 KB · Views: 12
  • bor - 0419.png
    bor - 0419.png
    31.8 KB · Views: 8
Got a situation now where my Models2 file takes a while to load since I set every NPC to load in order for the menu to summon them. Is there a CMD command to load a character? I want to put one for each follow anim in the menu to load the selected NPC right before summoning them.

X)
 
Found myself another problem. I started testing the menu script in other stages, and found that the cursor starts off at different positions. In one stage it would spawn depending on what Z position my character was in so I think that has something to do with it. In the last shot, I had to push down 3 times to get the cursor just above Sonic's icon, so it's actually on the bottom row. Here's the script again for reference.

Code:
anim	Freespecial12
@script
  if(frame == 1){
    void self = getlocalvar("self");
    int PIndex = getentityproperty(self,"playerindex");
    
    setglobalvar(PIndex+"A4", NULL());
  }
  if(frame == 3){
    void self = getlocalvar("self");
    int PIndex = getentityproperty(self,"playerindex");
    int A = getglobalvar(PIndex+"A4");

    if(A == NULL()){
      updateframe(self, 2);
    } else {}
  }
@end_script
	shadowcoords 218 198
	offset	76 96
	 delay      5
	frame	data/chars/empty.gif
	@cmd	stealth 350
	@cmd	spawnMenu "NPCSel0" 240 1 136 1
	@cmd	spawnChild "NPCSelCurs" 1 1 1 1 1 2
	frame	data/chars/empty.gif
	frame	data/chars/empty.gif
	frame	data/chars/empty.gif
	@cmd	stealth 0
	@cmd	killgun 1 2
	@cmd	killgun 2 0
	frame	data/chars/empty.gif

X)
 

Attachments

  • Clipboard03.png
    Clipboard03.png
    127.6 KB · Views: 14
Hmmm.... can I see NPCSelCurs text?
I think I've added something to put the cursor in certain location regardless of player's Z but I can't recall if you have gotten that update or not
 
Bloodbane said:
Hmmm.... can I see NPCSelCurs text?
I think I've added something to put the cursor in certain location regardless of player's Z but I can't recall if you have gotten that update or not
Here's the link: https://www.mediafire.com/file/i064b4g20vl8ufu/NPCSelCurs.zip/file
It's a zip file because there's 3 of them for each NPC type, normal, speed, and flight.

Damon Caskey said:
Guys I'm way late to the party here, but just in case, here's my Spinner library. Might help you out a bit for certain portions of the menu.
Thanks DC, I'll download it later to see if I can make sense of it, I skimmed the readme.

X)
 
Thanks
After some checks, I figured out the problem and the solution. Since all three files have same script in SPAWN, you can replace the script in all of them with this one:
Code:
anim	spawn
@script
  if(frame==1){
    void self = getlocalvar("self");
    void Par = getentityvar(self, 2);
    int Px = openborvariant("xpos");
    int Py = openborvariant("ypos");

    changeentityproperty(self, "position", Px-75, Py+211, 116);
  }
@end_script
...

HTH
 
Back
Top Bottom