I'll check out the module CW. it might make things more manageable as I'll need a lot of timers for different NPC's going about.
X
X
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu// room script file
function room_AfterFadeIn()
{
SetTimer(1, 200);
}
function room_RepExec()
{
if (!cMan1.Moving)
{
if (IsTimerExpired(1) && cMan1.x==327)
{
cMan1.Walk(564, 372, eNoBlock, eWalkableAreas);
cMan1.FaceDirection(eDirectionUp, eNoBlock);
SetTimer(1, 200);
}
if (IsTimerExpired(1) && cMan1.x==564)
{
cMan1.Walk(418, 406, eNoBlock, eWalkableAreas);
cMan1.FaceCharacter(cFemale4, eNoBlock);
cFemale4.FaceCharacter(cMan1, eNoBlock);
SetTimer(1, 240);
}
if (IsTimerExpired(1) && cMan1.x==418)
{
cMan1.Walk(563, 372, eNoBlock, eWalkableAreas);
cMan1.FaceDirection(eDirectionUp, eNoBlock);
SetTimer(1, 240);
}
if (IsTimerExpired(1) && cMan1.x==563) //Start Location
{
cMan1.Walk(327, 487, eNoBlock, eWalkableAreas);
cMan1.FaceDirection(eDirectionDown, eNoBlock);
SetTimer(1, 240);
}
}
}
function SearchSpot_Reveal(float distance)
{
float Dist=distance;
float x1 = IntToFloat(player.x - cSearchSpot1.x);
float y1 = IntToFloat(player.y - cSearchSpot1.y);
float dist1 = Maths.Sqrt(x1*x1 + y1*y1);
if (dist1 < Dist)
{
cSearchSpot1.Clickable=true;
cSearchSpot1.Transparency=0;
}
if (dist1 > Dist)
{
cSearchSpot1.Clickable=false;
cSearchSpot1.Transparency=100;
}
function room_RepExec()
{
float dist = Maths.Sqrt((player.x - oTest.X)*(player.x - oTest.X) + (player.y - oTest.Y)*(player.y - oTest.Y));
if (dist < 30.0)
{
oTest.Visible=true;
}
}
if (player.x - oTest.X <30 && player.y - oTest.Y <30)
{
oTest.Visible=true;
}
else oTest.Visible=false;
function boid_set_boid (int flock, int boid, enBoidType type, float mass, int graphic = -1,
int view = -1, enViewType view_type = vtNone, bool rotate = false);
// new module script
DynamicSprite* _is[];
int _os[];
FontType _iFont;
int _fontColor;
bool _ShowOne = false;
int _iw, _ih;
static void StackingInv::Setup(InvWindow* invWindow, FontType font, int color, bool showOne) {
_iFont = font;
_fontColor = color;
_ShowOne = showOne;
_iw = invWindow.ItemWidth;
_ih = invWindow.ItemHeight;
}
static int StackingInv::GetItemSlot(InventoryItem* item) {
if (item == null) return 0;
return _os[item.ID];
}
void _update(int iid) {
_is[iid] = DynamicSprite.Create(_iw, _ih, true);
int iq = player.InventoryQuantity[iid];
if (iq == 0 || iq == 1 && !_ShowOne) return;
String q = String.Format("%d", iq);
int w = GetTextWidth(q, _iFont);
int h = GetTextHeight(q, _iFont, w + 10);
DrawingSurface *ds = _is[iid].GetDrawingSurface();
//ds.DrawImage((_iw - Game.SpriteWidth[_os[iid]]) / 2, (_ih - Game.SpriteHeight[_os[iid]]) / 2, _os[iid]);
ds.DrawImage(0, 0, _os[iid]);
ds.DrawingColor = _fontColor;
ds.DrawString(_iw - w - 2, _ih - h - 2, _iFont, q);
ds.Release();
inventory[iid].Graphic = _is[iid].Graphic;
}
void game_start() {
_is = new DynamicSprite[Game.InventoryItemCount+1];
_os = new int[Game.InventoryItemCount+1];
for (int i = 1; i <= Game.InventoryItemCount; i++) {
_os[i] = inventory[i].Graphic;
_update(i);
inventory[i].Graphic = _is[i].Graphic;
}
}
void on_event(EventType event, int data) {
if (event == eEventAddInventory || event == eEventLoseInventory) {
_update(data);
}
}
bool _wasEMUI;
void late_repeatedly_execute_always() {
bool _isEMUI = mouse.Mode == eModeUseinv;
if (_isEMUI && !_wasEMUI) {
int slot = _os[player.ActiveInventory.ID];
mouse.ChangeModeGraphic(eModeUseinv, slot);
mouse.ChangeModeHotspot(eModeUseinv, Game.SpriteWidth[slot]/2, Game.SpriteHeight[slot]/2);
}
_wasEMUI = _isEMUI;
}
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.068 seconds with 16 queries.