UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

spawned entity doesn't change model

broken avatar :(
Created 12 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
3,566 views
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
The entity that i spawn doesn't change model when i use setmodel(). I used iprints to make sure that everything was defined + developer commands but everything supposedly works.

How i have spawn() and setmodel() set up:
Code Snippet
Plaintext
new_powerup = spawn("script_model", level.pl[place].origin);
new_powerup setmodel(level.powerups[item]);

Why is this happening?
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
what is this?
Code Snippet
Plaintext
level.powerups[item]
how did you defined it?
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
what is this?
Code Snippet
Plaintext
level.powerups[item]
how did you defined it?

Like this:

Code Snippet
Plaintext
item = randomint(level.powerups.size);
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
im not really sure but doesnt "array.size" returns the length of the array not an string from it?
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
im not really sure but doesnt "array.size" returns the length of the array not an string from it?

It returns the amount of entities in an array. In other words, the value "item" has an integer from 0-array.size. So if i only have two entities "item" can be either 0-1.

0 is the first value in an array, 1 the second, etc.
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
so without vars it would look like this lol
Code Snippet
Plaintext
new_powerup setmodel(1);
weird also when do level.powerups returns an item?
Last Edit: June 10, 2014, 04:56:43 am by jjbradman
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
so without vars it would look like this
Code Snippet
Plaintext
new_powerup setmodel(1);
weird also when do level.powerups returns an item?

No, it'd look like:

Code Snippet
Plaintext
new_powerup setmodel(level.powerups[0]);

or

Code Snippet
Plaintext
new_powerup setmodel(level.powerups[1]);

"item" can be 0 or 1 if the size of the array is 2. So there are 2 different possibilities.

But i don't think that is the issue. The script_model just won't change...
broken avatar :(
×
broken avatar :(
drago
Location: mx
Date Registered: 5 July 2013
Last active: 7 years ago
Posts
941
Respect
Forum Rank
The Decider
Primary Group
Member
My Contact & Social Links
More
×
jjbradman's Groups
jjbradman's Contact & Social Linksjjbradmanjjbradmanjjbradman
but anyways the result from level.powerups[0] would be a number. not an string which you need it to be the name of a model
But i don't think that is the issue. The script_model just won't change...
try just seting the model without all your extra stuff to see if its really the model not the code
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
but anyways the result from level.powerups[0] would be a number. not an string which you need it to be the name of a modeltry just seting the model without all your extra stuff to see if its really the model not the code

It is a string.



And everything is defined in-game:

Spoiler: click to open...

broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
When I randomize something, I like to do it like this. Try this maybe?
Code Snippet
Plaintext
powerup()
{
       model = random();
       new_powerup = spawn("script_model", level.pl[place].origin);
       new_powerup setmodel(model);
}

random()
{
rand = randomint(3);// 3 is how many things it will randomize, in this case there are 4 things it will randomize
model = undefined;

if(rand == 0)
{
         model = "model1";
        }
        if(rand == 1)
{
         model = "model2";
        }
        if(rand == 2)
{
         model = "model3";
        }
        if(rand == 3)
{
         model = "model4";
        }
return model;
}
Last Edit: June 10, 2014, 05:27:38 pm by Ege115
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
When I randomize something, I like to do it like this. Try this maybe?
Code Snippet
Plaintext
powerup()
{
       model = random();
       new_powerup = spawn("script_model", level.pl[place].origin);
       new_powerup setmodel(model);
}

random()
{
rand = randomint(3);// 3 is how many things it will randomize, in this case there are 4 things it will randomize
model = undefined;

if(rand == 0)
{
         model = "model1";
        }
        if(rand == 1)
{
         model = "model2";
        }
        if(rand == 2)
{
         model = "model3";
        }
        if(rand == 3)
{
         model = "model4";
        }
return model;
}

Same thing, the only difference is that i use an array.
broken avatar :(
×
broken avatar :(
Location: se
Date Registered: 30 July 2013
Last active: 2 years ago
Posts
517
Respect
Forum Rank
Zombie Enslaver
Primary Group
Scripter
My Groups
More
My Contact & Social Links
More
×
Ege115's Groups
Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
Ege115's Contact & Social LinksEge115
I know but as you said your solution didn't work, I thought I could show you how I did as this way have always worked for me.

But yea arrays makes it much better.

 
Loading ...