Scripts I need

Description: Have idea for a script, but you can't make it? Post it here!
Moderators: Yoshi021, Lx Xzit, 5438A38A, Semi-moderatos, Moderators

Alvespires M
Topic author, Count
Count
Avatar
Alvespires M
Topic author, Count
Count
Age: 19
Reputation: 17
Posts: 228
Joined: 20 Aug 2016
Location: Koopa Troopa Beach

Post #1by Alvespires » 7 May 2017, 17:21

Hello.I'm really nedding a really simple Script,How do you know if one player is standing left or right from one particular NPC?I really need it but have no idea at all.

Also,I also need a way of making an NPC or/and Background do exactly the same movement as player(Well,just to jump,accuratly chase right/left,fall at same speed,Etc.)

The last one is not a script,but a question,This really bothered me a lot,and I'm here anyways,so I'm going to ask:There's a Global Variable Limit?Having too much make your episode laggy?

Well,that's it.
Not really up to it.

Yoshi021 M
Moderator
Moderator
Avatar
Yoshi021 M
Moderator
Moderator
Age: 19
Reputation: 147
Posts: 683
Joined: 15 Feb 2016
Location: Yoshi's Island

Post #2by Yoshi021 » 7 May 2017, 19:13

1) For the first, simple name an NPC in the advanced settings II with the name 'name' and make two variables, one called 'ID' and the other called 'dir'. When the script is activated dir = -1 when the player is to the left from the NPC and 1 when he is right to the NPC.

Code: Select all

v(id) = getIDbyName("name")
do
  if NPC(v(id)).x > char(1).x then
    v(dir) = -1
  else
   v(dir) = 1    
  end if
  call sleep(1)   
loop
   


2)Place a BGO in a layer called 'Att-Player1(name)' and the bgo will do the same movements as the player.
3) I haven't used a lot od global variables, but you should be able to have 100 gv without the game lagging.
Links
ImageImageImage
Image
Image
"Going to University is FUN!" :pardon:

Alvespires M
Topic author, Count
Count
Avatar
Alvespires M
Topic author, Count
Count
Age: 19
Reputation: 17
Posts: 228
Joined: 20 Aug 2016
Location: Koopa Troopa Beach

Post #3by Alvespires » 9 May 2017, 17:57

Actually,there's a way to make that background/NPC chase you just when a condiction is met?And stand WHERE it is when it's not instanded of backing to it's original place?
And,there's a way of making it move the opposing direction?
Not really up to it.

NESTED ERNEST M
Marquis
Marquis
Avatar
NESTED ERNEST M
Marquis
Marquis
Reputation: 18
Posts: 159
Joined: 23 Sep 2017
Location: Perú, Lima
Website

Post #4by NESTED ERNEST » 7 Oct 2017, 3:33

v(id) = getIDbyName("name")

do
call sleep(1)
loop until condiction

do
if char(1).x+16< NPC(v(id)).x+(weightnpc/2) then
v(dir) = -1
else
v(dir) = 1
end if

call sleep(1)
loop


and to programming(check in execution parallax) your npc on another script
Spoiler
with npc(sysval(param1))
if val(dir)=-1 then
.xsp=-2
elseif val(dir)=1 then
.xsp=2
end if
end with
Programming NPCs in SMBX-38A is fun:

ROCKMAN GIF IN SMBX 38A

Image


Return to “Script requests”

Who is online (over the past 5 minutes)

Users browsing this forum: 3 guests