A few questions

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
Edit: I'm gonna end up throwing random questions in to this post. I may as well have 'em convenient for other people

Does $get_arrayfind return the idx of the of the string found, or does it return the string found?
Thothie said:
Index, or -1 if not found. (Like "$get_find_token(<token_sting>,<search_string>)")
When using callevent or callexternal or calleventloop, is it all called on the same frame?
Thothie said:
Yes. (Unless you use a delay, of course.)


Is ent_expowner essentially the person who killed the monster or is it who got the most xp, or is it a token of player ids of who got the xp?
Thothie said:
Neither. It's the target items or projectiles are passing experience to. (Really only applies to projectiles created via tossprojectile.)

There's, currently, no script array from which to pull the IDs of the players who struck the monster. Closest you can get is ent_laststruck (the last entity that struck the monster - which maybe an NPC or entity summoned by a player). Been meaning to implement one, as the information is stored code side on the mob, but not sure how easy it's going to be.


Is it possible to pull information from a monster that has died?
Thothie said:
You *might* be able to pull some information via $get(<dead_target>,scriptvar,<xxx>) for a few seconds, but no further scripts will run on the entity once game_death and anything called from there (without a delay) has completed. Generally, if you want a dead mob to store information, have it do so via a callexternal on the game_master or player where the mob calls game_death. (Though you can resurrect it by using "setalive 1" in game_death, but it leads to complications - see monsters reference skeleton_base or mummy_base.)


Is the game_master persistent across map changes?
Thothie said:
No, it resets with each map change. Globals (setvarg) persist between map changes, but only if there's no crash.


If you use applyeffect and in the effect use $get(ent_creationowner,id), will it grab the id of whoever applied the effect? Or would it grab who spawned the npc you're applying the effect on?
Thothie said:
The latter.

(ent_creationowner is the script that spawned the script, when said script is spawned via createnpc.)

Most applyeffects pass the inflicter as the second parameter for this reason.
[/code]


If you #include a script into another multiple times, does it create "duplicates?" I'm gonna test this later to see if it does.
Thothie said:
I've... Never tried that... But I assume so.
The Test said:
It appears that it doesn't add a copy. The way I tested it was:
Code:
//The first script
#include test_scripts/test
#include test_scripts/test

{
     setvard TESTMAN 0
}

{ game_heardtext

     callevent dotestman //This event adds 1 to TESTMAN
     saytext TESTMAN
}
Code:
//The "test" script
{ dotestman
     setvard TESTMAN $math(add,TESTMAN,1)
}
The saytext only added 1 every time, however, when adding two copies of "dotestman" to the original script and removing the includes, it adds two every time, so I don't think the event is getting override with each other.


Do conditions return true if its 1 or greater than 1? If it's set to a string or is 0 does it not pass?
Thothie said:
IIRC Conditions will return true so long as it is non-zero and not unset.

What exactly does $vec(x,y,z) do? Could I just use (x,y,z) as coordinates to spawn something?
Thothie said:
It assembles a series of numbers and/or vars into a proper vector, or returns a specific element of a vector. And yes, you can use it to define a spawn point. Generally, rather than passing raw vector data (eg. "(2000,2000,2000)"), it's better to use $vec(2000,2000,2000) as it generally prevents parsing issues and generates the proper floats.


How would I get a param passed from an applyeffect?
Thothie said:
Applyeffect <target> <effect_script> [params...] should pass all params to game_activate of <effect_script>.


How is $within_cone used? I see //(<point origin>,<cone origin>,<cone angles>,<cone apex angle>) in ms.stx, but I don't know what point origin or cone origin means. What does it return?
Returns 1 if <point_origin> is within the defined cone.


Is it possible to assemble a string that could then pull information from a var via the $get(<ent>,scriptvar,<assembled string of the var name>) ?
Well, for future reference, while I would avoid it, I tested it, and it does indeed work...


Still confused on those if conditionals without brackets...
No, it won't get there.

Provided the terminating conditional is at the lowest level, it exits the event, regardless of the brackets that follow.

Code:
setvard SOMETHING_IS 0

if ( !SOMETHING_IS )
{
   if SOMETHING_IS
   saytext This ain't happening
}
saytext This *is* happening...

if SOMETHING_IS //This ain't, thus we stop here

saytext So this isn't happening.

if ( SOME_CONDITIONAL ) //not ever seeing this
{
   saytext Not gettin here.
   if ( XX_XX == XX_XX )
   {
       saytext True as that was, we ain't ever gonna test it, cuz we stopped awhile ago.
   }
}

saytext Not getting here either.

if ( SOME_OTHER_CONDITIONAL )
{
   saytext Also not gettin here.
}

saytext Nor here.
Mind that you can't use "else" nor "else if" with a terminating conditional either... So...


Code:
game_scriptflag_update        //<action> <name> <type> <value> <base_expire_time> - called whenever scriptflags are updated via scriptflags command - do not alter scriptflags here or you may cause an infinite loop (delay 0.1 secs)
Does <action> mean the stuff in:
Code:
scriptflags    //New flag tracking system, has several formats, depending on desired action:
       //scriptflags <target> add <name> <type> [value] [expiretime:-1] [expiremsg]
       //- adding a scriptflag with a duplicate name resets its value, and its expire time
       //- unless the name starts with "stack", in which case it should have an expire time set
       //scriptflags <target> remove <name>
       //scriptflags <target> cleartype <type> - removes all of <type> from <target>
       //scriptflags <target> clearall - removes all scriptflags from target ent
       //scriptflags <target> remove_expired - removes expired flags from <target>
       //scriptflags <target> edit <name> <type> <value> [expiretime] [msg] - edits properties of first flag found with this name
Like the "add" "remove" "cleartype" 'n stuff?
Yes, the first param it receives is the second param of the scriptflags command.


Does setting a quest to '0' still save it to the character?
Apparently yes, darnitall.

There's a quest erase function, but it tends to cause memory dealloc errors.
 
Last edited:

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
greatguys1 said:
Does $get_arrayfind return the idx of the of the string found, or does it return the string found?
Index, or -1 if not found. (Like "$get_find_token(<token_sting>,<search_string>)")

greatguys1 said:
When using callevent or callexternal or calleventloop, is it all called on the same frame?
Yes. (Unless you use a delay, of course.)

greatguys1 said:
Is ent_expowner essentially the person who killed the monster or is it who got the most xp, or is it a token of player ids of who got the xp?
Neither. It's the target items or projectiles are passing experience to. (Really only applies to projectiles created via tossprojectile.)

There's, currently, no script array from which to pull the IDs of the players who struck the monster. Closest you can get is ent_laststruck (the last entity that struck the monster - which maybe an NPC or entity summoned by a player). Been meaning to implement one, as the information is stored code side on the mob, but not sure how easy it's going to be.

greatguys1 said:
Is it possible to pull information from a monster that has died?
You *might* be able to pull some information via $get(<dead_target>,scriptvar,<xxx>) for a few seconds, but no further scripts will run on the entity once game_death and anything called from there (without a delay) has completed. Generally, if you want a dead mob to store information, have it do so via a callexternal on the game_master or player where the mob calls game_death. (Though you can resurrect it by using "setalive 1" in game_death, but it leads to complications - see monsters reference skeleton_base or mummy_base.)

greatguys1 said:
Is the game_master persistent across map changes?
No, it resets with each map change. Globals (setvarg) persist between map changes, but only if there's no crash.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
Thothie said:
There's, currently, no script array from which to pull the IDs of the players who struck the monster. Closest you can get is ent_laststruck (the last entity that struck the monster - which maybe an NPC or entity summoned by a player). Been meaning to implement one, as the information is stored code side on the mob, but not sure how easy it's going to be.
Could I do:
Code:
{ game_death

	local L_KILLER_ID ent_laststruck
	if ( $get(L_KILLER_ID,isplayer) )
	{
		//Do Things
	}
	else if ( $get($get(L_KILLER_ID,owner),isplayer) )
	{
		//Do Things
	}
}
To emulate a "killer"?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Wouldn't cover every situation... Sometimes the final kill is even done through the game_master.

Slightly more thorough might be:
Code:
{ game_death

	local L_KILLER_ID $get(ent_laststruck,id)
	if ( !$get(L_KILLER_ID,isplayer) )
	{
		local L_POSSIBLE $get(L_KILLER_ID,scriptvar,'MY_OWNER') //player summoned mob or effect
		if ( $get(L_POSSIBLE,isplayer) )
		{
			local L_KILLER_ID L_POSSIBLE
		}
		else
		{
			local L_POSSIBLE $get(L_KILLER_ID,owner) //hopefully player projectile or weapon effect
			if $get(L_POSSIBLE,isplayer)
			local L_KILLER_ID L_POSSIBLE
		}
	}

	if ( $get(L_KILLER_ID,isplayer) )
	{
		//[whatevs]
	}
}
Trying to think of a way to pull ent_expowner from L_KILLER_ID, which would be more dependable for projectiles, but I'm having a brain fart as to how to do that. Nadda ya can do for some of the other possible situations. There is a code invoked script event on the player side that goes off whenever they gain XP, but it doesn't pass the monster ID, so no go.

Might also want that inside your "NPC_COUNT_DEATHS" conditional, or whatevs, so as to not add overhead for monster deaths on every map.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
If you use applyeffect and in the effect use $get(ent_creationowner,id), will it grab the id of whoever applied the effect? Or would it grab who spawned the npc you're applying the effect on?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
The latter.

(ent_creationowner is the script that spawned the script, when said script is spawned via createnpc.)

Most applyeffects pass the inflicter as the second parameter for this reason.

ms.stx:
Code:
blind			//<duration>
effect_burn		//<duration> <inflictor_id> [damage] [noglow_shell-0|1] [nolight-0|1] [xp_skill] //EFFECT_ID DOT_fire
effect_drunk		//<duration>
effect_flames		//<duration> - fx only
effect_freeze		//<duration> <???> - secondary djinn effect
effect_frost		//<duration> [inflictor_id] <dmg> [glow-0|1] [xp_skill] - (djinn_ice version)
effect_frostbite	//<duration> [inflictor_id]
effect_frostbite_dmg	//<duration> <inflictor_id> <dmg> [xp_skill]  //EFFECT_ID DOT_cold
effect_holy_dmg		//<duration> <inflictor_id> <dmg> [xp_skill]  //EFFECT_ID DOT_holy
effect_iceshield	//<duration> <dmg_multiplier>
effect_light		//<duration> <radius> <color>
effect_poison		//<duration> <inflictor_id> <dmg> <poison/disease-0|1> [xp_skill] //EFFECT_ID DOT_poison
effect_push		//<duration> <(vel)> [screenshake-0|1]
effect_rejuv2		//<heal_amt> [divinaion_skill] [healer_id]
effect_shock_dmg	//<duration> <inflictor_id> [dmg] [xp_skill] //EFFECT_ID DOT_lightning
effect_stun		//<duration> [slow_push-0|1] [cant_attack-0|1] [attacker]
freeze_solid		//<duration> <inflictor_id> [damage] [xp_skill] 
generic_damage		//<dmg> <inflictor_id> [noise-0|1] [dmg_type] [xp_skill] 
greater_poison		//<duration> <inflictor_id> <dmg> [xp_skill] //EFFECT_ID DOT_gpoison
poison_spore		//<duration> <inflictor_id> <dmg> [xp_skill] 
heavy_stun		//<duration> [inflictor_id] [cant_attack:0|1]
protection		//<duration> <dmg_multiplier>
sfx_motionblur		//<ent_idx> [duration]
speed			//<duration> <speed%> <framerate> - not sure if this works 100%
torch_flame		//<duration> - less sticky than items/base_lighted
effect_poison_dmg	//convention alias: effect_poison
effect_fire_dmg		//convention alias: effect_burn
effect_cold_dmg		//convention alias: effect_frostbite_dmg
effect_lightning_dmg	//convention alias: effect_shock_dmg
hold_person		//<duration> <inflictor_id> [dmg]
effect_webbed		//<cocoon_hp[x10,usually use mons maxhp]> <web_strength[>1 reduces #webs needed for cocoon]> [attacker] [duration] [dot]
effect_poison_blinding //<duration> <inflictor_id> [dmg] [xp_skill]
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
Thanks for all the help so far. I've got another one for you:
Are effects pretty much their own "object"? Are they removed when the thing it's applied to dies?

Also
Do monsters already try to attack critical npcs when in siege mode? Is siege mode activated when a critical npc is added? If not, how do I activate it?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
greatguys1 said:
Thanks for all the help so far. I've got another one for you:
Are effects pretty much their own "object"? Are they removed when the thing it's applied to dies?
It layers another script upon the existing object, sorta as if you did it via #include, but there's some oddities with the interaction, such as the fact that the previously existing script's callevents aren't triggered within the added applyeffect script, but the reverse works.

greatguys1 said:
Also
Do monsters already try to attack critical npcs when in siege mode? Is siege mode activated when a critical npc is added? If not, how do I activate it?
Calling the event "critical_npc" on any AI-enabled script will activate siege mode for all subsequently spawned monsters, meaning about a third of them will dedicate themselves to hunting the NPC, and be reluctant to engage players lest beat on enough, favoring the critical target. (If you are in developer mode, the NPCs doing this will glow like so.)

If you need to invoke it from an NPC that doesn't have AI, the monsters/externals event looks like so:
Code:
{ critical_npc

	//for siege mode maps
	invincible 0
	setvard NPC_CRITICAL 1
	token.add G_CRITICAL_NPCS $get(ent_me,id)
	setvarg G_SIEGE_MAP 1
	local FIRST_TOKEN $get_token(G_CRITICAL_NPCS,0)
	if ( !$get(FIRST_TOKEN,isalive) ) token.del G_CRITICAL_NPCS 0 //fix buggy token creation
}
Since G_CRITICAL_NPCS is a token string, you are limited in the number of critical NPCs you can have active at the same time (maybe ~10). G_SIEGE_MAP and G_CRITICAL_NPCS are reset at map start via sv_world.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
If you #include a script into another multiple times, does it create "duplicates?" Like say I have a script with
Code:
{ messageneer
dplayermessage PLAYERID "Message received"
}
And I #include it twice. If I callevent messageneer, would it display it twice?

Also
If I use
Code:
if ( MESSAGE_RECIEVED )
{ //things }
Would the condition only pass if its 1 or greater than 1? If it's set to a string or is 0 does it not pass?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
greatguys1 said:
If you #include a script into another multiple times, does it create "duplicates?" Like say I have a script with
Code:
{ messageneer
dplayermessage PLAYERID "Message received"
}
And I #include it twice. If I callevent messageneer, would it display it twice?
I've... Never tried that... But I assume so.

greatguys1 said:
Also
If I use
Code:
if ( MESSAGE_RECIEVED )
{ //things }
Would the condition only pass if its 1 or greater than 1? If it's set to a string or is 0 does it not pass?
IIRC MESSAGE_RECIEVED will return true so long as it is non-zero and not unset.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
What exactly does $vec(x,y,z) do? Could I just use (x,y,z) as coordinates to spawn something?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
It assembles a series of numbers and/or vars into a proper vector, or returns a specific element of a vector.

Examples:
Code:
	local TELE_POINT $vec(512,128,-16)
	vectoradd T_SPAWN $relpos($vec(0,ROT_STEP,0),$vec(0,F_DIST,40))
	local TARGET_Z $vec.z(TARGET_POS)
	setprop ent_me avelocity $vec(L_HAND_SPEED,0,0)
And yes, you can use it to define a spawn point. Generally, rather than passing raw vector data (eg. "(2000,2000,2000)"), it's better to use $vec(2000,2000,2000) as it generally prevents parsing issues and generates the proper floats.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
How would I get a param passed from an applyeffect? I see some getting it from game_activate, but my attempt doesn't seem to work. Doesn't really seem there's too much documentation on it either.
Code:
{ game_activate

	setvard DQ_WHERE_IS_THE_CREATOR PARAM1 //What's he saying?
	setvard DQ_QUEST_TAKER_ID $get(DQ_WHERE_IS_THE_CREATOR,scriptvar,'QUEST_TAKER')

	if ( $get(DQ_QUEST_TAKER_ID,exists) )
	{
		setvard MAX_DMG $get(DQ_QUEST_TAKER_ID,maxhp)
	}
}
I also just tried
Code:
{

	setvard DQ_WHERE_IS_THE_CREATOR PARAM1 //What's he saying?
	setvard DQ_QUEST_TAKER_ID $get(DQ_WHERE_IS_THE_CREATOR,scriptvar,'QUEST_TAKER')

	if ( $get(DQ_QUEST_TAKER_ID,exists) )
	{
		setvard MAX_DMG $get(DQ_QUEST_TAKER_ID,maxhp)
	}
}
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
That should work - applyeffect <target> <effect_script> [params...] should pass all params to game_activate of <effect_script>.

Could we see the applyeffect command on the application side of the script? Maybe there's a problem in the way the params are setup.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
Thothie_script_policy said:
- You cannot send params to a timed event (eg. callevent 2.0 shoot_fire FIRE_TARGET ), you must pass the vars via setvard
I was trying to pass a monster id through a timed event. The effect was never getting put on in the first place. My bad :oops:
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
How is $within_cone used? I see //(<point origin>,<cone origin>,<cone angles>,<cone apex angle>) in ms.stx, but I don't know what point origin or cone origin means. What does it return?
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Returns 1 if <point_origin> is within the defined cone.

The screwy bit is <cone_apex_angle> - it seems to work differently depending on the script (maybe server/client side thing or player/monster thing, not sure).

Shields and polearms use it to determine if an attack is coming from the front when blocking, thusly:
Code:
if $within_cone2D(TARG_ORG,OWNER_ORG,OWNER_ANG,100)
Dragon Axe determines if things are within the cone of fire, thusly:
Code:
if $within_cone2D(TARG_ORG,OWNER_ORG,OWNER_ANG,30)

But those same apex angles seem too wide for monsters... Thus, polar bear breath:
Code:
if $within_cone2D(TARG_ORG,game.monster.origin,game.monster.angles,10)
Even this works for a straight wide line, such as with the newer-elve's slam-line attacks:
Code:
if $within_cone2D(L_TARG_ORG,L_MY_ORG,L_MY_ANG,0.2)
($get_inbox would be better, but the code side of that needs some tweaking so we can provide it with mins/maxs.)

Even with the 2D variant, it expects a full set of angles, not just the yaw.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
Is there a specific function to get global vars? I know there's one for arrays, which is why I'm curious. Also where would you use setvar? Never really found a use for it
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Setvarg global vars are "gotten" the same way as any other var, just use their literal names (eg. "if G_WEATHER_LOCK"). Keep in mind they are server side only though. If you're trying to pull them at console through tdebug, make a scriptvar request for the variable from any debuggable mob or chest. (eg. ". tdebug ent_me scriptvar G_NOOB_ARROWS", or, I suppose, "lplayers scriptvar G_NOOB_ARROWS" will also work, if there's no mobs about.)

Also keep in mind that they persist between maps if the server doesn't smash (as it so often does), so you need to initiate them.

The "setvar" command is very rarely used, but it's purpose is for when you need something set at load or precache time, before run time, and may change it later. This, primarily, comes into play for idle and walk animations that need to be set on the monster when it spawns, before the AI starts looping, for a cleaner spawn in. In some of the older scripts, it gets used incorrectly, either due to conventions used in older versions, or simple misunderstandings among amature scripters as to its use. This did occasionally cause problems, though I think we've caught most of those over the years. (IIRC, a big one was one of the Edana quests - it was using the last occurrence of setvar it found in the script, causing the quest to always read as completed. Took forever to catch that - think we can pin the blame on Lord K or Evaan - the bug was so old.)

Suffice to say, 99.999% of the time, stick to "setvard" (or "local", if you don't need it outside of the event, of course). Setvar's are also the one case where you can re-define the type safely (though only via "setvard", not "const" or "local").
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
I can only find minimal documentation regarding effects. I can take a guess at a few, like reg.effect.name, but these others I don't really know what they're for.
Code:
reg.effect.flags

game.effect.removeondeath //I can take a guess at what this does, but does it take <1|0> inputs?
game.effect.id
game.effect.flags
game.effect.type

registereffect
I imagine registereffect is similar to how registerattack works, but would still like an idea as to what exactly it does.
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
game.effect.removeondeath
- Yes, removes effect from the entity on death. This should always be 1, aside from a few player effects. (It defaults to 1 in the base.)

game.effect.id
- This is the ID used for $get(<target>,haseffect,<effect_id>), and removeeffect <target> <effect_id>
- DOT effects usually have their effect_id prefixed with DOT_

game.effect.flags
- The only flag in use at the moment is "nostack", which prevents repeated applications of the same effect if an effect with the same effect_id is applied.

game.effect.type
- This... Umm... The hell...
Code:
	foreach( i, m_Scripts.size() )
	{
		CScript *Script = m_Scripts[i];
		if( !Script->VarExists( "game.effect.type" ) )
			continue;

		//Update stuff based on effect script variables.
		//To check for a 'true' blocking value make sure that it has explicitly set to "0".  If it was never set at all, assume false.
		int EffectFlags = 0;
		if( !strcmp(Script->GetVar( "game.effect.canmove" ),"0") ) SetBits( EffectFlags, PLAYER_MOVE_NOMOVE );
		if( !strcmp(Script->GetVar( "game.effect.canrun" ),"0") ) SetBits( EffectFlags, PLAYER_MOVE_NORUN );
		if( !strcmp(Script->GetVar( "game.effect.canjump" ),"0") ) SetBits( EffectFlags, PLAYER_MOVE_NOJUMP );
		if( !strcmp(Script->GetVar( "game.effect.canduck" ),"0") ) SetBits( EffectFlags, PLAYER_MOVE_NODUCK );
		if( !strcmp(Script->GetVar( "game.effect.canattack" ),"0") ) SetBits( EffectFlags, PLAYER_MOVE_NOATTACK );

		SetBits( m_StatusFlags, EffectFlags );	//Add the movement blocking flags from this effect to the player's list

		if( strcmp(Script->GetVar( "game.effect.updateplayer" ),"1") )
			continue;

		//logfile << "XEBUG: ApplyEffect->Client " << Script->GetVar("game.effect.displayname") << "\n";

		MESSAGE_BEGIN( MSG_ONE, g_netmsg[NETMSG_CLDLLFUNC], NULL, pev );
			WRITE_BYTE( 16 );
			WRITE_BYTE( 1 );
			WRITE_STRING( Script->GetVar("game.effect.id") );
			WRITE_STRING( Script->GetVar("game.effect.displayname") );
		MESSAGE_END();

		Script->SetVar( "game.effect.updateplayer", 0 );
	}
Eh, I've no idea what that does. But, apparently, if it isn't set, subsequent effect conditionals won't take place. In the base, it simply has game.effect.flags mirrored to it.

Aside from that weirdness, please note that effects/effect_base is also used by player/emote_sit&stand, thus any erroneous changes to it will break the ability for players to sit/emote (or even prevent the game from loading entirely). Said constant applyeffect is also used to alter player speed through scriptflags.


What I'd *really* like to do, however, is move the whole applyeffect DOT system to a scriptflags function that just applies the non-expired stacks of DOT damage to the target every second. This would prevent the effect where, for instance, when a low level player catches a mob on fire, any more powerful fire effect from more powerful players will be ignored until it times out, let multiple players stack damage of the same element, as well as remove the overhead of the applyeffect system from DOTs entirely.

The scriptflag data would need a tokenized string containing the ID of the attacker, in addition to the damage done, in order to credit said damage properly, which may make it more difficult to simply add up the scriptflags via $get_scriptflag(<target>,<type>,type_value)... Though maybe one could store the effect_id in <type>, the attacker ID in <name>, and the DOT in <value>. Applyeffects that screw with movement might still need to be as they are though. (There's a scriptflag for player speed, but there's also the difficulty of locking targets in place, and I dun think there's any such scriptflag for mobs yet.)

The scriptflags system is, however, incredibly complicated, as you might garner from the ms.stx.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
Is it possible to assemble a string that could then pull information from a var? Sorta like:
Code:
{
   const THIS_THING 1
   const THIS_THING 2
}

{ game_spawn
   local L_STRING_THIS "THIS_"
   local L_STRING_THING "THING"

   local L_RAND $rand(1,2)

   local L_THINGY L_STRING_THIS
   stradd L_THINGY L_STRING_THING
   stradd L_THINGY L_RAND

   local L_THINGY $get(ent_me,scriptvar,L_THINGY)
}
Or something like that
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
I... Ummm.... Hrmm.... Wait... What?

Joe1j_f-maxage-0_s-200x150.gif

...I'd have to test and get back to you on that.

Though, I've no idea why you'd do such a thing - and if you found a reason, there's probably a more sensical way to go about it.

(Though I assume you mean:)
Code:
setvard THIS_THING1 1
setvard THIS_THING2 2
...as otherwise, I'm having my mind blown for no reason, and simply have no idea what you're trying to do. (Also you can't pull constants via scriptvar.)

Also, you'd have to $int() that rand, otherwise you would get THIS_THING1.00/THIS_THING2.00.

...to correct and simplify:
Code:
{ event_of_insanity
	setvard THIS_THING1 string1
	setvard THIS_THING2 string2

	local L_PULL_RND_VAR 'THIS_THING'
	local L_RND $rand(1,2)
	stradd L_PULL_RND_VAR $int(L_RND)
	saytext Rnd var content is $get(ent_me,scriptvar,L_PULL_RND_VAR)
	//theoretically returns either "string1" or "string2"
}
Is what you're trying to do, yes? Pull a var for which the name has been randomly selected? Not sure if it'll work, or what situation you'd get yourself into where you'd need it, will have to test when I get back.
 

greatguys1

Epic Adventurer
MSC Developer
Warriors of the North
MSC Archivist
Joined
Apr 20, 2013
Messages
339
Reaction score
62
Age
26
Location
Yes
Thothie said:
I... Ummm.... Hrmm.... Wait... What?

Joe1j_f-maxage-0_s-200x150.gif

...I'd have to test and get back to you on that.

Though, I've no idea why you'd do such a thing - and if you found a reason, there's probably a more sensical way to go about it.

(Though I assume you mean:)
Code:
setvard THIS_THING1 1
setvard THIS_THING2 2
...as otherwise, I'm having my mind blown for no reason, and simply have no idea what you're trying to do. (Also you can't pull constants via scriptvar.)

Also, you'd have to $int() that rand, otherwise you would get THIS_THING1.00/THIS_THING2.00.

...to correct and simplify:
Code:
{ event_of_insanity
	setvard THIS_THING1 string1
	setvard THIS_THING2 string2

	local L_PULL_RND_VAR 'THIS_THING'
	local L_RND $rand(1,2)
	stradd L_PULL_RND_VAR $int(L_RND)
	saytext Rnd var content is $get(ent_me,scriptvar,L_PULL_RND_VAR)
	//theoretically returns either "string1" or "string2"
}
Is what you're trying to do, yes? Pull a var for which the name has been randomly selected? Not sure if it'll work, or what situation you'd get yourself into where you'd need it, will have to test when I get back.
I'm trying to have a thing build a string of the var it needs then get it that way. Otherwise I'd have to write a whole new thing for each var that I want. Trying to take a shortcut :I
And yeah, that is what I mean
 

Thothie

Administrator
Staff member
Administrator
Moderator
MSC Archivist
Joined
Apr 8, 2005
Messages
16,342
Reaction score
326
Location
lost
Yeeeah, while it may be possible, an array could probably be implemented do it more simply, if simply passing the intended the var into a temporary var wouldn't. I'd have to see the sauce to be sure, of course, just can't imagine a situation where it'd be otherwise off the top of my head.
 
Top