IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Post mod/code requests in the Mod Requests topic

Post mod releases in the Mod Showroom

Read the Modding Rules BEFORE posting!

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 [Help] Save int, bool etc.

 Into output file and read.
 
Nevitro  
Posted: Sunday, Jul 29 2012, 06:40
Quote Post


Modder
Group Icon
Group: Members
Joined: Mar 31, 2009

pl.gif

XXXXX



Hello.
My it's it - example i got "life int" in .cs file. I want read how many HP got player, then save this and use in script. Problem? Must save and remember always. Get out from game and when player come back play - his life will get from script file.

How its look?
Myscript.cs got some values - life for example.
I want to get how much HP he got.
Save this into outside file.
Again when player will play again - script will get life from file.

What i just want?
Process about save to output file and then read from his...

What You got when help me?
You will be in credis script [like here with Flatout Script - AngryAmoeba helped me and he are in credits.]

Thanks!
Users WebsitePMMSN
  Top
 

 
DoTTGaMMa  
Posted: Sunday, Jul 29 2012, 19:11
Quote Post


The Coder
Group Icon
Group: Members
Joined: Aug 11, 2010

us.gif

XXXXX



From what I can understand from what you have said, you want to save current In-Game information into an outside file...

This can be easily accomplished by using the feature that comes with the .NET scripthook that allows .INI configuration I/O, "Settings".

To use it all you have to do is using the settings keyword, which makes a reference to an outside .INI text file which must be in your scripts folder along with the mod and it must have the same file name as your mod.
example: Mod File = myMod.net.dll
Mod INI = myMod.ini

Settings.GetValueBool
Settings.SetValueBool
etc...

These I/O Functions will set/ get information from/ to the .INI file.
PMMSNXbox Live
  Top
 

 
Nevitro  
Posted: Sunday, Jul 29 2012, 20:16
Quote Post


Modder
Group Icon
Group: Members
Joined: Mar 31, 2009

pl.gif

XXXXX



CODE

[...]
using System.IO;
[...]

[...]
life = Player.Character.Health;
SettingsFile.SetValue(YOURLIFE, ??string??[category?], life)
SettingsFile.GetValueInteger(YOURLIFE, 200)
[...]


In .ini file i will got YOURLIFE yeah? But this sould look like that? :
CODE

[SETTINGS]
YOURLIFE=200



What is "category" in "SetValue" ...? It's "SETTINGS"?


Edit:
Ok now i know...

QUOTE



Settings.GetValueInteger("YOURLIFE", 200);    // Get Life from ini file. [example Lifescript.ini ]

life = Player.Character.Health;  // save health from player to "life" integer.
Settings.SetValue("YOURLIFE", life); // Set 'life' from game to ini file [its look like that - "YOURLIFE = 100"]


Now i can make RPG mod... Thanks man! smile.gif



This post has been edited by Nevitro on Sunday, Jul 29 2012, 20:43
Users WebsitePMMSN
  Top
 

 

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG