Author Topic: [ How to ] Mapper - Script,Vars : Simple var script for kill quests  (Read 3118 times)

Hello all,
As the thread states, my question is; is there a simple script on setting a value of a variable?
Using vars only in dialogues makes quest sort of limited.
Im looking for something like; when a certain critter dies, value changes.
Thanks!
« Last Edit: June 25, 2012, 08:13:15 pm by muhoooool »

Re: Mapper - Script,Vars : Simple var script?
« Reply #1 on: June 13, 2012, 10:57:27 pm »
there are lots of these in SDK.

check any quest script, for example q_dappo_lost_c_robot.fos

Code: [Select]
    GameVar@ buster_status = GetLocalVar( LVAR_ncr_buster_lost_c_status, fromCr.Id );
    buster_status = 2;

Quote
Im looking for something like; when a certain critter dies, value changes.

try using critter event triggering it. there are probably lots of examples of using critter events in sdk.

Re: Mapper - Script,Vars : Simple var script?
« Reply #2 on: June 17, 2012, 09:59:12 pm »
HERE
is a simple var script!
this script changes value of a var when npc dies.

Add your_script_name.fos to server/script.cfg
Add your_script_name inside mapper to npc > script
add _MuholInit iside mapper to npc > function

Code: [Select]
#include "_macros.fos"

void _MuholInit( Critter& npc, bool firstTime )
{

npc.StatBase[ ST_AI_ID ] = 55; // AI OF NPC FROM _ai.fos /server/scripts ( set to vic defensive )
npc.StatBase[ ST_TEAM_ID ] = 0; // TEAM FROM _teams.fos ... set to plyer?
npc.StatBase[ ST_DIALOG_ID  ] = 30000; // DIALOG
npc.ModeBase[ MODE_NO_PVP ] = 0;
npc.SetEvent( CRITTER_EVENT_DEAD, "_MuholDead" ); // if event is CRITTER_EVENT_DEAD ( if critter dies) initites void _MuholDead
}

void _MuholDead( Critter& npc, Critter@ killer )
 {if (killer.IsPlayer())
{
    GameVar@ var = GetLocalVar( LVAR_muhol_quest, killer.Id ); // gets local var(for individual player) ( I think global var is for all players
    var = 1; // Sets the var from above to 1 ( In dialogue now you can demand the var value of 1
}
}
« Last Edit: June 21, 2012, 10:06:23 am by JovankaB »