follow and flee scripts

Description: You made a script? Submit it here to show your creation to the public, share, take reviews, provision of the help and support is here!
Moderators: Yoshi021, Lx Xzit, 5438A38A, TepigFan101, Moderators

Ariinui
Topic author, Duke
Duke
Ariinui
Topic author, Duke
Duke
Age: 23
Reputation: 10
Posts: 110
Joined: 5 Mar 2017

Post #1by Ariinui » 8 Jan 2018, 22:50

those scripts are my very first scripts created from nothing they allow an nc to follow or flee the character(s)

here they are:
the "follow"
Spoiler
With npc(sysval(Param1))
If ( Char(1).x - .x)^2 < ( Char(2).x - .x)^2 then
If Char(1).x - .x > 0 then
.facing =0
else
.facing =1
End if
Else
If Char(2).x - .x > 0 then
.facing =0
else
.facing =1
End if
End if

the "flee":
Spoiler
With npc(sysval(Param1))
If ( Char(1).x - .x)^2 < ( Char(2).x - .x)^2 then
If Char(1).x - .x > 0 then
.facing =1
else
.facing =0
End if
Else
If Char(2).x - .x > 0 then
.facing =1
else
.facing =0
End if
End if

now, let me explain how they are working
first, the script determine wich player's the nearest from the npc then it'll change the npc's facing so the npc will always "walk" in the character's direction (or the opposite direction in the "flee" script

I should also mention the two problems with this script:
1- it only check the X axis of the player so it's not the best for a level with many height
2- if the player stand on or under the npc, the npc became a little glitchy

I hope this can be usefull ^^

Eri7 M
Count
Count
Avatar
Eri7 M
Count
Count
Age: 16
Reputation: 52
Posts: 225
Joined: 19 Dec 2016
Location: Germany , Bonn

Post #2by Eri7 » 19 Jan 2018, 0:59

Nice , this might be useful for me.
Join the discord server about Nova Projects.
Image

I support:
Image

Toy Bonnie
Our friend
Our friend
Avatar
Toy Bonnie
Our friend
Our friend
Reputation: 16
Posts: 56
Joined: 11 Aug 2016

Post #3by Toy Bonnie » 19 Feb 2018, 2:01

Thanks, now i can finally remake the Deep Cheep & Eep Cheep From NSMBWii
Not :beta:
:whistle:
:windows: :bomb: :windows: :bomb: :windows: :bomb: :fox:

EmeraldMaster777 M
Our friend
Our friend
Avatar
EmeraldMaster777 M
Our friend
Our friend
Age: 17
Reputation: 4
Posts: 63
Joined: 3 Dec 2016
Location: Emerald Isle
Website Twitter

Post #4by EmeraldMaster777 » 19 Feb 2018, 5:06

How do you make the scripts work with the npc?
The Colorful Update: :)

DARK PACK: https://www.dropbox.com/sh/epbffmzwmfrwvza/AADBgoPu9GoWHhJzhJWOMaw9a?dl=0

EXTRAS: https://www.dropbox.com/sh/gi77jvb458wrxbe/AAAEhqooy9xCW_jf9Qo6fm8Oa?dl=0

EXTRAS 2: https://www.dropbox.com/sh/vybp3b9ct7urudm/AAAFEQ3TSOc2JhFmJWv8JTt1a?dl=0

SMW Remastered Alpha 1.0 (Cancelled): https://www.dropbox.com/sh/77yv8chapzt2jog/AAD3tu3ka6u8-x7stbTOKDR0a?dl=0

Toy Bonnie
Our friend
Our friend
Avatar
Toy Bonnie
Our friend
Our friend
Reputation: 16
Posts: 56
Joined: 11 Aug 2016

Post #5by Toy Bonnie » 19 Feb 2018, 18:25

EmeraldMaster777 wrote:How do you make the scripts work with the npc?
I Know! Use event "Level - Start - Others - Script"
Not :beta:
:whistle:
:windows: :bomb: :windows: :bomb: :windows: :bomb: :fox:

Ariinui
Topic author, Duke
Duke
Ariinui
Topic author, Duke
Duke
Age: 23
Reputation: 10
Posts: 110
Joined: 5 Mar 2017

Post #6by Ariinui » 19 Feb 2018, 20:10

Toy Bonnie wrote:
EmeraldMaster777 wrote:How do you make the scripts work with the npc?
I Know! Use event "Level - Start - Others - Script"
no, you use the npc's settings
Image
use the parallel execution too

Toy Bonnie
Our friend
Our friend
Avatar
Toy Bonnie
Our friend
Our friend
Reputation: 16
Posts: 56
Joined: 11 Aug 2016

Post #7by Toy Bonnie » 20 Feb 2018, 2:43

Ariinui wrote:
Toy Bonnie wrote:
EmeraldMaster777 wrote:How do you make the scripts work with the npc?
I Know! Use event "Level - Start - Others - Script"
no, you use the npc's settings
Image
use the parallel execution too
Ohhh i get it
Not :beta:
:whistle:
:windows: :bomb: :windows: :bomb: :windows: :bomb: :fox:


Return to “Script submission”