The Dink Network

Reply to Re: stalkers and invisible walls

If you don't have an account, just leave the password field blank.
Username:
Password:
Subject:
Antispam: Enter Dink Smallwood's last name (surname) below.
Formatting: :) :( ;( :P ;) :D >( : :s :O evil cat blood
Bold font Italic font hyperlink Code tags
Message:
 
 
September 29th 2012, 02:24 PM
spike.gif
Another method would be to use a loop. E.g.

VARÄRDINK:
int &crappyx = sp_x(1,-1)

if (&crappyx < 200)
{
//stuff you want to run here
}

wait(100)
goto varärdink


Keep in mind that's not a pixel-accurate method, since there's a short wait between each time it checks the coordinate.

If you added a script_attach(1000) there, the loop would survive screenchanges, and could be used for followers, to create the follower each time you change screens. I find using loops inherently deplorable, though, especially permanent ones, so I'd avoid it unless you absolutely need to.

Another method to create a follower would be to have a sprite/script on EVERY screen of the dmod (every one you want the follower on anyway), which then checks if the follower dude should be there. Adding a sprite on every screen is annoying, but less deplorable. The script could look like this:

void main
{
if (&ISHOULDHAVEFOLLOWER == 0)
sp_active(&current_sprite,0)

//otherwise, add follower's stats and stuff here, for example:
sp_follow(&current_sprite,1)
set_smooth_follow(1)
sp_brain(&current_sprite,16)
sp_speed(&current_sprite,1)

//wait(1)
//^ might need this so that the follower doesn't appear on the wrong side of the screen, not sure

//move follower to Dink
int &dinkx = sp_x(1,-1)
int &dinky = sp_y(1,-1)
sp_x(&current_sprite,&dinkx)
sp_y(&current_sprite,&dinky)
}