fodev.net
FOnline Development => General Discussion => Topic started by: muhoooool on June 11, 2012, 03:38:12 pm
-
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!
-
there are lots of these in SDK.
check any quest script, for example q_dappo_lost_c_robot.fos
GameVar@ buster_status = GetLocalVar( LVAR_ncr_buster_lost_c_status, fromCr.Id );
buster_status = 2;
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.
-
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
#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
}
}