Jump to content

Photo

Help with script

FFC script help

  • Please log in to reply
2 replies to this topic

#1 Stanislas

Stanislas

    Newbie

  • Members
  • Real Name:Stanislas

Posted 13 June 2022 - 06:29 PM

So I made a variation of the spawn item at FFC script

ffc script SpawnItemAtFFC{
void run(int item1, int counter, int ammo){
while(true){
if (Game->Counter[counter] X, this->Y);
Waitframe();
}
Waitframes(300);
}
}
}

the script runs exactly how it is supposed too except the item spawns in every 300 frames multiple times when the counter is zero. how do I get so the item to stop spawning in once the item is currently on screen but keep spawning if the counter again reaches zero again after picking up spawned item?

hope that makes sense also sorry if this wasn’t posted right done on mobile.

#2 Moosh

Moosh

    Tiny Little Questmaker

  • ZC Developers

Posted 13 June 2022 - 06:40 PM

That script doesn't look like it spawns an item at all. What you want to do is create a pointer for the item that's spawned and then wait for it to despawn with isValid(). So your script would look like this.

ffc script SpawnItemAtFFC{
	void run(int item1, int counter, int ammo){
		while(true){
			if(Game->Counter[counter] == 0){
				item itm = CreateItemAt(item1, this->X, this->Y);
				while(itm->isValid()){
					Waitframe();
				}
			}
			Waitframes(300);
		}
	}
}

  • coolgamer012345 likes this

#3 Stanislas

Stanislas

    Newbie

  • Members
  • Real Name:Stanislas

Posted 14 June 2022 - 02:32 PM

Thank you this works perfectly


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users