bind bug for players

rafhot

Member
for some time i trying to track why this bug happens, and today i noticed that it only happens with player characters and not happen to playertype: enemy


on marvel wargems there is some trees that can be picked by players and bosses to be throwed.
for players this bind was broken for some long time but enemies when grab the trees object they are corrected binded to them

when a player try to pick the same tree the tree becomes invisible until the release(throw time)
its hard to me to explain how this system work because its not made by me, its made by bwwd and maybe he can bring some light to fix this problem

heres the picture of juggenraut boss picking the tree correctly,  but any player characters of my game are not able to make the tree visible when they pick
any clues?
im using OpenBOR3925  but this bug persists since the last openbor version published at lavalit i think. Then the first openbor version from chronocrash has released it got borken again if i remember right

[attachment deleted by admin]
 
It is probably script related. So unless I see how it works I don't have a clue why it is not shown.
There is no player specific binding code, everything works exactly the same way.
 
this is the get animation whn juggernaut pick the tree, its the same script that run for enemy and for player... but for player it got invisible when player picks the tree

Code:
@script
if(frame==0)
{
    void self = getlocalvar("self");
    void e;
    clearspawnentry();
    setspawnentry("name", "trej");
    e = spawn();
    bindentity(e, self,10,1,48,1,7);
}
	@end_script


here the entire get animation
Code:
anim	get
	loop	0
	delay	8
	offset	118 195
	@cmd	spawn003 "tap" "tap" 0 0 0 8 0 1
@script
if(frame==0)
{
    void self = getlocalvar("self");
    void e;
    clearspawnentry();
    setspawnentry("name", "trej");
    e = spawn();
    bindentity(e, self,10,1,48,1,7);
}
	@end_script
	sound	data/chars/ch3/p2.wav
	frame	data/chars/ch3/fres6.gif
	offset	88 195
	frame	data/chars/ch3/gat2.gif
	frame	data/chars/ch3/gat2.gif
 
So the last parameter is 7. It will kill the entity is there's no matching animation.
I wonder what animations trej and the player have.

1 same animation
2 same frame
4 kill if no matching animation

7 = 1 + 2 + 4
 
trej is the tree itself


trej
Code:
name	trej
type	none
speed	9
gfxshadow  1
shadow   0
animationscript data/scripts/lib001.c

anim get
	loop	0
	delay	30
@script
if(frame == 0 + getglobalvar("treej") == 1){
void self = getlocalvar("self");

killentity(self);
}
@end_script
	offset	166 85
	frame	data/chars/misc/tree5.gif
	offset	166 103
	frame	data/chars/misc/tree5.gif
	offset	166 110
	frame	data/chars/misc/tree5.gif

anim idle
	loop	1
	delay	2
	offset	166 115
	frame	data/chars/misc/tree5.gif


anim walk
	loop	1
	delay	10
	offset	166 122
	frame	data/chars/misc/tree5.gif
	offset	168 123
	frame	data/chars/misc/tree5.gif
	offset	169 124
	frame	data/chars/misc/tree5.gif
	offset	170 123
	frame	data/chars/misc/tree5.gif
	offset	172 122
	frame	data/chars/misc/tree5.gif
	offset	174 121
	frame	data/chars/misc/tree5.gif
	offset	171 122
	frame	data/chars/misc/tree5.gif
	offset	168 123
	frame	data/chars/misc/tree5.gif
	offset	166 124
	frame	data/chars/misc/tree5.gif
	offset	165 123
	frame	data/chars/misc/tree5.gif
	offset	164 121
	frame	data/chars/misc/tree5.gif

anim attack1
	loop	0
	delay	30
@script
if(frame == 1){
void self = getlocalvar("self");
killentity(self);
}
if(frame==1)
{
   clearglobalvar("treej",1);
}
@end_script
	offset	146 180
	sound   data/sounds/swosh2.wav
	frame	data/chars/misc/tree5.gif
	offset	156 160
	frame	data/chars/misc/tree5.gif
	offset	166 155
	frame	data/chars/misc/tree5.gif
	offset	166 105
	frame	data/chars/misc/tree5.gif
	offset	166 105
	frame	data/chars/misc/tree5.gif

anim special
	loop	0
	delay	12
	offset	166 115
	frame	data/chars/misc/tree5.gif




anim jump
	loop	0
	delay	2
	offset	166 115
	bbox	70 100 60 60
	frame	data/chars/misc/tree5.gif




anim jumpattack
	loop	0
	delay	2
	offset	166 115
	bbox	70 100 60 60
	frame	data/chars/misc/tree5.gif



anim pain
	loop	0
	delay   2
	offset	88 195
bbox	70 100 60 100
        @cmd spawn001  "tred" "tred" 0 0 0 0 0 
@script
if(frame == 1){
void self = getlocalvar("self");
killentity(self);
}
if(frame==0)
{
   clearglobalvar("treej",1);
}
@end_script
	delay   10
	frame	data/chars/misc/0empty.gif
	frame	data/chars/misc/0empty.gif

anim fall
	loop	0
	offset	88 195
        @cmd spawn001  "tred" "tred" 0 0 0 0 0 
@script
if(frame == 1){
void self = getlocalvar("self");
killentity(self);
}
if(frame==0)
{
   clearglobalvar("treej",1);
}
@end_script
	delay   10
	frame	data/chars/misc/0empty.gif
	frame	data/chars/misc/0empty.gif

anim GRABBED	
	loop	0
	delay   5
	offset	88 195
        @cmd spawn001  "tred" "tred" 0 0 0 0 0 
@script
if(frame == 1){
void self = getlocalvar("self");
killentity(self);
}
if(frame==0)
{
   clearglobalvar("treej",1);
}
@end_script
	delay   10
	frame	data/chars/misc/0empty.gif
	frame	data/chars/misc/0empty.gif

anim bpain
	loop	0
	delay	6
         @cmd spawn001  "tred" "tred" 0 0 0 0 0 
@script
if(frame == 1){
void self = getlocalvar("self");
killentity(self);
}
if(frame==0)
{
   clearglobalvar("treej",1);
}
@end_script
	delay   10
	frame	data/chars/misc/0empty.gif
	frame	data/chars/misc/0empty.gif

anim rise
	loop	0
	offset	88 195
	delay	30
	delay   10
	frame	data/chars/misc/0empty.gif
	frame	data/chars/misc/0empty.gif


player weapon tree:

Code:
name	ch3t
health	180
mp      60
speed	9
modelflag  1
type	none
icon	data/chars/ch3/icon.gif
jumpheight 0
dust   dust
notgrab  1
atchain  1
knife    treep
gfxshadow  1

grabdistance	60
jumpmove  2
falldie   1
animationscript data/scripts/lib001.c
candamage  enemy npc obstacle
weapons  juggernaut ch3g ch3r ch3m ch3t ch3k


anim get
	loop	0
	delay   8
	offset	118 195
        @cmd spawn003  "tap" "tap" 0 0 0 8 0 1
@script
if(frame==0)
{
    void self = getlocalvar("self");
    void e;
    clearspawnentry();
    setspawnentry("name", "trej");
    e = spawn();
    bindentity(e, self,10,1,48,1,7);
}
@end_script
	sound   data/chars/ch3/p2.wav
	frame	data/chars/ch3/fres6.gif
	offset	88 195
	frame	data/chars/ch3/gat2.gif
	frame	data/chars/ch3/gat2.gif



anim idle
	loop	1
	delay	2
	bbox	70 100 60 100
	offset	88 195
	frame	data/chars/ch3/idle6.gif



anim walk
	loop	1
	delay	11
	offset	88 195
bbox	70 100 60 100
	frame	data/chars/ch3/w7.gif
	frame	data/chars/ch3/w8.gif
	frame	data/chars/ch3/w9.gif
	frame	data/chars/ch3/w10.gif
	frame	data/chars/ch3/w11.gif
	frame	data/chars/ch3/w1.gif
	frame	data/chars/ch3/w2.gif
	frame	data/chars/ch3/w3.gif
	frame	data/chars/ch3/w4.gif
	frame	data/chars/ch3/w5.gif
	frame	data/chars/ch3/w6.gif







anim attack1
	loop	0
	delay   12
        weaponframe 4  1
        throwframe	1	2  
	offset	88 195
	sound   data/chars/ch3/p3.wav
	frame	data/chars/ch3/aaa2.gif
	frame	data/chars/ch3/aaa3.gif
        delay   9
	offset	152 206
	frame	data/chars/ch3/gag4.gif
        delay   40
	frame	data/chars/ch3/gag5.gif
	delay   6
	frame	data/chars/ch3/gag5.gif




anim special
	loop	0
	delay	12
	bbox	0 0 0 0
	offset	88 195

	frame	data/chars/ch3/idle6.gif




anim jump
	loop	0
	delay	6
	offset	88 195
	frame	data/chars/ch3/idle6.gif




anim jumpattack
	loop	0
	delay	8
	offset	88 195
	frame	data/chars/ch3/idle6.gif



anim pain
	loop	0
	delay   2
	offset	88 195
        bbox	70 100 60 100
        weaponframe 2  1
	frame	data/chars/ch3/pain.gif
	frame	data/chars/ch3/pain.gif
	frame	data/chars/ch3/pain.gif

anim fall
	loop	0
	offset	88 195
	delay   30
        weaponframe 2  1
        sound   data/chars/ch3/fall.wav
	frame	data/chars/ch3/fall1.gif
	frame	data/chars/ch3/fall2.gif
	delay   40
	frame	data/chars/ch3/fall4.gif

anim GRABBED	
	loop	0
	delay   5
	offset	88 195
        weaponframe 2  1
	bbox	63 99 41 79
	frame	data/chars/ch3/pain.gif
	frame	data/chars/ch3/pain.gif
	delay   30
	frame	data/chars/ch3/pain.gif

anim bpain
	loop	0
	delay	6
        weaponframe 2  1
	offset	90 192
	bbox	65 102 46 76
	frame	data/chars/ch3/fall4.gif
	offset  87 192
	frame	data/chars/ch3/fall4.gif
	offset  89 192
	frame	data/chars/ch3/fall4.gif
	offset  87 192
	frame	data/chars/ch3/fall4.gif
	offset  89 192
	frame	data/chars/ch3/fall4.gif
	offset  87 192
	frame	data/chars/ch3/fall4.gif
	offset  89 192
	frame	data/chars/ch3/fall4.gif
	offset  87 192
	frame	data/chars/ch3/fall4.gif
	offset  89 192
	delay   50
	frame	data/chars/ch3/fall4.gif

anim rise
	loop	0
	offset	88 195
	delay	30
	frame	data/chars/ch3/fall4.gif
        delay 9
	frame	data/chars/ch3/rise1.gif
	frame	data/chars/ch3/rise2.gif
	frame	data/chars/ch3/rise3.gif
	frame	data/chars/ch3/land.gif

 
OK I found some mistakes.


  clearglobalvar("treej",1);

It should be
  setglobalvar("treej",NULL());

Also this line doesn't make sense:
if(frame == 0 + getglobalvar("treej") == 1)


I haven't check other stuff, but it seems the script needs a general fix.
 
it doesn't make any difference the fact that the get animation says "trej" with one E, and the script says "treej" with two E's? just saying...
 
Rafhot, try this.

Instead of:
@script
if(frame == 0 + getglobalvar("treej") == 1){
void self = getlocalvar("self");

killentity(self);
}
@end_script

use

@script
if(frame == 0 && getglobalvar("treej") == 1){
void self = getlocalvar("self");

killentity(self);
}
@end_script
 
tested but nothing changed :(

the curious thing with the untouched script i posted it work to npcs/enemies, and they get and throw trees as the way it should be, but for players they get an invisible tree, but they can throw it anyway

im pretty sure the problem is in this line too
if(frame == 0 + getglobalvar("treej") == 1)

but
if(frame == 0 && getglobalvar("treej") == 1)
not solve the problem yet for players
:(

 
its frame == 0 bug, change it to frame 1 and works, dont know why it was working before because i would of notice missing tree for sure ;D
So does that mean we cant bind entity from first frame? Has to be second frame now? that will create annoying blink.



anim get
loop 0
offset 88 195
delay  1
sound  data/chars/ch5/p2.wav
        bbox  0 0 0 0
        @cmd spawn003  "tap" "tap" 0 0 0 8 0 1
@script
if(frame==1)
{
    void self = getlocalvar("self");
    void ei;
    clearspawnentry();
    setspawnentry("name", "trei");
    ei = spawn();
    bindentity(ei, self,20,-1,61,1,7);
}

@end_script

frame data/chars/ch5/up1.gif
        delay  19
frame data/chars/ch5/j0.gif
 
bwwd thanks my master!
it was really the frame == 0 bug  and this bug only happend on player characters, enemies and npc works well on frame == 0
now i changed in the weapon get animation and everything works again
the build 3720 was the last one that worked frame == 0 for player

heres the line that should be changed to script run:
name ch3t
health 180
mp      60
speed 9
modelflag  1
type none
icon data/chars/ch3/icon.gif
jumpheight 0
dust  dust
notgrab  1
atchain  1
knife    treep
gfxshadow  1

grabdistance 60
jumpmove  2
falldie  1
animationscript data/scripts/lib001.c
candamage  enemy npc obstacle
weapons  juggernaut ch3g ch3r ch3m ch3t ch3k


anim get
loop 0
delay  8
offset 118 195
        @cmd spawn003  "tap" "tap" 0 0 0 8 0 1
@script
if(frame==1)
{
    void self = getlocalvar("self");
    void e;
    clearspawnentry();
    setspawnentry("name", "trej");
    e = spawn();
    bindentity(e, self,10,1,48,1,7);
}
@end_script
sound  data/chars/ch3/p2.wav
frame data/chars/ch3/fres6.gif
offset 88 195
frame data/chars/ch3/gat2.gif
frame data/chars/ch3/gat2.gif



anim idle
loop 1
delay 2
bbox 70 100 60 100
offset 88 195
frame data/chars/ch3/idle6.gif



anim walk
loop 1
delay 11
offset 88 195
bbox 70 100 60 100
frame data/chars/ch3/w7.gif
frame data/chars/ch3/w8.gif
frame data/chars/ch3/w9.gif
frame data/chars/ch3/w10.gif
frame data/chars/ch3/w11.gif
frame data/chars/ch3/w1.gif
frame data/chars/ch3/w2.gif
frame data/chars/ch3/w3.gif
frame data/chars/ch3/w4.gif
frame data/chars/ch3/w5.gif
frame data/chars/ch3/w6.gif







anim attack1
loop 0
delay  12
        weaponframe 4  1
        throwframe 1 2 
offset 88 195
sound  data/chars/ch3/p3.wav
frame data/chars/ch3/aaa2.gif
frame data/chars/ch3/aaa3.gif
        delay  9
offset 152 206
frame data/chars/ch3/gag4.gif
        delay  40
frame data/chars/ch3/gag5.gif
delay  6
frame data/chars/ch3/gag5.gif




anim special
loop 0
delay 12
bbox 0 0 0 0
offset 88 195

frame data/chars/ch3/idle6.gif




anim jump
loop 0
delay 6
offset 88 195
frame data/chars/ch3/idle6.gif




anim jumpattack
loop 0
delay 8
offset 88 195
frame data/chars/ch3/idle6.gif



anim pain
loop 0
delay  2
offset 88 195
        bbox 70 100 60 100
        weaponframe 2  1
frame data/chars/ch3/pain.gif
frame data/chars/ch3/pain.gif
frame data/chars/ch3/pain.gif

anim fall
loop 0
offset 88 195
delay  30
        weaponframe 2  1
        sound  data/chars/ch3/fall.wav
frame data/chars/ch3/fall1.gif
frame data/chars/ch3/fall2.gif
delay  40
frame data/chars/ch3/fall4.gif

anim GRABBED
loop 0
delay  5
offset 88 195
        weaponframe 2  1
bbox 63 99 41 79
frame data/chars/ch3/pain.gif
frame data/chars/ch3/pain.gif
delay  30
frame data/chars/ch3/pain.gif

anim bpain
loop 0
delay 6
        weaponframe 2  1
offset 90 192
bbox 65 102 46 76
frame data/chars/ch3/fall4.gif
offset  87 192
frame data/chars/ch3/fall4.gif
offset  89 192
frame data/chars/ch3/fall4.gif
offset  87 192
frame data/chars/ch3/fall4.gif
offset  89 192
frame data/chars/ch3/fall4.gif
offset  87 192
frame data/chars/ch3/fall4.gif
offset  89 192
frame data/chars/ch3/fall4.gif
offset  87 192
frame data/chars/ch3/fall4.gif
offset  89 192
delay  50
frame data/chars/ch3/fall4.gif

anim rise
loop 0
offset 88 195
delay 30
frame data/chars/ch3/fall4.gif
        delay 9
frame data/chars/ch3/rise1.gif
frame data/chars/ch3/rise2.gif
frame data/chars/ch3/rise3.gif
frame data/chars/ch3/land.gif
 
Well it would be great if scripts would work from first frame normally but using frame == 0 doesnt always work like it should and i think it should be disabled if it doesnt work or somehow fixed, im not sure whats the reason behind frame == 0 problems.
 
its frame == 0 bug, change it to frame 1 and works, dont know why it was working before because i would of notice missing tree for sure ;D
So does that mean we cant bind entity from first frame? Has to be second frame now? that will create annoying blink.

But that is strange, I use bind entity at frame 0 on my players and it works.

Anyway Rafhot, are your code working now?
 
yes everything working using the default code i posted on the first topics, just change the line i posted in my last post
 
now i have this annoyinf problem with frame==0 not working at all and only @cmd scripts work properly on 1st frame, i dont want my weapon to be blinking when i get it.
I dont want to load script.c into every character to use bind.
 
Back
Top Bottom