O Ilusionista
Captain 100K
I've made a tutorial for that here http://www.chronocrash.com/forum/index.php?topic=3115.0
void main(){
// Custom sounds for picking itens
// Douglas Baldan / O Ilusionista - 11/12/2016
// Thanks Damon Caskey for the support
void self = getlocalvar("self"); //get the self var
void hit = getlocalvar("damagetaker"); // get target entity
char Name = getentityproperty(self,"name"); // get target's name
void power = getentityproperty(hit,"mp"); // get target's current mp
int SFX1 = loadsample("data/sounds/get2.wav"); // load samples
switch(Name) { // check the item name
case "apple" : // life and power up
changeentityproperty(hit, "mp", power+30); // add 30 to entity power
playsample(SFX1, 0, 120, 120, 100, 0);
spawnAni("aitemFX",30,130,0,"ANI_FOLLOW3",NULL(),NULL(),NULL());
break;
default : // in case of none of above
break;
}
}
void spawnAni(void vName, float fX, float fY, float fZ, void Ani, float Vx, float Vy, float Vz)
{
//spawnB (Generic spawner) + Specific animation + velocities
//Damon Vaughn Caskey + Douglas Baldan
//07/06/2007
//
//Spawns entity next to caller.
//
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: 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.
performattack(vSpawn, openborconstant(Ani));
changeentityproperty(vSpawn, "velocity", Vx, Vy, Vz);
return vSpawn; //Return spawn.
}
name APPLE
health 30
type item
shadow 0
nolife 1
didhitscript data/scripts/didhit/item.c
anim spawn
loop 0
delay 2
offset 18 27
bbox 5 4 19 16
frame data/chars/misc/food/apple01.gif
offset 18 28
frame data/chars/misc/food/apple02.gif
offset 18 29
frame data/chars/misc/food/apple01.gif
offset 18 30
frame data/chars/misc/food/apple02.gif
offset 18 31
frame data/chars/misc/food/apple01.gif
offset 18 32
frame data/chars/misc/food/apple02.gif
offset 18 33
frame data/chars/misc/food/apple01.gif
offset 18 32
frame data/chars/misc/food/apple02.gif
offset 18 31
frame data/chars/misc/food/apple01.gif
offset 18 30
frame data/chars/misc/food/apple02.gif
offset 18 29
frame data/chars/misc/food/apple01.gif
offset 18 28
frame data/chars/misc/food/apple02.gif
offset 18 27
frame data/chars/misc/food/apple01.gif
offset 18 28
frame data/chars/misc/food/apple02.gif
offset 18 29
frame data/chars/misc/food/apple01.gif
offset 18 30
frame data/chars/misc/food/apple02.gif
offset 18 31
frame data/chars/misc/food/apple01.gif
offset 18 32
frame data/chars/misc/food/apple02.gif
offset 18 33
frame data/chars/misc/food/apple01.gif
offset 18 32
frame data/chars/misc/food/apple02.gif
offset 18 31
frame data/chars/misc/food/apple01.gif
offset 18 30
frame data/chars/misc/food/apple02.gif
offset 18 29
frame data/chars/misc/food/apple01.gif
offset 18 28
frame data/chars/misc/food/apple02.gif
offset 18 27
frame data/chars/misc/food/apple01.gif
anim idle
loop 1
delay 4
offset 18 27
bbox 5 4 19 16
frame data/chars/misc/food/apple01.gif
delay 4
frame data/chars/misc/food/apple02.gif
anim follow3
loop 0
delay 2
offset 18 27
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
apescott said:I just want this icon to play when picking up food and scroll with the screen so how would I script that?![]()
void main(){
// Custom sounds for picking itens
// Douglas Baldan / O Ilusionista - 11/12/2016
// Thanks Damon Caskey for the support
void self = getlocalvar("self"); //get the self var
void hit = getlocalvar("damagetaker"); // get target entity
char Name = getentityproperty(self,"name"); // get target's name
void power = getentityproperty(hit,"mp"); // get target's current mp
int SFX1 = loadsample("data/sounds/get2.wav"); // load samples
switch(Name) { // check the item name
case "apple" : // Gives 30 health
changeentityproperty(hit, "mp", power+30); // add 30 to entity power
playsample(SFX1, 0, 120, 120, 100, 0);
spawnAni("food_flash",30,130,0,"ANI_FOLLOW3",NULL(),NULL(),NULL());
break;
default : // in case of none of above
break;
}
}
void spawnAni(void vName, float fX, float fY, float fZ, void Ani, float Vx, float Vy, float Vz)
{
//spawnB (Generic spawner) + Specific animation + velocities
//Damon Vaughn Caskey + Douglas Baldan
//07/06/2007
//
//Spawns entity next to caller.
//
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: 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.
performattack(vSpawn, openborconstant(Ani));
changeentityproperty(vSpawn, "velocity", Vx, Vy, Vz);
return vSpawn; //Return spawn.
}
name food_flash
speed 10
type panel
nolife 1
facing 1
gfxshadow 0
setlayer 10000
noquake 0 1
anim idle
loop 1
delay 4
offset 0 26
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
frame data/chars/misc/food/food_flash01.gif
frame data/chars/misc/food/food_flash02.gif
#|edited by openBor Stats v 0.67
O Ilusionista said:oh, its my fault. I forgot to add the "spawnAni" function on the post (its on my animationscript).
Nevermind, now I saw the spawnAni function there.
You will need an entity for those effects. In my case, its called "aitemFX".
apescott said:I just want this icon to play when picking up food and scroll with the screen so how would I script that?![]()
Spawn an type panel entity.
Yes, the code is calling that entity and playing the FOLLOW3 animor do I give it an anim_follow3 to play? I
O Ilusionista said:Yes, the code is calling that entity and playing the FOLLOW3 animor do I give it an anim_follow3 to play? I
O Ilusionista said:Pm me your game, let me try it. I think I will have free time tomorrow.
O Ilusionista said:Pm me your game, let me try it. I think I will have free time tomorrow.
apescott said:O Ilusionista said:Pm me your game, let me try it. I think I will have free time tomorrow.
I sent my mod to you Illusion
Take your time on that script. Thank you for doing this for me ^___^