O Ilusionista
Captain 80K
Hi everyone.
During the development of my projects, I just stop creating simple codes several tasks. Even I do not have the same level of programmers as BB and DC, I think it does not hurt to share, they can be useful And you will see that I am a random fan
All those codes should be saved in a file and called in ANIMATIONSCRIPT.
Some of those codes are based in codes from other coders, remember to credit then also, ok?
Useful when you need to change from one animation to another, where an attack will be performed.
Based on anichangee function (I forgot the author).
Note: there are some cases where anichange should be used, thanks to the flags. Read more about it here
Usage:
@cmd anichangeattack "ANI_FOLLOW5"
This will make the entity go to FOLLOW5 animation.
Useful to make the entity to do a jump into random directions. One of the nice ways to use it is to put this in your itens when they are spawned from obstacles
Usage:
@cmd randomJump 3 4
3 - X velocity
4 - Y velocity
The same case as above, but including the Z axis too.
Usage:
@cmd randomJumpZ 3 4 2
3 - X velocity
4 - Y velocity
2 - Z velocity
Useful for changing the entity name.
NOTE: There is a limitation in this code - it won't work on the first frame of spawn/respawn animation.
You need to put it on the second frame.
Usage:
@cmd changeName "New_Name"
5. unbind
If you use a binded entity to another entity and need to unbind it, this code is useful for that.
Usage:
@cmd unbind
Spawns another entity (which needs to be loaded first) at random X and Y positions, giving a very cool looking.
This code uses the Spawn01 function by Damon Caskey and you need that function to make it works.
See the exemple below - the little flames were generated by this code
Usage:
@cmd spawnRandom "name" 50 100
Keep in mind that the given value will work from its negative value to the positive value. IOW, 50 pixels means "from -50 to 50 pixels"
The same case of above, but works for X, Y and Z axis.
This code was based on a modified version of Damon Caskey's Spawn01 function, that doesn't cares for direction, called spawn000. You need that spawn000 function to make this work.
spawn000
spawnRandomZ
Usage:
@cmd spawnRandom "name" 50 100 120
Refill the MP bar with the desired value.
Usage:
@cmd refill 50
Refill 50 points of MP
Spend some MP
Usage:
@cmd mpcost 50
Drains 50 points of MP
--------------------------------------
I have many other codes to share, I will edit this post once I have time.
See ya,
O Ilusionista.
During the development of my projects, I just stop creating simple codes several tasks. Even I do not have the same level of programmers as BB and DC, I think it does not hurt to share, they can be useful And you will see that I am a random fan
All those codes should be saved in a file and called in ANIMATIONSCRIPT.
Some of those codes are based in codes from other coders, remember to credit then also, ok?
1. anichangeattack
Useful when you need to change from one animation to another, where an attack will be performed.
Based on anichangee function (I forgot the author).
Note: there are some cases where anichange should be used, thanks to the flags. Read more about it here
C-like:
void anichangeattack(void Ani){
// Douglas Baldan / O Ilusionista
// version 1.0 - 23/07/13 --- [url=http://www.brazilmugenteam.com]www.brazilmugenteam.com[/url]
// Animation changer into attacks
void self = getlocalvar("self");
performattack(self, openborconstant(Ani)); //Change the animation
}
Usage:
@cmd anichangeattack "ANI_FOLLOW5"
This will make the entity go to FOLLOW5 animation.
2. randomJump
Useful to make the entity to do a jump into random directions. One of the nice ways to use it is to put this in your itens when they are spawned from obstacles
C-like:
void randomJump (int vx, int vy)
{
// Douglas Baldan / O Ilusionista
// version 1.0 - 23/07/13 --- [url=http://www.brazilmugenteam.com]www.brazilmugenteam.com[/url]
// makes the entity execute a jump into a random direction
void vSelf = getlocalvar("self"); // Gets the caller
int Xr = rand()%vx+0.5; // Random X vel, between the chosen velocity
int Yr = 2+rand()%vy; // Random Y vel + 2, to ensure a vertical jump, between the chosen velocity
if (Yr <0){ // If the Y is negative,
Yr = Yr*-1; // Make it positive
}
changeentityproperty(vSelf, "velocity", Xr, 0, Yr); // Change entity velocity
}
Usage:
@cmd randomJump 3 4
3 - X velocity
4 - Y velocity
3. randomJumpZ
The same case as above, but including the Z axis too.
C-like:
void randomJumpZ (int vx, int vy, int vz)
{
// Douglas Baldan / O Ilusionista
// version 1.0 - 23/07/13 --- [url=http://www.brazilmugenteam.com]www.brazilmugenteam.com[/url]
// makes the entity execute a jump into a random direction
void vSelf = getlocalvar("self"); // Gets the caller
int Xr = rand()%vx; // Random X vel, between the chosen velocity
int Yr = 3+rand()%vy; // Random Y vel + 1, to ensure a vertical jump, between the chosen velocity
int Zr = rand()%vz; // Random Z vel, between the chosen velocity
if (Yr <0){ // If the Y is negative,
Yr = Yr*-1; // Make it positive
}
changeentityproperty(vSelf, "velocity", Xr, Zr, Yr); // Change entity velocity
}
Usage:
@cmd randomJumpZ 3 4 2
3 - X velocity
4 - Y velocity
2 - Z velocity
4. changeName
Useful for changing the entity name.
NOTE: There is a limitation in this code - it won't work on the first frame of spawn/respawn animation.
You need to put it on the second frame.
C-like:
void changeName (void iName)
// Change entity name
// 24.09.2013 - Douglas Baldan - O Ilusionista --- [url=http://www.brazilmugenteam.com]www.brazilmugenteam.com[/url]
{
void vSelf = getlocalvar("self");
changeentityproperty(vSelf, "name", iName);
}
Usage:
@cmd changeName "New_Name"
5. unbind
If you use a binded entity to another entity and need to unbind it, this code is useful for that.
C-like:
void unbind ()
// unbind entity
// 24.09.2013 - Douglas Baldan - O Ilusionista --- [url=http://www.brazilmugenteam.com]www.brazilmugenteam.com[/url]
{
void vSelf = getlocalvar("self");
bindentity(vSelf, NULL());
}
Usage:
@cmd unbind
6. spawnRandom
Spawns another entity (which needs to be loaded first) at random X and Y positions, giving a very cool looking.
This code uses the Spawn01 function by Damon Caskey and you need that function to make it works.
See the exemple below - the little flames were generated by this code
C-like:
void spawnRandom(void vName,int vx, int vy )
// Spawn entity at random places
// 24.09.2013 - Douglas Baldan - O Ilusionista
// Based in Damon Caskey "spawn01" function, and you need that function to make it works.
// vx = maximum X position range
// vy = maximum Y position range
{
int Xr = rand()%vx; // Random X pos
int Yr = rand()%vy; // Random Y pos
spawn01(vName,vx+Xr,vy+Yr,0);
}
Usage:
@cmd spawnRandom "name" 50 100
Keep in mind that the given value will work from its negative value to the positive value. IOW, 50 pixels means "from -50 to 50 pixels"
7. spawnRandomZ
The same case of above, but works for X, Y and Z axis.
This code was based on a modified version of Damon Caskey's Spawn01 function, that doesn't cares for direction, called spawn000. You need that spawn000 function to make this work.
spawn000
C-like:
void spawn000(void vName, float fX, float fY, float fZ)
{
//spawn01 (Generic spawner) without direction
//Damon Vaughn Caskey
//07/06/2007 -- Modified by Douglas Baldan/O Ilusionista
//
//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.
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.
}
spawnRandomZ
C-like:
void spawnRandomZ(void vName,int vx, int vy, int vz )
// Spawn entity at random places
// 24.09.2013 - Douglas Baldan - O Ilusionista
// Based in Damon Caskey "spawn01" function, and you need that function to make it works.
// vx = maximum X position range
// vy = maximum Y position range
// vz = maximum Z position range
{
int Xr = rand()%vx; // Random X pos
int Yr = rand()%vy; // Random Y pos
int Zr = rand()%vz; // Random Z pos
spawn000(vName,Xr,Yr,Zr);
}
Usage:
@cmd spawnRandom "name" 50 100 120
8. refill
Refill the MP bar with the desired value.
C-like:
void refill(int iValue)
//Refill the MP bar with the desired value.
//Douglas Baldan - O Ilusionista
{
void self = getlocalvar("self");
changeentityproperty(self, "mp", iValue);
}
Usage:
@cmd refill 50
Refill 50 points of MP
9. mpcost
Spend some MP
C-like:
void mpcost( int MCost)
{// Spend some MP
void self = getlocalvar("self");
void MPower = getentityproperty(self,"mp"); //get mp
changeentityproperty(self, "mp", MPower-MCost);//consume mp
}
Usage:
@cmd mpcost 50
Drains 50 points of MP
--------------------------------------
I have many other codes to share, I will edit this post once I have time.
See ya,
O Ilusionista.
Last edited: