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: Lx Xzit, Yoshi021, 5438A38A, Moderators, Semi-moderatos

Ariinui
Topic author, Duke
Duke
Ariinui
Topic author, Duke
Duke
Age: 23
Reputation: 19
Posts: 137
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: 17
Reputation: 73
Posts: 259
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: 23
Posts: 74
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: 6
Posts: 64
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: 23
Posts: 74
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: 19
Posts: 137
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: 23
Posts: 74
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:

WellyGames M
Our friend
Our friend
Avatar
WellyGames M
Our friend
Our friend
Age: 13
Reputation: 14
Posts: 79
Joined: 18 Apr 2017
Location: The Wellyverse
Google+ Twitter

Post #8by WellyGames » 12 Jun 2018, 16:43

Toy Bonnie wrote:
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

:facepalm:
The projects that I support:
Super Mario Bros.: The Great Adventure
Super Mario World MORE!
Super Mario Nova
Neo Super Mario World X
Epic Adventure of Mario
Super Mario Bros. X Greendan Edition
Super Mario and the Moon Curse
Mario's Wonderful World
NSMB - The Great Invasion
Super Mario - Rainbow Road
Super Mario Magic Brick Adventure
Adventures in 2DU

My project:
MARIO & LUIGI - The Great Quest


Return to “Script submission”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest