Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> In need of help with a script condition, says it all
Real Ninjason
post Aug 18 2012, 12:36 AM
Post #1


Level 3
Group Icon

Group: Member
Posts: 37
Type: Writer
RM Skill: Skilled




Good day,

I am trying to create a common event that's conditioned with the information of which Player being the leader of the Group.

So I thought like:

If Player [010] is Leader of the Group, say: "Hey, Player 10, how are you?"

Something like that.


That's what I managed so far:

$game_actor[10].position = 0

But there seems to be something wrong with the condition, only I cannot figure it out, since I don't excel at scripting.

I'd be grateful for any help.


__________________________
Theres only 1 Ninja
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Aug 18 2012, 12:55 AM
Post #2


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




If you're planning to build a condition, you'll need this: (I assume you're using RMVXACE)

CODE
$game_actor[10].position == 0


Remeber that in Ruby, the operator "=" assigns a value to the variable, while the operator "==" compares two things.
You've actually written "set game actor[10] position to 0" and not "tell me if actor position is 0".
I think this is a useful thing to know smile.gif

Anyway, I've another idea to do what you want to:

call script:
CODE
$game_variables[1] = $game_party.actors[0].id


WARNING: this method works in RMXP, I don't know if RMVXACE uses the very same method (I hope so).

This way, you store the first party member id into a variable (in the example, variable #1)
Then...

condition: if Variable[1] == 10
[...]
else
if Variable[1] == 3
[...]
else
if Variable[1] == 10
[...]
else
[...]
end
end
end

I hope this can help...

Jens

This post has been edited by Jens of Zanicuud: Aug 18 2012, 01:06 AM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
Legacy
post Aug 18 2012, 04:28 AM
Post #3


B★RS Coding Ninja
Group Icon

Group: Global Mod
Posts: 1,414
Type: Scripter
RM Skill: Advanced
Rev Points: 15




It would help us out if you specified the engine that you are using.. Either way, you can look at The Law G14's tutorial on controlling flow.

http://www.rpgrevolution.com/forums/index....showtopic=57020

hope that helps smile.gif


__________________________
Freelance Programmer (C#, C++, Ruby)
#onegameamonth


Have you seen the new Unity3D sections?..
Unity 3D Discussion
Unity Script Development
Unity Projects
Go to the top of the page
 
+Quote Post
   
Real Ninjason
post Aug 19 2012, 07:45 AM
Post #4


Level 3
Group Icon

Group: Member
Posts: 37
Type: Writer
RM Skill: Skilled




Not to sound cocky, but I am wondering why you are asking for my Engine, since I did post it in the RMXP Discussion.

But I do use the RPG Maker XP.

I will have a look at your Link, Legacy, and thank you for your detailed post, Jens - but is they still valid for me, not using VAce?

This post has been edited by Real Ninjason: Aug 19 2012, 07:47 AM


__________________________
Theres only 1 Ninja
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Aug 19 2012, 09:53 AM
Post #5


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




QUOTE (Real Ninjason @ Aug 19 2012, 05:45 PM) *
Not to sound cocky, but I am wondering why you are asking for my Engine, since I did post it in the RMXP Discussion.

But I do use the RPG Maker XP.

I will have a look at your Link, Legacy, and thank you for your detailed post, Jens - but is they still valid for me, not using VAce?


Okay, simply use the second method. I have only RMXP, but never seen that (.position) method.
Anyway, if you use the second method, you'll be able to do that.
In my project there's exactly that system implemented.

Two ways to do that:

A condition like that:
CODE
$game_actor[10].index == 0


or the second method I've mentioned before:

call script:

[code]$game_variables[1] = $game_party.actors[0].id[/code

This way, you store the first party member id into a variable (in the example, variable #1)
Then...

condition: if Variable[1] == 10
[...]
else
if Variable[1] == 3
[...]
else
if Variable[1] == 10
[...]
else
[...]
end
end
end

I hope this can help,

Jens

This post has been edited by Jens of Zanicuud: Aug 19 2012, 09:53 AM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
Real Ninjason
post Aug 19 2012, 11:30 AM
Post #6


Level 3
Group Icon

Group: Member
Posts: 37
Type: Writer
RM Skill: Skilled




QUOTE (Jens of Zanicuud @ Aug 19 2012, 07:53 PM) *
A condition like that:
CODE
$game_actor[10].index == 0


That gives me a:


But I understood and successfully implemented your second Method - thank you very much.



__________________________
Theres only 1 Ninja
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Aug 19 2012, 12:57 PM
Post #7


Dark Jentleman
Group Icon

Group: Local Mod
Posts: 904
Type: Scripter
RM Skill: Skilled
Rev Points: 120




I'm glad it worked smile.gif
I forgot a "s" ($game_actor instead of $game_actors) and that caused your bug...
I apologise,

Jens

This post has been edited by Jens of Zanicuud: Aug 19 2012, 01:01 PM


__________________________
"Thorns are the rose's sweetest essence..."
-Jens of Zanicuud


Games I'm working on:
>

official website: TryAdIne eFfeCt

>

Games I worked on (mainly as a scripter):
>
(Warning: it's a 3rr3's project and it's in Italian!)


Awards

Go to the top of the page
 
+Quote Post
   
Real Ninjason
post Aug 21 2012, 08:46 AM
Post #8


Level 3
Group Icon

Group: Member
Posts: 37
Type: Writer
RM Skill: Skilled




Hmm I have set every palyable Character in the Variable already, otherwise I would try your other method - but it works and I was told never to mess up a working system.

So thank you again.


__________________________
Theres only 1 Ninja
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 25th May 2013 - 07:03 PM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker