Looking for alternative "offscreenkill" options

PS_VITA

Active member
Hey guys - there are these conveyor belts in the game I'm learning from and I'm trying to "kill" them ( delete them) at a certain point
when the player reaches ta coordinate in the map.

Conveyor belt Code

Code:
name	belt2
type    none
shadow  0
antigravity 100
facing 1
setlayer 1
offscreenkill  1400


anim idle  #BELTS MOVES left
	loop	1
	delay	20
	offset	1170 32
	frame	data/levels/st2b/bel3.gif
      frame	data/levels/st2b/bel2.gif
      frame	data/levels/st2b/bel1.gif

Now here's the code for the part of the map where I'm trying to destroy these belts

Code:
#-------------------------------------

Group	1 1
at	0

scrollx 450 3600
at   0

spawn	brrow1
flip 1
coords  540 1306 80
at   0

spawn timer
coords  100 800 354
at      685

#-------------------------------------

what kinda of code can I use instead of offscreenkill ?

I'm trying to kill the belt at say...

"kill belt"
coords  100 800 354
at      685

Any ideas are appreciated.

 
I wonder why you need to remove this belt.

But anyways, here's entity I used when I want to remove certain entities:
Code:
name		Killer
type		none


anim idle
@script
    void self = getlocalvar("self");			//Caller.

    if(frame==1){
      char Name = getentityproperty(self,"name");
      void vEntity;                                       //Target entity placeholder.
      int  iEntity;                                       //Entity enumeration holder.
      char iName;                                         //Entity Name.
      int  iMax      = openborvariant("count_entities");  //Entity count.

      //Enumerate and loop through entity collection.
      for(iEntity=0; iEntity<iMax; iEntity++){
        vEntity = getentity(iEntity);                 //Get target entity from current loop.
        iName   = getentityproperty(vEntity, "name"); //Get target name.

        //Same alias but different entity?
        if(iName == Name && vEntity != self){
          killentity(vEntity);
        }
      }
    }
    if(frame==2){
      killentity(self);
    }
@end_script
	delay	10
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif

Spawning example:
Code:
spawn	Killer
alias  Belt
coords  160 200
at   400

When Killer is spawned at scrollpos 400, it will remove any entities with Belt alias before removing itself.

HTH
 
Bloodbane said:
I wonder why you need to remove this belt.

But anyways, here's entity I used when I want to remove certain entities:
Code:
name		Killer
type		none


anim idle
@script
    void self = getlocalvar("self");			//Caller.

    if(frame==1){
      char Name = getentityproperty(self,"name");
      void vEntity;                                       //Target entity placeholder.
      int  iEntity;                                       //Entity enumeration holder.
      char iName;                                         //Entity Name.
      int  iMax      = openborvariant("count_entities");  //Entity count.

      //Enumerate and loop through entity collection.
      for(iEntity=0; iEntity<iMax; iEntity++){
        vEntity = getentity(iEntity);                 //Get target entity from current loop.
        iName   = getentityproperty(vEntity, "name"); //Get target name.

        //Same alias but different entity?
        if(iName == Name && vEntity != self){
          killentity(vEntity);
        }
      }
    }
    if(frame==2){
      killentity(self);
    }
@end_script
	delay	10
	offset	1 1
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif
	frame	data/chars/misc/empty.gif

Spawning example:
Code:
spawn	Killer
alias  Belt
coords  160 200
at   400

When Killer is spawned at scrollpos 400, it will remove any entities with Belt alias before removing itself.

HTH

I work with the openbor vita version and the belt was causing a major drop in frames compared to the pc version.Once I removed the belt the game ran at full frames again. But I didn't want to remove it completely,  just at the right timing. And offscreen kill was tricky to do because of the length of the belts.

And thanks for the script,  how do I create a script document  by the way? It's  not a .txt file extension that goes into the script folder right?

Also whenever I call upon the script if I change
spawn Killer
alias  Belt
coords  160 200
at  1

It will delete it right away,  right?
As in , no need to be 400 pixels away?

EDIT: And one more question what if I don't care about using coordinates - what If I just wanted to delete the belt no matter where it is on the stage?

Example:
spawn Killer
alias  Belt


EDIT:# 3

So I copied the script and changed the extension  of my .TXT file to .C , placed that the script named killer.c in the script folder
and ran the following code :

spawn Killer
alias  belt1
coords  82 1182
at  0

spawn Killer
alias  belt2
coords  82 1182
at  0

But now suddenly everyone including the player started to die - as if they all had a heart attack or something...
It go to the point to where after a few steps I just kept dying and res pawing , sucking dry all my credit.s

WTH did I do wrong? LOL
 
Back
Top Bottom