SA-MP Forums Archive
Dynamic objects not showing up.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Dynamic objects not showing up.. (/showthread.php?tid=478470)



Dynamic objects not showing up.. - Phil_Cutcliffe - 29.11.2013

Hi my dynamic objects used to show up like plants when planting weed etc or my boombox but it's not showing up any more. I've been scripting my GM for over 2 years and had a break for a couple months so not sure what's causing this. Just updated my streamer but to no avail. Any ideas?


Re: Dynamic objects not showing up.. - Pottus - 29.11.2013

You need to use Streamer_SetFloatData and set the drawdistance here is a function for it.

pawn Код:
stock AddDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 300.0, drawdistance = 300.0)
{
    new oid;
    oid = CreateDynamicObject(modelid, x, y, z, rx, ry, rz, worldid, interiorid, playerid, streamdistance);
    Streamer_SetFloatData(STREAMER_TYPE_OBJECT, oid, E_STREAMER_DRAW_DISTANCE, drawdistance);
    return oid;
}



Re: Dynamic objects not showing up.. - Phil_Cutcliffe - 30.11.2013

Sorry it's not a Dynamic object I'm using. I used CreateObject. Does that make a difference?


Re: Dynamic objects not showing up.. - Baboon - 30.11.2013

Quote:
Originally Posted by Phil_Cutcliffe
Посмотреть сообщение
Sorry it's not a Dynamic object I'm using. I used CreateObject. Does that make a difference?
Yes it makes a difference.
When using CreateObject, it will only create a 1000 objects that will be visible to the players. So that's why some plants probably got "removed".
When using CreateDynamicObject, the object limit has been exceeded greatly. So switch to dynamic objects.


Re: Dynamic objects not showing up.. - Phil_Cutcliffe - 30.11.2013

Quote:
Originally Posted by Strawhats
Посмотреть сообщение
Yes it makes a difference.
When using CreateObject, it will only create a 1000 objects that will be visible to the players. So that's why some plants probably got "removed".
When using CreateDynamicObject, the object limit has been exceeded greatly. So switch to dynamic objects.
Ahhhh! Thanks alot man! Can I simply change CreateObject to CreateDynamicObject? I imagine it has different settings. That would just be too easy!


Re: Dynamic objects not showing up.. - Konstantinos - 30.11.2013

Quote:
Originally Posted by Phil_Cutcliffe
Посмотреть сообщение
Ahhhh! Thanks alot man! Can I simply change CreateObject to CreateDynamicObject? I imagine it has different settings. That would just be too easy!
Yes, you'll just need to replace CreateObject with CreateDynamicObject. The rest of the parameters get the default values. I'd also recommend to use AddDynamicObject instead (what Pottus posted above) because you can use draw distance too!

PS: Add the float tag before the drawdistance in the stock:
pawn Код:
stock AddDynamicObject(modelid, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz, worldid = -1, interiorid = -1, playerid = -1, Float:streamdistance = 300.0, Float:drawdistance = 300.0)
to get rid of the tag mismatch warning and you're done.


Re: Dynamic objects not showing up.. - Phil_Cutcliffe - 01.12.2013

Hey guys thanks for the suggestions.

I converted my weed plants to dynamic objects this morning like this:

Код:
wplant[playerid] = CreateDynamicObject( 776, x, y, z-20 , 0, 0, 96, -1, -1, -1, 50);
Now they don't show up. Why would this be?


Re: Dynamic objects not showing up.. - Phil_Cutcliffe - 01.12.2013

I also tried putting it like this..

wplant[playerid] = CreateDynamicObject( 776, x, y, z-20 , 0, 0, 96, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));


Re: Dynamic objects not showing up.. - Patrick - 01.12.2013

[i]Try these, because all you did is -20 z = Up & Down, you probably decreased the z too much, that's why the object won't show because it's underground
pawn Код:
wplant[playerid] = CreateDynamicObject( 776, x, y, z , 0, 0, 96, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));



Re: Dynamic objects not showing up.. - Phil_Cutcliffe - 01.12.2013

Quote:
Originally Posted by pds2k12
Посмотреть сообщение
[i]Try these, because all you did is -20 z = Up & Down, you probably decreased the z too much, that's why the object won't show because it's underground
pawn Код:
wplant[playerid] = CreateDynamicObject( 776, x, y, z , 0, 0, 96, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));
That's not the issue I have a timer which lifts the objects here is the timer.

Код:
forward GrowWeed(playerid);
public GrowWeed(playerid)
{
    ClearAnimations(playerid);
    new Float:x, Float:y, Float:z;
	GetObjectPos(wplant[playerid], x, y, z);
    MoveDynamicObject(wplant[playerid], x, y, z+1, 0.5, 0, 0, 0);
    SetTimerEx("GrowWeed2", 300000, 0, "d", playerid);//
}

forward GrowWeed2(playerid);
public GrowWeed2(playerid)
{
    new Float:x, Float:y, Float:z;
	GetObjectPos(wplant[playerid], x, y, z);
    MoveDynamicObject(wplant[playerid], x, y, z+1, 0.5, 0, 0, 0);
    SendClientMessage(playerid, COLOR_SYSTEM, "Your plant has grown");
    Ready[playerid] = 1;
    isplanting[playerid] = 0;
}

forward GrowWeed3(playerid);
public GrowWeed3(playerid)
{
    new Float:x, Float:y, Float:z;
	GetObjectPos(wplant[playerid], x, y, z);
    MoveDynamicObject(wplant[playerid], x, y, z-1, 0.5, 0, 0, 0);
    SendClientMessage(playerid, COLOR_SYSTEM, "Your plant is dieing");
    SetTimerEx("GrowWeed4", 180000, 0, "d", playerid);//
}

forward GrowWeed4(playerid);
public GrowWeed4(playerid)
{
    new Float:x, Float:y, Float:z;
	GetObjectPos(wplant[playerid], x, y, z);
    MoveDynamicObject(wplant[playerid], x, y, z-2, 0.5, 0, 0, 0);
    SendClientMessage(playerid, COLOR_SYSTEM, "Your plant has died!");
}
Also tried changing how I first put the object down like this..

Код:
wplant[playerid] = CreateDynamicObject( 776, x, y, z-20 , 0, 0, 96, GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid));