Respawn on wall problem

Daniel99j

Member
Hi guys!
I have a problem with respawn players after dead, on my stage is characters walk down and circumvent a building, but when they dies, game spawn them on the top of building (offscreen :( ) ...i try fix it by tutorial from WhiteDragon, but that do nothing... have anybody idea how to fix it?

this is layout of the stage (red dot is position where is player killed, green dot is position where is player respawned)

resps.jpg


and this is content of my level .txt

Code:
music		data/music/dump.bor
background      data/bgs/dump/back.gif
bossmusic	data/music/victory.bor
panel		data/bgs/dump/n01.gif	none	none
frontpanel      data/bgs/dump/front.gif	none	none
order	a
settime	99
noslow	1
wall    0 340 0 0 925 1005 90 999
wall    25 210 0 20 305 285 40 999
wall    565 190 0 20 415 395 30 999
wall    1182 285 -162 -20 710 710 150 999

levelscript @script
void main() {
	changelevelproperty("camerazoffset", -100);
    	clearglobalvar();
}

@end_script

loadingbg data/bgs/loading.gif 50 255 200 -20 -20 0

#-----------------
 
Are you still using scripts from White Dragon? cause if you do it would be harder for me to fix the problem since I'm not the one who created the script

But if you're not using those, I can suggest you some scripts to solve this

BTW by default, even with walls, player will be pushed away from wall to avoid this bug, so I don't understand what's wrong here
 
Now I doesn't using WD scripts, they wasn't function... If you try suggest some scripts for me, I be very grateful to you... I need some script to respawn player at the same place, where he died before
 
I hope you don't have holes or unsafe traps cause if turtle respawns on last spot, he might be hit by the trap again

Anyways, let me try making some scripts for you :)

[couple hours later]

Alright, I've made the scripts. Declare this script in RESPAWN animation:

anim respawn
@script
    if(frame == 1){
      void self = getlocalvar("self"); //Get calling entity
      int iPIndex = getentityproperty(self,"playerindex");

      int x = getglobalvar("x"+iPIndex);
      int z = getglobalvar("z"+iPIndex);

      if(x!=NULL() && z!=NULL()){
        changeentityproperty(self,"position", x, z);
        setglobalvar("x"+iPIndex, NULL());
        setglobalvar("z"+iPIndex, NULL());
      }
    }
@end_script
...

If you don't have that animation then make one :)

Then save this script in data/scripts folder as TurtleDead.c

Code:
void main()
{
    void self = getlocalvar("self"); //Get calling entity
    int iPIndex = getentityproperty(self,"playerindex");
    int x = getentityproperty(self,"x");
    int z = getentityproperty(self,"z");

    setglobalvar("x"+iPIndex, x);
    setglobalvar("z"+iPIndex, z);
}

then declare it in header text like this:

ondeathscript data/scripts/turtledead.c

HTH
 
It works! Thank you! ...but now game respawn him somewhere in heaven and I must wait to him fall down to the ground.. do you have idea where is the problem?  :)

Level .txt
Code:
music		data/music/dump.bor
background      data/bgs/dump/back.gif
bossmusic	data/music/victory.bor
panel		data/bgs/dump/n01.gif	none	none
frontpanel      data/bgs/dump/front.gif	none	none
order	a
settime	99
noslow	1
wall    0 340 0 0 925 1005 90 999
wall    25 210 0 20 305 285 40 999
wall    565 190 0 20 415 395 30 999
wall    1182 285 -162 -20 710 710 150 999
spawn1	40 75 2
spawn2	60 95 2

cameratype	1
cameraoffset 0 -60

loadingbg data/bgs/loading.gif 50 255 200 -20 -20 0

#-----------------
spawn	 lvstart
coords	 1 1
at	 0

spawn pizza
coords	770 200
at 15

spawn oildrum
coords	430 180
at 15

group 1 3
at    15
wait
at  15

spawn purple4
map	6
aggression -60
coords	420 210
at 15

group 2 3
at    1200
wait
at  1150

spawn purple3
aggression 60
coords	340 310
at 1150

spawn purple3
aggression -50
coords	360 330
at 1150

spawn purple3
aggression -20
coords	-30 320
at 1150

spawn purple2
aggression 40
coords	340 310
at 1150

spawn purple1
aggression 160
coords	360 330
at 1150

spawn purple4
aggression -60
coords	-30 320
at 1150

wait
at  1150

group 100 100
at    1150
wait
at  1150

   #TRAP

spawn soudek
coords	370 300
at 1250

spawn soudek
coords	370 330
at 1400

   #NEXT GROUP

group 2 4
at    1350
wait
at  1350

spawn foot1
map   5
aggression -100
coords	340 310
at 1350

spawn foot1
map   5
aggression 30
coords	360 330
at 1350

spawn foot1
map   5
aggression -50
coords	-30 320
at 1350

spawn foot1
map   5
aggression -30
coords	340 310
at 1350

spawn foot1
map   5
aggression 70
coords	360 330
at 1350

spawn foot1
map   5
aggression -160
coords	-30 320
at 1350

spawn foot1
map   5
aggression -90
coords	-30 320
at 1350

group 100 100
at    1351
wait
at  1351

   #BIRDS

spawn bird1
coords	360 310
at 1380

spawn bird1
coords	395 330
at 1380

spawn bird1
coords	415 315
at 1380

   #FINAL GROUP

group 2 3
at    1560
wait
at  1560

spawn Foot1Mace
map   10
aggression -100
coords	340 310
at 1560

spawn foot1spa1
map   5
aggression 30
coords	90 295
at 1560

spawn Foot1Mace
map   10
aggression -50
coords	-30 320
at 1560

music   data/music/boss.bor
at        1560

spawn rock1
dying	 2 40 15
coords	270 295
at 1560

spawn foot1
map   5
aggression -100
coords	340 310
at 1560

spawn foot1
map   5
aggression 30
coords	360 330
at 1560

spawn foot1
map   5
aggression -50
coords	-30 320
at 1560

spawn foot1spa1
map   5
aggression -30
coords	90 295
at 1560

spawn foot1spa1
map   5
aggression 70
coords 150 295
at 1560

group   1 1
at   1560

spawn   delay
coords   160 200
at   0

spawn   Victory1
boss    1
coords   160 200
at   0

spawn   Victory2
coords   160 200
at   0

spawn   delay
health   2000
coords   160 200
at   0

and here is character .txt
Code:
name	 Leo
health	 100
mp	 75
type	 player
nolife   1
speed    7
throw 3 3
running 18 4 1 2 0 5
shadow 2
jumpmove 1 1
jumpheight 4
atchain 1 2 3 4
icon     data/chars/leo/icon.gif
weapons leoboard leo
diesound	data/sounds/shell.wav
dust    dust
com	a2	freespecial2
com	u a	freespecial
com	a4	freespecial3
com	a3	freespecial4
remap	data/chars/leo/xxx.gif	data/chars/leo/map0.gif
remap	data/chars/leo/xxx.gif	data/chars/leo/map1.gif
remap	data/chars/leo/xxx.gif	data/chars/leo/map2.gif
#remap	data/chars/leo/xxx.gif	data/chars/leo/map3.gif
animationscript data/scripts/randsound.c
ondeathscript   data/scripts/turtledead.c


anim waiting
	loop	1
	offset	65 140
	delay	160
        frame   data/chars/leo/wait1.gif

anim spawn
	loop	0
	offset	85 140
	delay	8
        frame   data/chars/leo/resp1.gif
        frame   data/chars/leo/resp2.gif
        frame   data/chars/leo/resp3.gif
	delay	12
        frame   data/chars/leo/resp5.gif
        frame   data/chars/leo/resp4.gif
        frame   data/chars/leo/resp5.gif
        frame   data/chars/leo/resp4.gif
        frame   data/chars/leo/resp5.gif
        frame   data/chars/leo/resp4.gif
        frame   data/chars/leo/resp5.gif
        frame   data/chars/leo/resp4.gif
        frame   data/chars/leo/resp5.gif
	delay	8
        frame   data/chars/leo/resp3.gif
        frame   data/chars/leo/resp2.gif
        frame   data/chars/leo/resp1.gif

anim respawn
@script
    if(frame == 1){
      void self = getlocalvar("self"); //Get calling entity
      int iPIndex = getentityproperty(self,"playerindex");

      int x = getglobalvar("x"+iPIndex);
      int z = getglobalvar("z"+iPIndex);

      if(x!=NULL() && z!=NULL()){
        changeentityproperty(self,"position", x, z);
        setglobalvar("x"+iPIndex, NULL());
        setglobalvar("z"+iPIndex, NULL());
      }
    }
@end_script
	loop	0
	offset	85 140
	delay	8
        frame   data/chars/leo/resp1.gif
        frame   data/chars/leo/resp2.gif
        frame   data/chars/leo/resp3.gif
	delay	12
        frame   data/chars/leo/resp5.gif
        frame   data/chars/leo/resp4.gif
        frame   data/chars/leo/resp5.gif
        frame   data/chars/leo/resp4.gif
        frame   data/chars/leo/resp5.gif
        frame   data/chars/leo/resp4.gif
        frame   data/chars/leo/resp5.gif
        frame   data/chars/leo/resp4.gif
        frame   data/chars/leo/resp5.gif
	delay	8
        frame   data/chars/leo/resp3.gif
        frame   data/chars/leo/resp2.gif
        frame   data/chars/leo/resp1.gif

...
 
That's strange, it doesn't happen to me at all
Anyways, try changing the script in respawn animation to this:

@script
    if(frame == 1){
      void self = getlocalvar("self"); //Get calling entity
      int iPIndex = getentityproperty(self,"playerindex");

      int x = getglobalvar("x"+iPIndex);
      int z = getglobalvar("z"+iPIndex);

      if(x!=NULL() && z!=NULL()){
        changeentityproperty(self,"position", x, z, 0);
        setglobalvar("x"+iPIndex, NULL());
        setglobalvar("z"+iPIndex, NULL());
      }
    }
@end_script

This script will ground turtle on respawn
 
this is wrong
wall    0 340 0 0 925 1005 90 999
wall    25 210 0 20 305 285 40 999
wall    565 190 0 20 415 395 30 999
wall    1182 285 -162 -20 710 710 150 999

it sould be like this
wall    0 340 0 0 925 1005 90 5999
wall    25 210 0 20 305 285 40 5999
wall    565 190 0 20 415 395 30 5999
wall    1182 285 -162 -20 710 710 150 5999
 
Back
Top Bottom