Hiho leude ,
Ich arbeite gerade an einem Script für das tool , folgende dinge möchte ich tun :
Ich will ,dass wenn ein schalter umgelegt ist , dem spieler ALLE ITEMS inklusive der items im partyinventory weggenohmen werden , der clearinventory befehl funktioniert leider nur auf die items ,die der char am körper trägt
Hier mein Script :
#include "placeable_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
int bEventHandled = TRUE;
if(nEventType == EVENT_TYPE_USE)
{
object oUser = GetEventCreator(ev);
object oParty = GetParty(oUser);
int nAction = GetPlaceableAction(OBJECT_SELF);
int nVariation = GetEventInteger(ev, 0);
int nActionResult = TRUE;
Chargen_ClearInventory(oParty);
if (bEventHandled)
{
SetPlaceableActionResult(OBJECT_SELF, nAction, nActionResult, nVariation);
}
}
if (!bEventHandled)
{
HandleEvent(ev, RESOURCE_SCRIPT_PLACEABLE_CORE);
}
}
habe in den templates leider kein befehl für das vernichten des kompletten partyinventories gefunden
was ich gefunden habe ,war ein storepartyinventory befehl , wäre es daher ratsam zu versuchen ,das partyinventory komplett irgendwo zu lagern ? wenn ja , muss es ein objekt sein ,dass man dann zerstört oder wie muss das funktionieren?
Hilfe für Scripting benötigt
Débuté par
Sultschiem
, janv. 09 2010 02:42
#1
Posté 09 janvier 2010 - 02:42
#2
Posté 09 janvier 2010 - 06:41
booah, da bist du schon viel weiter als ich ... lua kann ich scripten, aber c++ ist mir noch ein bissel suspekt ! also leider keine wirkliche hilfe ..
das englische forum ist da eventuell die bessere anlaufstelle !
greets
das englische forum ist da eventuell die bessere anlaufstelle !
greets
#3
Posté 11 janvier 2010 - 09:28
hehe jo lua behersche ich auch recht gut , aber das script raubt mir so ziemlich den letzten nerv 
arbeite in der games academy gerade mit nen paar proggern zusammen ,die haben auch so ihre probleme damit
aber problem wurde gelöst , script für komplette inventory löschen :
#include "placeable_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
int bEventHandled = TRUE;
if(nEventType == EVENT_TYPE_USE)
{
object oUser = GetEventCreator(ev);
int nAction = GetPlaceableAction(OBJECT_SELF);
int nVariation = GetEventInteger(ev, 0);
int nActionResult = TRUE;
object [] oInv = GetItemsInInventory(oUser);
int i;
for(i = 0; i < GetArraySize(oInv); i++){
RemoveItem(oInv[i]);
}
DisplayStatusMessage("I'm in lever, stealin' yer itemz!");
if (bEventHandled)
{
SetPlaceableActionResult(OBJECT_SELF, nAction, nActionResult, nVariation);
}
}
if (!bEventHandled)
{
HandleEvent(ev, RESOURCE_SCRIPT_PLACEABLE_CORE);
}
}
wohlgemerkt , das script hab ich nem schalter zugeordnet , für trigger etc muss man den grundrahmen abändern ,der hauptibnhalt ist aber das gleiche
arbeite in der games academy gerade mit nen paar proggern zusammen ,die haben auch so ihre probleme damit
aber problem wurde gelöst , script für komplette inventory löschen :
#include "placeable_h"
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
int bEventHandled = TRUE;
if(nEventType == EVENT_TYPE_USE)
{
object oUser = GetEventCreator(ev);
int nAction = GetPlaceableAction(OBJECT_SELF);
int nVariation = GetEventInteger(ev, 0);
int nActionResult = TRUE;
object [] oInv = GetItemsInInventory(oUser);
int i;
for(i = 0; i < GetArraySize(oInv); i++){
RemoveItem(oInv[i]);
}
DisplayStatusMessage("I'm in lever, stealin' yer itemz!");
if (bEventHandled)
{
SetPlaceableActionResult(OBJECT_SELF, nAction, nActionResult, nVariation);
}
}
if (!bEventHandled)
{
HandleEvent(ev, RESOURCE_SCRIPT_PLACEABLE_CORE);
}
}
wohlgemerkt , das script hab ich nem schalter zugeordnet , für trigger etc muss man den grundrahmen abändern ,der hauptibnhalt ist aber das gleiche
#4
Posté 16 janvier 2010 - 11:56
Einfacher oder "eleganter" ist es bei solchen Funktionen die man evtl. doch noch in anderen Scripten und in anderer Form gebrauchen kann, diese in eine Include auszu lagern.
z.B. my_utility_h.nss
sähe dan in etwa so aus
lG Silk
z.B. my_utility_h.nss
sähe dan in etwa so aus
/** @addtogroup Scripting Utility
*
* Meine Funktions Sammlung
*/
/** @{*/
//void main() {}
/** @brief entfernt alle Items aus einem Inventar.
* @param oTarget: Objekt dessen Inventar gelehrt werden soll.
* @author SilkD
* @date 16-01-2010
*/
void my_ClearInventar(object oTarget);
void my_ClearInventar(object oTarget)
{
object [] oInv = GetItemsInInventory(oTarget);
int i;
for(i = 0; i < GetArraySize(oInv); i++)
{
RemoveItem(oInv[i]);
}
}
/** @} */
// eof
lG Silk
Modifié par cyberbyte, 17 janvier 2010 - 12:19 .
#5
Posté 17 janvier 2010 - 04:12
so, bin auch mal dran mit hilfe ...
irgendwie funzt mein quest nicht, ich fertige die ratten ab (Team ID 99) und nichts geht ...
wo wird den die ID eingetragen beim script ???
case EVENT_TYPE_TEAM_DESTROYED:
{
int nTeam = GetEventInteger(ev, 0); // the team number that was destroyed.
// Insert event-handling code here.
break;
}
doinke für die hilfe ... so sieht mein ganzes script aus ! ....
#include "log_h"
#include "plot_h"
#include "utility_h"
#include "sys_chargen_h"
#include "sys_rewards_h"
#include "plt_Rattenplage"
void main()
{
event ev = GetCurrentEvent();
object oHero = GetHero();[/b]
switch(GetEventType(ev))
{
case EVENT_TYPE_MODULE_START:
{
// skip character generation
Chargen_InitializeCharacter(oHero);
// create a female, elf, wizard
SetName(oHero, "Elissanna");
Chargen_SelectGender(oHero, GENDER_FEMALE);
Chargen_SelectRace(oHero, RACE_ELF);
Chargen_SelectCoreclass(oHero, class_WIZARD);
Chargen_SelectBackground(oHero, BACKGROUND_MAGI);
AS_AddclassLevels(oHero, class_WIZARD, 1);
// give the player some equipment
EquipItem(oHero, UT_AddItemToInventory(R"gen_im_wep_mag_sta_mgc.uti"));
EquipItem(oHero, UT_AddItemToInventory(R"gen_im_cth_mag_tvm.uti"));[/b][b]
// select some spell for the player
_AddAbility(oHero, ABILITY_SPELL_ARCANE_BOLT);
_AddAbility(oHero, ABILITY_SPELL_WINTERS_GRASP);
_AddAbility(oHero, ABILITY_SPELL_LIGHTNING);
_AddAbility(oHero, ABILITY_SPELL_PARALYZE);
_AddAbility(oHero, ABILITY_SPELL_SHOCK);
_AddAbility(oHero, ABILITY_SPELL_CONE_OF_COLD);
break;
}
////////////////////////////////////////////////////////////////////////
// Sent by: Scripting
// When: The last creature of a team dies
////////////////////////////////////////////////////////////////////////
case EVENT_TYPE_TEAM_DESTROYED:
{
int nTeam99 = GetEventInteger(ev, 0); // Team ID
{
WR_SetPlotFlag(PLT_RATTENPLAGE,MONSTER_SLAIN, TRUE);
}
break;
}
}
// call core module event handler
HandleEvent(ev, R"module_core.ncs");
}
irgendwie funzt mein quest nicht, ich fertige die ratten ab (Team ID 99) und nichts geht ...
wo wird den die ID eingetragen beim script ???
case EVENT_TYPE_TEAM_DESTROYED:
{
int nTeam = GetEventInteger(ev, 0); // the team number that was destroyed.
// Insert event-handling code here.
break;
}
doinke für die hilfe ... so sieht mein ganzes script aus ! ....
#include "log_h"
#include "plot_h"
#include "utility_h"
#include "sys_chargen_h"
#include "sys_rewards_h"
#include "plt_Rattenplage"
void main()
{
event ev = GetCurrentEvent();
object oHero = GetHero();[/b]
switch(GetEventType(ev))
{
case EVENT_TYPE_MODULE_START:
{
// skip character generation
Chargen_InitializeCharacter(oHero);
// create a female, elf, wizard
SetName(oHero, "Elissanna");
Chargen_SelectGender(oHero, GENDER_FEMALE);
Chargen_SelectRace(oHero, RACE_ELF);
Chargen_SelectCoreclass(oHero, class_WIZARD);
Chargen_SelectBackground(oHero, BACKGROUND_MAGI);
AS_AddclassLevels(oHero, class_WIZARD, 1);
// give the player some equipment
EquipItem(oHero, UT_AddItemToInventory(R"gen_im_wep_mag_sta_mgc.uti"));
EquipItem(oHero, UT_AddItemToInventory(R"gen_im_cth_mag_tvm.uti"));[/b][b]
// select some spell for the player
_AddAbility(oHero, ABILITY_SPELL_ARCANE_BOLT);
_AddAbility(oHero, ABILITY_SPELL_WINTERS_GRASP);
_AddAbility(oHero, ABILITY_SPELL_LIGHTNING);
_AddAbility(oHero, ABILITY_SPELL_PARALYZE);
_AddAbility(oHero, ABILITY_SPELL_SHOCK);
_AddAbility(oHero, ABILITY_SPELL_CONE_OF_COLD);
break;
}
////////////////////////////////////////////////////////////////////////
// Sent by: Scripting
// When: The last creature of a team dies
////////////////////////////////////////////////////////////////////////
case EVENT_TYPE_TEAM_DESTROYED:
{
int nTeam99 = GetEventInteger(ev, 0); // Team ID
{
WR_SetPlotFlag(PLT_RATTENPLAGE,MONSTER_SLAIN, TRUE);
}
break;
}
}
// call core module event handler
HandleEvent(ev, R"module_core.ncs");
}
Modifié par mr.frost72, 17 janvier 2010 - 04:23 .
#6
Posté 17 janvier 2010 - 01:53
du müsstest die ID für das Team also bei dir für die Ratten vorher festlegen. Das kann man am Besten in einer separaten Include für Variablen... Im Beispiel mach ich das aber mal über dem normalen Script.
-> const int TEAM_MY_RATS_1 = 99;
Statt im Modul Script kannst du sowas auch besser im jeweiligen Area Event Script einfügen da dein Modul Script sonst unüberschaubar wird. Und so nur Ballast mit schleppt der das ganze Spiel ausbremst.
also hier das Beispiel für dein Area Script aussehn könnte
hoffe hilft dir weiter
biba Silk
-> const int TEAM_MY_RATS_1 = 99;
Statt im Modul Script kannst du sowas auch besser im jeweiligen Area Event Script einfügen da dein Modul Script sonst unüberschaubar wird. Und so nur Ballast mit schleppt der das ganze Spiel ausbremst.
also hier das Beispiel für dein Area Script aussehn könnte
//:: Area Events
//:://////////////////////////////////////////////
/*
Area events script
*/
//:://////////////////////////////////////////////
//:: Created By:
//:: Created On:
//:://////////////////////////////////////////////
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "cutscenes_h"
#include "sys_ambient_h"
#include "sys_audio_h"
#include "plot_h"
#include "sys_rewards_h"
#include "plt_rattenplage"
const int TEAM_MY_RATS_1 = 99; // Team ID für die Ratten
void main()
{
event ev = GetCurrentEvent();
int nEventType = GetEventType(ev);
string sDebug;
object oPC = GetHero();
string sMyTag = GetTag(OBJECT_SELF);
switch(nEventType)
{
case EVENT_TYPE_TEAM_DESTROYED:
{
int nTeamID = GetEventInteger( ev, 0 );
switch (nTeamID)
{
case TEAM_MY_RATS_1:
{
// hier kommt der Teil was gemacht werden soll wenn
// Team TEAM_MY_RATS_1 gekillt wurde rein
// START TEAM_RATS_DESTROYED
WR_SetPlotFlag(PLT_RATTENPLAGE,MONSTER_SLAIN, TRUE);
// END TEAM_RATS_DESTROYED
break;
}
}
}
}
HandleEvent(ev, RESOURCE_SCRIPT_AREA_CORE);
}
hoffe hilft dir weiter
biba Silk
Modifié par cyberbyte, 17 janvier 2010 - 02:04 .





Retour en haut






