Spawn an entity by chain/combo count.

kdo

Member
Hello!!! Is it possible, spawn a entity ( item) acording with combo/ chain count?
something like: 10 hit spawn coin, 15 hit spawn gold, 20 hit spawn diamond .....

How could i do this? someone tried this before?
i didnt find nothin searching in the forum....

Thanks... ;)
 
I found something which could be used for this purpose:

Code:
getentityproperty(self, "rush_count");

That function will give you current combo count
The question is when will the reward be given? as soon after certain value is reached? or at the end of combo chain?
Next question is who or what will spawn the reward?
Third question is can player get all rewards in single combo (e.g score 21 hit gives coin, gold and diamond) or player only get one reward based on combo count?
 
OK, lets go!!

1-  The question is when will the reward be given? as soon after certain value is reached? or at the end of combo chain?

  # As soon after certain value is reached, this is what i need, combo cout reach number 10 spawn a item, reach 20 spawn another item....

2 - Next question is who or what will spawn the reward?
 
  # I think the enemy could be the reward spowner , the anemy that dies in the 10hit of combo, 20 hit, 30 hit....

3 - Third question is can player get all rewards in single combo (e.g score 21 hit gives coin, gold and diamond) or player only get one reward based on
combo count?

    # Im my mod the nemys dies with jut one hit, so to make a combo the player must kill a lot of enemy without loose
      combo chain, so i think should be  nice if the player get a reward every time the combo count  reach numbers like 10, 20, 30...
      If the chain not get broken  the player will get reward in each 10 hit... if  chain get broken at 15....player just get the reward spawned at 10hit...and
      the cout starts again....if player not loose the chain he/she can get all rewards spawned in each 10 on 10 hit.


Sorry about my english, i hope i have given the answers....thanks...
 
I get the idea thanks :)

Anyways, based on your request, I made a takedamagescript (script which is run when an entity is attacked)
chaindrop:
Code:
void main()
{// Tosses reward based on hitting player's rush count
// 10 : Apple
// 15 : Money
// 20 : Gold
    void self = getlocalvar("self"); //Get calling entity
    void attacker = getlocalvar("attacker");
    int Rush = getentityproperty(attacker, "rush_count");

    switch(Rush){
    case 9: // 10-1
      shooter2("Apple",0,10,0, 3, 2, 0);
      break;
    case 14: // 15-1
      shooter2("Money",0,10,0, 3, 2, 0);
      break;
    case 19: // 20-1
      shooter2("Gold",0,10,0, 3, 2, 0);
      break;
    default:
      break;
    }
}

void spawn01(void vName, float fX, float fY, float fZ)
{
	//spawn01 (Generic spawner)
	//Damon Vaughn Caskey
	//07/06/2007
	//
	//Spawns entity next to caller.
	//
	//vName: Model name of entity to be spawned in.
	//fX: X location adjustment.
	//fY: Y location adjustment.
      //fZ: Z location adjustment.

	void self = getlocalvar("self"); //Get calling entity.
	void vSpawn; //Spawn object.
	int  iDirection = getentityproperty(self, "direction");

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

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

      fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
      fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
      fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.
	
	vSpawn = spawn(); //Spawn in entity.

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

void shooter2(void vName, float fX, float fY, float fZ, float Vx, float Vy, float Vz)
{//Spawns projectile next to caller
 //vName: Model name of entity to be spawned in
 //fX: X location adjustment
 //fZ: Y location adjustment
 //fY: Z location adjustment
 //Vx: X speed
 //Vy: Y speed
 //Vz: Z speed

   void self = getlocalvar("self"); //Get calling entity
   int Direction = getentityproperty(self, "direction");
   void vSpawn; //Spawn object.
	
   vSpawn = spawn01(vName, fX, fY, fZ); //Spawn in projectile
   if (Direction == 0){ //Is entity facing left?                  
      Vx = -Vx; //Reverse Vx direction to match facing
   }

   changeentityproperty(vSpawn, "velocity", Vx, Vz, Vy);
}

Save that script in data/scripts folder
To use it, declare this line in enemy's text header:

animationscript data/scripts/chaindrop.c

I've tested this and it works well :)

For modifying, see this function

shooter2("Apple",0,10,0, 3, 2, 0);

That function means that it will shoot Apple at 10 pixels above entity's offset with velocity 3 pixels/centisecond in x axis and 2 pixels/centisecond in y axis
You can modify the values for your purpose

Also see the numbers after case text, it defines required rush count before shooting anything. You can modify the value but don't forget to subtract it by 1

Last but not least, all spawned rewards must be LOADed in order for them to be spawned

HTH
 
I tried your script Bloodbane, but i had no sucess... nothing happened...

what i did:
1- I created the chaindrop.c and placed it in script folder.
2- I copied  the animationscript data/scripts/chaindrop.c  line in the enemy flag .
3 - I put the apple(reward) to load.
4 - My mod already has the default rush count. I tried the getentityproperty(self, "rush_count"); it conut the rush as the derfault rush count.

I dont know whats wrong.... :-[
 
Back
Top Bottom