Thegr8test
Member
Can you guys suggest the best method to use for these kinds of attacks? I want to shoot from the ground to the sky and reverse
void shooter2(void vName, float fX, float fY, float fZ, float Vx, float Vy, float Vz)
{//Spawns projectile next to caller and move it with speed
//vName: Model name of entity to be spawned in
//fX: X location adjustment
//fY: Y location adjustment
//fZ: 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);
return vSpawn;
}
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.
}
name FlameT
type none
lifespan 2
nolife 1
subject_to_hole 1
no_adjust_base 0
subject_to_gravity 0
subject_to_platform 0
offscreenkill 200
candamage player npc obstacle
anim idle
delay 6
offset 20 43
hitfx data/sounds/burnt.wav
frame data/chars/misc/magic/flameT01.png
frame data/chars/misc/magic/flameT02.png
burn 7 22 27 25 12 1
frame data/chars/misc/magic/flameT03.png
frame data/chars/misc/magic/flameT04.png
frame data/chars/misc/magic/flameT05.png
frame data/chars/misc/magic/flameT03.png
frame data/chars/misc/magic/flameT04.png
frame data/chars/misc/magic/flameT06.png
burn 5 17 30 31 12 1
frame data/chars/misc/magic/flameT07.png
frame data/chars/misc/magic/flameT08.png
frame data/chars/misc/magic/flameT07.png
attack 0
frame data/chars/misc/magic/flameT09.png
frame data/chars/misc/magic/flameT10.png
frame data/chars/misc/magic/flameT11.png
frame data/chars/misc/magic/flameT12.png
frame data/chars/misc/empty.gif
Bloodbane said:The best way is to use script like this to shoot the projectile:
void shooter2(void vName, float fX, float fY, float fZ, float Vx, float Vy, float Vz)
{//Spawns projectile next to caller and move it with speed
//vName: Model name of entity to be spawned in
//fX: X location adjustment
//fY: Y location adjustment
//fZ: 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);
return vSpawn;
}
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.
}
and make the projectile like this:
name FlameT
type none
lifespan 2
nolife 1
subject_to_hole 1
no_adjust_base 0
subject_to_gravity 0
subject_to_platform 0
offscreenkill 200
candamage player npc obstacle
anim idle
delay 6
offset 20 43
hitfx data/sounds/burnt.wav
frame data/chars/misc/magic/flameT01.png
frame data/chars/misc/magic/flameT02.png
burn 7 22 27 25 12 1
frame data/chars/misc/magic/flameT03.png
frame data/chars/misc/magic/flameT04.png
frame data/chars/misc/magic/flameT05.png
frame data/chars/misc/magic/flameT03.png
frame data/chars/misc/magic/flameT04.png
frame data/chars/misc/magic/flameT06.png
burn 5 17 30 31 12 1
frame data/chars/misc/magic/flameT07.png
frame data/chars/misc/magic/flameT08.png
frame data/chars/misc/magic/flameT07.png
attack 0
frame data/chars/misc/magic/flameT09.png
frame data/chars/misc/magic/flameT10.png
frame data/chars/misc/magic/flameT11.png
frame data/chars/misc/magic/flameT12.png
frame data/chars/misc/empty.gif
This projectile won't remove itself after it hits something. If you want it to do that, simply set follow up mechanic which changes animation to invisible animation. No need for extra function to remove the projectile cause lifespan will remove it whichever animation it is playing
Back to the shooter2 function above, the last 3 parameters define projectile's velocity allowing you to set where it's going to fly (up or down) relative to shooter's facing direction
Bloodbane said:The best way is to use script like this to shoot the projectile:
here is some code
I do read the manual and always have it open. But not everything is explained down to my level.
Do I use "killentity" inside the script to get rid of the missiles when they hit? What is the 'Hit' command?
name PlasmaD
type none
lifespan 1
candamage enemy obstacle
subject_to_gravity 0
anim idle
loop 1 1 3
delay 6
followanim 1
followcond 1
landframe 4
offset 52 35
attack 61 33 14 14 15 1 0 0 0 0
frame data/chars/Ironman/r3.gif
frame data/chars/Ironman/r4.gif
frame data/chars/Ironman/r3.gif
frame data/chars/Ironman/r4.gif
frame data/chars/misc/empty.gif
anim follow1
delay 6
offset 52 35
frame data/chars/misc/empty.gif
And can I switch the missles over to aquiring targets after a delay?
And can I switch the missles over to aquiring targets after a delay?