Bruce
Active member
Hello everyone,
I've been having so much problem with spawning an NPC Ally.
I have so spent so much time with trials and errors and still don't understand why it is not working :-(
So far the only thing that works for me is
but I can not bind it to the player.
Lately I have found Bloodbane's Spawn and Bind script which makes easier for me to use the bind number to send the commands to the NPC Ally.
There is a spawn01 function within Bloodbane's Spawn and Bind script. I believe the others have been using this spawn01 function too.
I've been using this script for non-NPC Allies and they are working fine, but somehow I've been having so much trouble spawning an NPC Ally with it.
The spawn01/02 functions are the issues that I am having with because I had this kind of problems with it before whenever spawning an NPC Ally, so I ended up using the Summonframe instead.
Now I need to use this spawn01/02 functions for binding. I need to understand more about these functions, not just copy and paste.
Therefore I hope you guys can help me clear out some of my questions and I would be greatly appreciated for your time and help.
Anyway, can you guys take a look at the code and see what I am doing wrong?
Thank you so much.
NPC Ally:
Player:
scripts:
I thought I understood what's written in the scripts, but then they don't work like I expected :-(
I've been having so much problem with spawning an NPC Ally.
I have so spent so much time with trials and errors and still don't understand why it is not working :-(
So far the only thing that works for me is
Code:
Summonframe / Spawnframe
subentity
Lately I have found Bloodbane's Spawn and Bind script which makes easier for me to use the bind number to send the commands to the NPC Ally.
There is a spawn01 function within Bloodbane's Spawn and Bind script. I believe the others have been using this spawn01 function too.
I've been using this script for non-NPC Allies and they are working fine, but somehow I've been having so much trouble spawning an NPC Ally with it.
The spawn01/02 functions are the issues that I am having with because I had this kind of problems with it before whenever spawning an NPC Ally, so I ended up using the Summonframe instead.
Now I need to use this spawn01/02 functions for binding. I need to understand more about these functions, not just copy and paste.
Therefore I hope you guys can help me clear out some of my questions and I would be greatly appreciated for your time and help.
Anyway, can you guys take a look at the code and see what I am doing wrong?
Thank you so much.
NPC Ally:
Code:
name SummonHelper
type npc
subtype follow
lifespan 90
nolife 1
hostile enemy
candamage enemy obstacle
speed 10
running 25 1 1 5 1
turndelay 0 3
bounce 1
noquake 1
#shadow 3
gfxshadow 1 3
flash flash
bflash guard
dust dust01
nodieblink 1
falldie 2
animationscript data/scripts/drago.c
anim idle
range 60 800
loop 1
offset 184 271
bbox 0 0 0 0
delay 5
frame data/chars/players/Summons/SummonHelper/idle01.gif
frame data/chars/players/Summons/SummonHelper/idle02.gif
frame data/chars/players/Summons/SummonHelper/idle01.gif
anim walk
loop 1
offset 184 271
bbox 0 0 0 0
delay 8
frame data/chars/players/Summons/SummonHelper/Walk01.gif
frame data/chars/players/Summons/SummonHelper/Walk02.gif
frame data/chars/players/Summons/SummonHelper/Walk03.gif
frame data/chars/players/Summons/SummonHelper/Walk04.gif
frame data/chars/players/Summons/SummonHelper/Walk05.gif
frame data/chars/players/Summons/SummonHelper/Walk06.gif
frame data/chars/players/Summons/SummonHelper/Walk07.gif
anim run
range 0 700
loop 1
offset 184 271
bbox 0 0 0 0
delay 6
frame data/chars/players/Summons/SummonHelper/Walk01.gif
frame data/chars/players/Summons/SummonHelper/Walk02.gif
frame data/chars/players/Summons/SummonHelper/Walk03.gif
frame data/chars/players/Summons/SummonHelper/Walk04.gif
frame data/chars/players/Summons/SummonHelper/Walk05.gif
frame data/chars/players/Summons/SummonHelper/Walk06.gif
frame data/chars/players/Summons/SummonHelper/Walk07.gif
anim attack1
range 0 70
fastattack 1
loop 0
offset 184 271
bbox 0 0 0 0
delay 5
frame data/chars/players/Summons/SummonHelper/SKill1_01.gif
frame data/chars/players/Summons/SummonHelper/SKill1_02.gif
frame data/chars/players/Summons/SummonHelper/SKill1_03.gif
frame data/chars/players/Summons/SummonHelper/SKill1_04.gif
frame data/chars/players/Summons/SummonHelper/SKill1_05.gif
attack1 187 166 113 84 3 0 0 0 20 15
delay 5
frame data/chars/players/Summons/SummonHelper/SKill1_05.gif
delay 5
frame data/chars/players/Summons/SummonHelper/SKill1_06.gif
frame data/chars/players/Summons/SummonHelper/SKill1_07.gif
frame data/chars/players/Summons/SummonHelper/SKill1_08.gif
frame data/chars/players/Summons/SummonHelper/SKill1_09.gif
frame data/chars/players/Summons/SummonHelper/SKill1_10.gif
# Skill 1
anim freespecial1
fastattack 1
loop 0
offset 184 271
bbox 0 0 0 0
delay 8
frame data/chars/players/Summons/SummonHelper/SKill2_01.gif
frame data/chars/players/Summons/SummonHelper/SKill2_02.gif
frame data/chars/players/Summons/SummonHelper/SKill2_03.gif
frame data/chars/players/Summons/SummonHelper/SKill2_04.gif
frame data/chars/players/Summons/SummonHelper/SKill2_05.gif
frame data/chars/players/Summons/SummonHelper/SKill2_06.gif
@cmd projectile 1 "AcidSpits" 30 0 60 # X Z Y
frame data/chars/players/Summons/SummonHelper/SKill2_07.gif
# Skill 2
anim freespecial2
fastattack 1
loop 0
offset 184 271
bbox 0 0 0 0
delay 10
frame data/chars/players/Summons/SummonHelper/SKill2_01.gif
frame data/chars/players/Summons/SummonHelper/SKill2_02.gif
frame data/chars/players/Summons/SummonHelper/SKill2_03.gif
frame data/chars/players/Summons/SummonHelper/SKill2_04.gif
frame data/chars/players/Summons/SummonHelper/SKill2_05.gif
frame data/chars/players/Summons/SummonHelper/SKill2_06.gif
@cmd projectile 1 "AcidSpits" 30 0 60 # X Z Y
frame data/chars/players/Summons/SummonHelper/SKill2_07.gif
delay 5
frame data/chars/players/Summons/SummonHelper/SKill2_01.gif
frame data/chars/players/Summons/SummonHelper/SKill2_02.gif
frame data/chars/players/Summons/SummonHelper/SKill2_03.gif
frame data/chars/players/Summons/SummonHelper/SKill2_04.gif
frame data/chars/players/Summons/SummonHelper/SKill2_05.gif
frame data/chars/players/Summons/SummonHelper/SKill2_06.gif
@cmd projectile 1 "AcidSpits" 30 0 60 # X Z Y
frame data/chars/players/Summons/SummonHelper/SKill2_07.gif
delay 5
frame data/chars/players/Summons/SummonHelper/SKill2_01.gif
frame data/chars/players/Summons/SummonHelper/SKill2_02.gif
frame data/chars/players/Summons/SummonHelper/SKill2_03.gif
frame data/chars/players/Summons/SummonHelper/SKill2_04.gif
frame data/chars/players/Summons/SummonHelper/SKill2_05.gif
frame data/chars/players/Summons/SummonHelper/SKill2_06.gif
@cmd projectile 1 "AcidSpits" 30 0 60 # X Z Y
frame data/chars/players/Summons/SummonHelper/SKill2_07.gif
delay 10
frame data/chars/players/Summons/SummonHelper/SKill2_07.gif
delay 5
frame data/chars/players/Summons/SummonHelper/SKill2_08.gif
# Teleport to the player
anim freespecial3
fastattack 1
loop 0
offset 184 271
bbox 0 0 0 0
@cmd projectile 1 "Teleport" 0 0 100 # X Z Y
delay 5
frame data/chars/players/Summons/SummonHelper/idle01.gif
anim turn
loop 0
offset 184 271
bbox 0 0 0 0
delay 5
frame data/chars/players/Summons/SummonHelper/Walk01.gif
frame data/chars/players/Summons/SummonHelper/Walk02.gif
frame data/chars/players/Summons/SummonHelper/Walk03.gif
frame data/chars/players/Summons/SummonHelper/Walk04.gif
frame data/chars/players/Summons/SummonHelper/Walk05.gif
frame data/chars/players/Summons/SummonHelper/Walk06.gif
frame data/chars/players/Summons/SummonHelper/Walk07.gif
anim death
loop 0
offset 480 954
delay 5
sound data/chars/players/Summons/SummonHelper/die1.wav
frame data/chars/players/Summons/Appear01.gif
frame data/chars/players/Summons/Appear02.gif
frame data/chars/players/Summons/Appear03.gif
frame data/chars/players/Summons/Appear04.gif
frame data/chars/players/Summons/Appear05.gif
@cmd killentity getlocalvar("self")
delay 5
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
anim fall
loop 0
offset 184 271
landframe 2
delay 2
bbox 0 0 0 0
frame data/chars/players/Summons/SummonHelper/fall01.gif
delay 999
frame data/chars/players/Summons/SummonHelper/fall01.gif
delay 1
frame data/chars/players/Summons/SummonHelper/fall02.gif
anim rise
loop 0
offset 184 271
delay 55
frame data/chars/players/Summons/SummonHelper/fall02.gif
delay 20
frame data/chars/players/Summons/SummonHelper/rise01.gif
delay 14
frame data/chars/players/Summons/SummonHelper/fall02.gif
delay 10
frame data/chars/players/Summons/SummonHelper/rise01.gif
frame data/chars/players/Summons/SummonHelper/rise02.gif
Player:
Code:
# Summon "SummonHelper"
anim freespecial11
fastattack 1
hitfx data/sounds/beat3.wav
loop 0
offset 303 400
bbox 0 0 0 0
@script
if(frame == 4){
SummonAndBind3("SummonHelper", 20, 20, 20, 10); // "Entity" X Y Z Bind#
}
@end_script
sound data/chars/players/auron/summoning01s.wav
delay 4
frame data/chars/players/auron/summon01.gif
frame data/chars/players/auron/summon02.gif
frame data/chars/players/auron/summon03.gif
frame data/chars/players/auron/summon04.gif
delay 3
@cmd projectile 1 "dust03" 0 0 0
frame data/chars/players/auron/land01.gif
# SummonHelper Skill 1 (2 Acid Spits)
anim freespecial12
fastattack 1
hitfx data/sounds/beat3.wav
loop 0
offset 303 400
bbox 252 219 89 181
sound data/chars/players/auron/summon02.wav
delay 2
frame data/chars/players/auron/Provoke01.gif
frame data/chars/players/auron/Provoke02.gif
frame data/chars/players/auron/Provoke03.gif
@cmd CastSummonSkill 10 "ANI_freespecial1" # BindNumber "Summon_Skill"
delay 2
frame data/chars/players/auron/land01.gif
# SummonHelper Skill 2 (3 Acid Spits)
anim freespecial13
fastattack 1
hitfx data/sounds/beat3.wav
loop 0
offset 303 400
bbox 252 219 89 181
sound data/chars/players/auron/summon02.wav
delay 2
frame data/chars/players/auron/Provoke01.gif
frame data/chars/players/auron/Provoke02.gif
frame data/chars/players/auron/Provoke03.gif
@cmd CastSummonSkill 10 "ANI_freespecial2"
delay 2
frame data/chars/players/auron/land01.gif
# SummonHelper Skill 3 (teleports to player)
anim freespecial14
fastattack 1
hitfx data/sounds/beat3.wav
loop 0
offset 303 400
bbox 252 219 89 181
sound data/chars/players/auron/summon02.wav
delay 2
frame data/chars/players/auron/Provoke01.gif
frame data/chars/players/auron/Provoke02.gif
frame data/chars/players/auron/Provoke03.gif
@cmd CastSummonSkill 10 "ANI_freespecial3"
delay 2
frame data/chars/players/auron/land01.gif
scripts:
I thought I understood what's written in the scripts, but then they don't work like I expected :-(
Code:
//By Bloodbane
void SummonAndBind(void EntityName, float dx, float dy, float dz, int EntityBindNum)
{ // Spawn entity, store it and bind it
void self = getlocalvar("self");
void Spawn;
Spawn = spawn01(EntityName, dx, dy, 0);
setentityvar(self, EntityBindNum, Spawn); // Store spawned entity to be killed later
bindentity(Spawn, self, dx, dz, dy, 0, 0, 1); // Bind spawned entity
}
Code:
void spawn01(void EntityName, float fX, float fY, float fZ)
{
//spawn01 (Generic spawner)
//Damon Vaughn Caskey
//07/06/2007
//
//Spawns entity next to caller.
//
//EntityName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fY: Z location adjustment.
//fZ: Y 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", EntityName); //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 spawn02(void EntityName, float fX, float fY, float fZ)
{
//spawn02 (Generic spawner)
//
//Spawns entity in a position not relative to caller.
//
//EntityName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fY: Z location adjustment.
//fZ: Y location adjustment.
void vSpawn; //Spawn object.
clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", EntityName); //Acquire spawn entity by name.
vSpawn = spawn(); //Spawn in entity.
changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
return vSpawn; //Return spawn.
}