Thank you, Volcanic for reply

But as i say setting itemspawner to each enemy in level#.txt is not suitable for me (it will be one additional line for each enemy).
But anyway, i solve random item drop with Bloodbanes script from Crime Buster, but edit it a little. Here it is:
void Ri(float fX, float fY, float fZ)
{//Spawns random item from list 1 next to caller.
//
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.
void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
void vName; //Spawn object's name.
int iR = rand()%10 + 10;
if (iR >= 0 && iR < 5){
vName = "Apple";
} else if (iR >= 5 && iR < 10){
vName = "Money";
} else if (iR >= 10 && iR < 15){
vName = "Diamond";
} else if (iR >= 15 && iR < 20){
vName = "Gold";
}
clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", vName); //Acquire spawn entity by name.
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.
return vSpawn; //Return spawn.
}
And it is work fine.
But here is another problem i am stuck with.
I cant spawn or summon anything in enemy`s death animation.
First i tied to make it with subentity
anim death
loop 0
subentity expl
summonframe 0 1 2 0 0
delay 30
offset 145 170
frame data/chars/misc/car1a.gif
delay 20
offset 147 173
frame data/chars/misc/car1.gif
delay 60
offset 145 170
frame data/chars/misc/car1a.gif
delay 20
offset 147 173
frame data/chars/misc/car1.gif
delay 10
offset 120 182
frame data/chars/misc/car.gif
It is strange but this isnt working in my mod, i tried to spawn explosion in the death animation, second form of boss, decoration after death, and tied it with spawn01 script, summonentity, castentity.. all of these doesnt work only in death animation. If i declare all of those in any other animation it works fine, but not in death anim.
I use the latest build.
name rob
type enemy
health 40
speed 17
gfxshadow 1
nodieblink 1
icon data/chars/rob/i40.gif
diesound data/sounds/MalDeath2.wav
antigravity -40
grabdistance 45
candamage obstacle player npc
projectilehit obstacle enemy npc
aggression 300
throw 7 5
#aimove chasex
globalmap 0
animationscript data/scripts/slambb.c
alternatepal data/chars/rob/p/B1.gif
alternatepal data/chars/rob/p/B2.gif
alternatepal data/chars/rob/p/B3.gif
alternatepal data/chars/rob/p/B4.gif
alternatepal data/chars/rob/p/B5.gif
palette data/chars/rob/103.gif
score 300 4
load ExpL
load Flask
anim death
subentity expl
summonframe 1 1 2 0 0
loop 0
offset 290 275
bbox 264 53 53 224
delay 10
frame data/chars/rob/w/103.gif
@cmd tosser "Flask" 110 160 0 2 4 0
@cmd spawn01 "ExpL" 180 1 1
frame data/chars/rob/w/103.gif
@cmd RSpawn 1 100 1
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
frame data/chars/rob/w/103.gif
As you see, i used 4 methods of spawn in death anim, but no one works, enemy just blink as always after fall and disappears. I saw that was a method by utunnels, to set a spawned entity to an obstacle or npc, but i think it will cause the wrong enemy counting in groups. How to properly spawn anything i want during death animation? What is the problem?
And 2nd question is about random palette of spawning enemy:
Here is the script i get by modifying random item drop script:
void main() {
void self = getlocalvar("self"); //Get calling entity.
void iMap;
int iR = rand()%5 + 5;
if (iR >= 0 && iR < 2){
iMap == 1;
} else if (iR >= 2 && iR < 4){
iMap == 2;
} else if (iR >= 4 && iR < 6){
iMap == 3;
} else if (iR >= 6 && iR < 8){
iMap == 4;
} else if (iR >= 8 && iR < 10){
iMap == 5;
}
changeentityproperty(self, "map", iMap); //Set map.
}
And here is the enemy`s header:
name Galsia
type enemy
health 40
speed 25
gfxshadow 1
nodieblink 1
#-----MAP
onspawnscript data/scripts/map5.c
#-----MAP
icon data/chars/Galsia/i40.gif
diesound data/sounds/MalDeath1.wav
grabdistance 45
candamage obstacle player npc
projectilehit obstacle enemy npc
aggression 300
throw 7 5
#aimove chasex
globalmap 0
alternatepal data/chars/Galsia/p/B1.gif
alternatepal data/chars/Galsia/p/B2.gif
alternatepal data/chars/Galsia/p/B3.gif
alternatepal data/chars/Galsia/p/B4.gif
alternatepal data/chars/Galsia/p/B5.gif
palette data/chars/Galsia/p/B1.gif
But it doesnt work. I read a manual and think that "map" variable is recognize only alternate maps defined with remap. And change header to this:
name Galsia
type enemy
health 40
speed 25
gfxshadow 1
nodieblink 1
#-----MAP
onspawnscript data/scripts/map5.c
#-----MAP
icon data/chars/Galsia/i40.gif
diesound data/sounds/MalDeath1.wav
grabdistance 45
candamage obstacle player npc
projectilehit obstacle enemy npc
aggression 300
throw 7 5
#aimove chasex
globalmap 0
remap data/chars/Galsia/p/B1.gif data/chars/Galsia/p/B1.gif
remap data/chars/Galsia/p/B1.gif data/chars/Galsia/p/B2.gif
remap data/chars/Galsia/p/B1.gif data/chars/Galsia/p/B3.gif
remap data/chars/Galsia/p/B1.gif data/chars/Galsia/p/B4.gif
remap data/chars/Galsia/p/B1.gif data/chars/Galsia/p/B5.gif
But it still doesnt work. I think the problem is in 16bit mode. 8bit mode works with remaps, 16bit mode works woth alternatepals, but last is not recognized by script as
map (instead of
remap). Is there a solution for this?