Page 1 of 1

Script problem Co-op

Posted: Fri Sep 22, 2023 7:48 am
by JojofansWhen
Hello. My friend and i play sfd on occasion and we use scripts on local match but how do we modify each player with scripts for example my friend wants to have jetpack script activated but i want Grappling Hook activated. How do we do that? And is there a way to keep stats in next match when using command+ script? My friend and i keep typing scripts and it is frustrating to play like that. Any easier alternatives to recommend for us? :roll:

Re: Script problem Co-op

Posted: Wed Oct 11, 2023 10:35 pm
by Mighty Spirit the 2
I have one very simple version of the JetPack script by "ClockworkDice", and that works via any player walking like this:

Code: Select all

	foreach(IPlayer ply in Game.GetPlayers()){
		if(ply.IsWalking){
			ply.SetLinearVelocity(ply.GetLinearVelocity() + new Vector2(0,3));
		}
	}
The absolute easiest way would be to write in your characters name here, so the script only works for you. For example your name is "Chakan".

Code: Select all

	foreach(IPlayer ply in Game.GetPlayers()){
		if(ply.IsWalking && ply.Name == "Chakan"){
			ply.SetLinearVelocity(ply.GetLinearVelocity() + new Vector2(0,3));
		}
	}
Another way is to directly write in the slots of both Users players, regardless of name. Like the example below only works for the host player, you can write [1] in there to only apply for the 2nd connected player.

Code: Select all

	foreach(IPlayer ply in Game.GetPlayers()){
		if(ply.IsWalking && ply == Game.GetActiveUsers()[0].GetPlayer() ){
			ply.SetLinearVelocity(ply.GetLinearVelocity() + new Vector2(0,3));
		}
	}
I haven't seen the code for Grappling Hook, but if it's the similar as the one above, just edit for your friend name/slot in.

I don't know about Commands+, i think you should ask the author Odex.