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
> Status effects inflicted as chance instead of 100%, Rmxp
Vexus
post Feb 27 2012, 04:14 AM
Post #1


Level 19
Group Icon

Group: Revolutionary
Posts: 396
Type: Mapper
RM Skill: Intermediate




This is something that I find crappy because by default if you get hit you'll get poisoned unless your fortunate enough on having higher strengths over it.

I prefer it as a chance and so I was going to do it via an event.

Now the problem is how can I know which will be the target? The rest of the event is fairly easy you just need to make a random variable and a conditional to your specific percentage then inflict the status effect if it succeeds.

Anyone know what could I do?

Thanks.


__________________________
Current Project/s:
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Feb 27 2012, 12:39 PM
Post #2


Dark Jentleman
Group Icon

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




If you intend to do it via common event, there's a rather simple way (well, more or less)

1. add this line just below Scene Battle 1,

CODE
class Scene_Battle
attr_reader :active_battler #add this line
def main #etc, etc, etc


2. in the common event, target id is:

CODE
$scene.active_battler.current_action.target_index


Do percentage calculation in Variable X (where X is a number) then:

>Conditional branch: if Variable X == tot (or anything else) then

call script:

CODE
battler = $scene.active_battler
tgt_id = battler.current_action.target_index
if battler.is_a?(Game_Actor)
tgt = $game_troop.smooth_target_enemy(tgt_id)
else
tgt = $game_party.smooth_target_actor(tgt_id)
end
tgt.add_state(ID)


>end branch

Where ID is the state id.

I hope this was clear enough...

Jens

This post has been edited by Jens of Zanicuud: Feb 29 2012, 09:13 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
   
Vexus
post Feb 27 2012, 12:59 PM
Post #3


Level 19
Group Icon

Group: Revolutionary
Posts: 396
Type: Mapper
RM Skill: Intermediate




The percentage calculation got me a little confused.

So I call the variable x by random number or fixed value? Like if it was it's actual percentage of working?

And by conditional branch if x variable is equal or higher, equal or less? I know how to make it with a random variable but the percentage value is a bit confusing how to make it on conditional branch.

Thanks jens.


__________________________
Current Project/s:
Go to the top of the page
 
+Quote Post
   
Jens of Zanicuud
post Feb 27 2012, 01:08 PM
Post #4


Dark Jentleman
Group Icon

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




Let's say you want Poison to hit in the 35% of cases.

Variable[X] = Random number from 0 to 100

>If Variable[X] < 35

call script

>branch end

This is what I meant.
I'm sorry to have been so confusing...

Jens


__________________________
"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
   
Vexus
post Feb 27 2012, 01:22 PM
Post #5


Level 19
Group Icon

Group: Revolutionary
Posts: 396
Type: Mapper
RM Skill: Intermediate




Ok thanks I'll try it out now and don't worry hehe smile.gif

[Edit]

I think it worked (It took the bite to poison target 3 tries at 30% chance).

All I couldn't understand how to implement was:

QUOTE
2. in the common event, target id is:

CODE
$scene.active_battler.current_action.target_index


But the script call you posted at the bottom from what I could understand does it on it's own.

This post has been edited by Vexus: Feb 27 2012, 03:14 PM


__________________________
Current Project/s:
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: 22nd May 2013 - 07:08 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker