This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk

Forum rules

Script Commission

Here you can find answered ScriptAPI topics.
Forum rules
By using the forum you agree to the following rules.
Locked
User avatar
Duck
Superfighter
Superfighter
Posts: 77
Joined: Tue Mar 22, 2016 2:35 am
Title: gogogadgetkeyboard
SFD Account: Shui
Started SFD: Jul 2013
Location: ->
Gender:
Contact:

Script Commission

Post by Duck » Tue Jun 21, 2016 11:09 pm


Tile type: Area Trigger

On enter method: gives a player 10-25 damage (randomly)

On leave method: multiplies the velocity forces acting on a player by 0.75% (if that's even possible)


For the on leave method I essentially wanted the players to get knocked around further and harder. I know stunning players isn't possible right now, but I was hoping that when leaving the trigger the players would temporarily suffer way worse from a fall (if they did fall).
0 x
'<'

User avatar
gwendalaze
Superfighter
Superfighter
Posts: 84
Joined: Sat Mar 19, 2016 12:55 pm
Title: Jarate Yellow Belt
Started SFD: PreAlpha 1.1.4
Location: France

Post by gwendalaze » Wed Jun 22, 2016 3:19 am

Code: Select all

Random rnd = new Random();

public void onEnter(TriggerArgs args){
	if (args.Sender is IPlayer){
		IPlayer ply = (IPlayer)args.Sender;
		ply.SetHealth(ply.GetHealth() - rnd.Next(10,26));
		if (ply.GetHealth() <= 0F) ply.Kill();
	}
}

public void onExit(TriggerArgs args){
	if (args.Sender is IPlayer){
		IObject ply  = (IObject)args.Sender;
		ply.SetLinearVelocity(Vector2.Multiply(ply.GetLinearVelocity(),0.75f));
	}
}

you may want to change 0.75 to something else according to your preferences
edit : just noticed text formating wont work in a code
1 x
- Gwendalaze, failing at being fun, just like this signature

User avatar
Duck
Superfighter
Superfighter
Posts: 77
Joined: Tue Mar 22, 2016 2:35 am
Title: gogogadgetkeyboard
SFD Account: Shui
Started SFD: Jul 2013
Location: ->
Gender:
Contact:

Post by Duck » Wed Jun 22, 2016 3:35 am

Thanks a lot gwendal!
0 x
'<'

Locked