Dear forum users! In compliance with the new European GDPR regulations, we'd just like to inform you that if you have an account, your email address is stored in our database. We do not share your information with third parties, and your email address and password are encrypted for security reasons.

New to the forum? Say hello in this topic! Also make sure to read the rules.

Can u tell me some things...

Here you can find answered ScriptAPI topics.
Forum rules
By using the forum you agree to the following rules.
Post Reply
User avatar
Jedi75
Fighter
Fighter
Posts: 33
Joined: Wed Mar 23, 2016 3:06 pm
Title: Force Fighter
SFD Alias: Jedi75
Started SFD: 1.8.0
Location: A galaxi far away
Gender:
Age: 21

Can u tell me some things...

Post by Jedi75 » Sun May 08, 2016 3:01 pm

Hello everybody I want to know some things in the SFD map editor: 1) How to set backgrounds as foreground tiles. I know there is some kind of
marker that enables it, but i didnt finded how.

2) Can somebody give me a simple script to shot bullets.

3) I need a script for spawning granades (that will explode) and molotovs.
I already tried doing it but it spawned granades as an ammo (equipable)
and not a trigered.

Thanks for any answers. :)
0 x

User avatar
Motto73
Superfighter
Superfighter
Posts: 316
Joined: Mon May 09, 2016 7:35 am
Title: Lazy ass
SFD Account: Motto73
Started SFD: Multiplayer Test Demo
Location: Sunny City
Gender:
Age: 24

Post by Motto73 » Mon May 16, 2016 9:45 am

A: 2)

You can use the SpawProjectile command. It need a position to spawn the projectile and an other postion to the shooting direction.
Here is a little script:

Code: Select all

public void Shooting(TriggerArgs args){
	IObject obj = Game.GetSingleObjectByCustomId("shootingposition");
	IObject objDir = Game.GetSingleObjectByCustomId("shootingdirection");
	Vector2 pos = obj.GetWorldPosition();
	Vector2 dir = objDir.GetWorldPosition();
	Game.SpawnProjectile(ProjectileItem.SILENCEDPISTOL, pos, dir - pos);
	Game.PlaySound("SILENCEDPISTOL", pos, 1f);
}
Be sure that you have an object, for example invisible block with no collison, set to "shootingposition" by its custom ID, and another to "shootingdirection". You can change the names whatever you want, just make sure that you match the names.

This example uses silenced pistol, but you can change it to for example SILENZEDUZI or ASSAULT.

So i suppose that you can do it with this answer, but i can't answer the other q:s.

I hope that even someone reads this...
Last edited by Motto73 on Tue May 17, 2016 11:33 am, edited 2 times in total.
0 x
Image

User avatar
Yopa
Superfighter
Superfighter
Posts: 71
Joined: Mon Mar 21, 2016 10:02 am
Title: The great cosmic christ
SFD Alias: Diablo Yoyoeho
Started SFD: 1.5.9
Location: Paris
Gender:
Age: 8

Post by Yopa » Mon May 16, 2016 10:31 am

1) Read the tutorial of the map editor. We use invisble block with (i think) targettrigger or something with trigger.

3) Read the tutorial of triggers
0 x
Hidden Content
This board requires you to be registered and logged-in to view hidden content.

Post Reply