How to use multi-directional views in your games

Robert Eric In the cycle.sc file, go to (class Motion of Obj and you should find DirLoop there sitting all by itself. Remove that, and add something like this:


(if ((== (send client:heading) 0) or (== (send client:heading) 360))
(send client:loop(3))
)
(if (== (send client:heading) 90)
(send client:loop(0))
)
(if (== (send client:heading) 180)
(send client:loop(2))
)
(if (== (send client:heading) 270)
(send client:loop(1))
)
(if (== (send client:heading) 135)
(send client:loop(4))
)
(if (== (send client:heading) 225)
(send client:loop(5))
)
(if (== (send client:heading) 45)
(send client:loop(6))
)
(if (== (send client:heading) 315)
(send client:loop(7))
)


What this does, is takes the heading property from the referred object and test it against the 8 angles, 45, 90, 135,180, 225, 270, 315, and 360. 0 and 360 will both equal up. I used a view from Codename: Iceman to test this out, so use your own loop numbers, if they're different.

P.S. Excuse me if this has already been covered.
Robert Eric Hm, at the moment, if you click somewhere to move the Ego, it will not use the right loop. I haven't the time at the moment, so if anyone can tidy that flaw up for me, please do. Thanks. If no one has by the time I get back, I'll do it.
BP out of area You can't do "== 90" and "==180". What about 91 and 179? You need to change it to a >= && <= expression to cover ALL degrees.
Robert Eric Why? The heading/angle property is never set to anything between those values. Add this to rm001.sc and see:


(if(Said('run'))
FormatPrint("%d" (send gEgo:heading))
)
BP ooa Maybe..but it's good to be safe regardless. There's nothing on the other hand that I can remeber that would prevent it from being the odd values either. I did write the entire template game scripts, though don't remember completely how they work off the top of my head.
Robert Eric Oh, wait...are you Brian? I didn't recognize you since you're not using your member name. Sorry about that. I now have my script checking for the in between values...why didn't you tell me you were...you? I wouldn't have questioned you, but done anything to the script you wanted me to @_@
BP ooa It's fine to question my comments :) I wrote the template code closer to two years ago, and am not currently scripting any SCI games of my own, so I might forget things here and there. However, just as a general thought because of mouse use (of course keyboard/joystick movement would always be on even angles), it should be possible for the views to move at diffent angles other than those. When you click the mouse the angle should very rarely be on those exact angles because you wouldn't usually be clicking on exactly 90degrees from the ego for example.
Robert Eric Sorry, you were right. I was only checking the angle after I pressed up, right, page up etc. and not with mouse clicks.
cloudee1 Hey Bob, Brian, or anyone else who might know,

I've fooled around with this a little bit and so far I can't get it to work correctly.

Actually what I am trying to do is not add new loops but rather realign the current four, instead of having north, south, east, and west, I want the diagonals to be the primary directions.

I tried replacing this in cycle script:

(else
DirLoop(client (send client:heading))
)

With this:

(else
(if((>=(send client:heading)1) & (<=(send client:heading) 90))(send client:loop(2)))
(if((>=(send client:heading)91) & (<=(send client:heading) 179))(send client:loop(3)))
(if((>=(send client:heading)180) & (<=(send client:heading) 269))(send client:loop(1)))
(if((>=(send client:heading)270) & (<=(send client:heading) 360))(send client:loop(0)))
)

but ego does not change loops when direction changes
cloudee1 Uhm yeah,

well does anybody have any suggestions, I edited my previous post to include the script I am trying to work.

Ego starts in whatever loop I initialize it in but as soon as I move it goes to loop 0 and stays there.

cloudee1 Anyone? ???